{"id":15011692,"url":"https://github.com/garcia-tech/garcia","last_synced_at":"2025-04-12T03:31:04.030Z","repository":{"id":64442630,"uuid":"575812151","full_name":"garcia-tech/garcia","owner":"garcia-tech","description":"Garcia is a .NET framework","archived":false,"fork":false,"pushed_at":"2025-02-02T10:16:07.000Z","size":9080,"stargazers_count":14,"open_issues_count":1,"forks_count":3,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-25T23:24:09.028Z","etag":null,"topics":["c-sharp","cqrs","ddd","domain-driven-design","dotnet","dotnet-framework","framework","microservice","nuget-package","onion-architecture"],"latest_commit_sha":null,"homepage":"https://garcia.tech","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/garcia-tech.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-12-08T10:59:40.000Z","updated_at":"2024-05-02T06:00:58.000Z","dependencies_parsed_at":"2023-02-19T17:46:10.167Z","dependency_job_id":"7cf91889-ec4b-42ce-b9a1-8ecd138b8930","html_url":"https://github.com/garcia-tech/garcia","commit_stats":{"total_commits":358,"total_committers":11,"mean_commits":32.54545454545455,"dds":0.5558659217877095,"last_synced_commit":"22004170faaea65a5d9ee040b1031ad6e922c7a0"},"previous_names":[],"tags_count":198,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/garcia-tech%2Fgarcia","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/garcia-tech%2Fgarcia/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/garcia-tech%2Fgarcia/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/garcia-tech%2Fgarcia/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/garcia-tech","download_url":"https://codeload.github.com/garcia-tech/garcia/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248512505,"owners_count":21116614,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["c-sharp","cqrs","ddd","domain-driven-design","dotnet","dotnet-framework","framework","microservice","nuget-package","onion-architecture"],"created_at":"2024-09-24T19:41:27.502Z","updated_at":"2025-04-12T03:31:02.162Z","avatar_url":"https://github.com/garcia-tech.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# \u003cimg src = \"http://www.garcia.com.tr/assets/base/img/layout/logos/logo-3.png\" width = 200 alt = \"Garcia\"/\u003e\n\nGarcia is a .Net framework that includes various integrations and utility services. Garcia provides developers to develop fast and powerful web APIs without wasting time with integrations.\n\n## Project Architecture:\n\nThe architecture is based on the Onion Architecture, so it can be easily used in DDD projects. \nYou can take a look at what \u003ca href= \"https://jeffreypalermo.com/2008/07/the-onion-architecture-part-1/\"\u003e\nOnion Architecture \u003c/a\u003e is.\n\n## Which Project Layer Contains What ?\n\u003ci\u003e The project basically consists of 4 layers. These are \u003c/i\u003e :\n\n| Layer  | Content |\n| ------ | ------- |\n| Domain: | Contains different types of base entity classes and interfaces.|\n| Application:    | Contains some application services , infrastructure services contracts and persistence services contracts. |\n| Infrastructure: | The layer of integration and infrastructural services. It contains external service registrations, integration adapter services, some settings classes and interfaces, different kind of base controllers.\n| Persistence : | The layer of persistency. It contains repository services, db context classes and registration services of them.\n\n## Table of Contents:\n\n### Repositories:\n\u003cul\u003e\n    \u003cli\u003e EntityFramework \u003c/li\u003e\n    \u003cli\u003e MongoDb \u003c/li\u003e\n    \u003cli\u003e Cassandra \u003c/li\u003e\n\u003c/ul\u003e\n\n### Message Brokers(AMQP, Pub/Sub):\nGarcia has own service bus system. Take a look at \u003ca\u003ehere\u003c/a\u003e.\n\nYou can use the following technologies either with garcia service bus or with their own services.\n\n\u003cul\u003e\n    \u003cli\u003e RabbitMQ \u003c/li\u003e\n    \u003cli\u003e Redis Pub/Sub \u003c/li\u003e\n    \u003cli\u003e Kafka: \u003ci\u003eComing Soon\u003c/i\u003e \u003c/li\u003e\n\u003c/ul\u003e\n\n### Caching:\n\u003cul\u003e\n    \u003cli\u003e GarciaCache \u003c/li\u003e\n    \u003cli\u003e Redis \u003c/li\u003e\n\u003c/ul\u003e\n\n### Search Engines:\n\u003cul\u003e\n    \u003cli\u003e ElasticSearch \u003c/li\u003e\n\u003c/ul\u003e\n\n### Real Time:\n\u003cul\u003e\n    \u003cli\u003e SignalR \u003c/li\u003e\n    \u003cli\u003e WebSocket: \u003ci\u003eComing Soon\u003c/i\u003e \u003c/li\u003e\n\u003c/ul\u003e\n\n### Push Notification:\n\u003cul\u003e\n    \u003cli\u003e Firebase \u003c/li\u003e\n    \u003cli\u003e Expo Push Notification: \u003ci\u003eComing Soon\u003c/i\u003e \u003c/li\u003e\n\u003c/ul\u003e\n\n### API Gateway / Service Discovery:\n\u003cul\u003e\n    \u003cli\u003e Ocelot \u003c/li\u003e\n    \u003cli\u003e Consul \u003c/li\u003e\n    \u003cli\u003e Eureka (with Ocelot) \u003c/li\u003e\n\u003c/ul\u003e\n\n### Logging:\n\u003cul\u003e\n    \u003cli\u003e Serilog \u003c/li\u003e\n    \u003cli\u003e Serilog.Elasticsearch \u003c/li\u003e\n    \u003cli\u003e Serilog.Graylog \u003c/li\u003e\n\u003c/ul\u003e\n\n### Email:\n\u003cul\u003e\n    \u003cli\u003e Email \u003c/li\u003e\n    \u003cli\u003e Email.Mandrill \u003c/li\u003e\n\u003c/ul\u003e\n\n### Localization:\n\u003cul\u003e\n    \u003cli\u003e Localization \u003c/li\u003e\n\u003c/ul\u003e\n\n### File Upload:\n\u003cul\u003e\n    \u003cli\u003e FileUpload \u003c/li\u003e\n    \u003cli\u003e FileUpload.AmazonS3 \u003c/li\u003e\n\u003c/ul\u003e\n\n### Marketing:\n\u003cul\u003e\n    \u003cli\u003e Marketing.Mailchimp \u003c/li\u003e\n\u003c/ul\u003e\n\u003cbr\u003e\u003c/br\u003e\n\n## Installation:\n\nIntall Garcia and it's dependencies using NuGet:\n\n \u003ccode\u003eNuGet\u003c/code\u003e\n\n ```ps\n \u003e Install-Package Garcia\n ```\n\n Or:\n\n\u003ccode\u003e.NET CLI: \u003c/code\u003e\n\n ```ps\n \u003e dotnet add package Garcia\n ```\n\n ## Quick Start:\n\nLet's create a simple crud service with Entity Framework for a quick start.\n\n### Creating a Project:\n\n ```ps\n \u003e dotnet new webapi --name QuickStart \n ```\n\n### Add Garcia To The Project :\n\n ```ps\n \u003e dotnet add package Garcia\n ```\n\n### Create Sample Entity:\n\n```cs\nusing Garcia.Domain;\n\nnamespace QuickStart;\n\npublic class Sample : Entity\u003clong\u003e\n{\n    public string Name { get; set; }\n}\n```\n\n### Create SampleDto: \n\n```cs\npublic class SampleDto\n{\n    public long Id { get; private set; }\n    public string Name { get; set; }\n}\n```\n\n### Create SampleController:\n\n```cs\nusing Garcia.Application.Services;\nusing Garcia.Infrastructure.Api.Controllers;\nusing Microsoft.AspNetCore.Mvc;\n\nnamespace QuickStart.Controllers;\n\n[ApiController]\npublic class SampleController : BaseController\u003cSample, SampleDto\u003e\n// BaseController has 2 generic parameters. These are an Entity\u003clong\u003e and a Dto of the Entity.\n{\n    public SampleController(IBaseService\u003cSample, SampleDto, long\u003e services) : base(services)\n    {\n    }\n}\n```\n\n### Register Services To The Program:\n\nLet's register the EntityFramework, repository services and IBaseService.\n\nAdd the following statements to the program class:\n\n```cs\nusing Garcia.Application;\nusing Garcia.Application.Contracts.Persistence;\nusing Garcia.Persistence.EntityFramework;\nusing QuickStart;\n\nvar builder = WebApplication.CreateBuilder(args);\n\n// Other configurations ...\n\nbuilder.Services\n    .AddEfCoreInMemory\u003cBaseContext\u003e(\"Sample\")\n    .AddEfCoreRepository();\n\nbuilder.Services.AddBaseService\u003cSample, SampleDto\u003e();\n// BaseService also has a 2 generic parameters. These are an Entity\u003clong\u003e and a Dto of the Entity.\n```\n\n## Why Not Add An Authentication While You Are At It ?\n\nYou need a just few things adding an authentication.\n\n### You Must Create The User:\n\n```cs\nusing System.ComponentModel.DataAnnotations.Schema;\nusing Garcia.Domain;\nusing Garcia.Domain.Identity;\n\npublic class User : Entity\u003clong\u003e, IUserEntity\u003clong\u003e // User must be an entity and implemented from IUserEntity\u003cTKey\u003e\n{\n    public string Username { get; set; }\n    public string Password { get; set; }\n\n    [NotMapped]\n    public List\u003cstring\u003e Roles { get; set; } = new List\u003cstring\u003e(); \n    // The role field comes from IUserEntity. If you want, you can customize the Context and define it as the owned entity type. \n    // If you are using MongoDB or Cassandra for persistence of the User you don't need [NotMapped] attribute.\n}\n```\n### Create UserDto:\n\n```cs\nusing Garcia.Application.Contracts.Identity;\n\npublic class UserDto : IUser\n{\n    public string Id { get; set; }\n    public string Username { get; set; }\n    public List\u003cstring\u003e Roles { get; set; } = new List\u003cstring\u003e();\n}\n```\n\n### Create AuthenticationController:\n\n```cs\nusing Garcia.Application.Identity.Services;\nusing Garcia.Infrastructure.Api.Controllers;\nusing Microsoft.AspNetCore.Mvc;\n\nnamespace QuickStart.Controllers;\n\n[ApiController]\npublic class AuthenticationController : BaseAuthController\u003cUser, UserDto\u003e\n/* BaseAuthController has also 2 generic parameters like a BaseController. \nThese are a User BaseType is Entity\u003clong\u003e and implemented from IUserEntity\u003clong\u003e, \na UserDto implemented from IUser. */\n{\n    public AuthenticationController(IAuthenticationService\u003cUser, UserDto, long\u003e service) : base(service)\n    {\n    }\n}\n```\n\n\n### Register Services To The Program:\n\nAdd the following statement to the Program.cs:\n\n```cs\nbuilder.Services.AddAuthenticationService\u003cUser, UserDto\u003e(builder.Configuration);\n/* AuthenticationService also has a 2 generic parameters like BaseService. \nThese are a User BaseType is Entity\u003clong\u003e and implemented from IUserEntity\u003clong\u003e and a UserDto implemented from IUser.*/\n```\n\n### Add JwtIssuerOptions To appsettings.json For AuthenticationService:\n\nAuthenticationService uses JwtService for generate and verify a new jwt. JwtService needs JwtIssuerOptions to do this jobs.\n\n```json\n  \"JwtIssuerOptions\": {\n    \"Issuer\": \"garcia\",\n    \"Audience\": \"garcia\",\n    \"SecretKey\": \"2c47231f-9da0-45a6-b6ea-4cf89281b63d\",\n    \"ValidFor\": 7200\n  }\n```\n\n### Protect Your Apis: \n\nTo protect your controller add Authorize attribute top of the controller.\n\n```cs\nusing Garcia.Application.Services;\nusing Garcia.Infrastructure.Api.Controllers;\nusing Microsoft.AspNetCore.Authorization;\nusing Microsoft.AspNetCore.Mvc;\n\nnamespace QuickStart.Controllers;\n\n[ApiController]\n[Authorize(AuthenticationSchemes = \"Bearer\")]\npublic class SampleController : BaseController\u003cSample, SampleDto\u003e\n{\n    public SampleController(IBaseService\u003cSample, SampleDto, long\u003e services) : base(services)\n    {\n    }\n}\n```\n\n### Configure Your Swagger:\n\n```cs\nusing Garcia.Infrastructure.Api;\n\n// Other Configurations...\n\nbuilder.Services.AddSwaggerWithAuthorization();\n```\n\n### To Run Your Application:\n\n```ps\n\u003e dotnet run\n```\n\n\u003ci\u003eYou can find complete project in \u003ca href = \"https://github.com/garcia-tech/garcia/tree/dev/samples/QuickStart\"\u003ehere.\u003c/a\u003e\u003c/i\u003e\n\n\u003cb\u003eAnd thats it. Many more different features are waiting for you in here. Welcome to Garcia.\u003c/b\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgarcia-tech%2Fgarcia","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgarcia-tech%2Fgarcia","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgarcia-tech%2Fgarcia/lists"}