How genocs/microservice-template works
Project Type and Purpose
• The project is an API-centric microservice template designed for .NET9.
• It serves as a starting point for building microservices based on Clean Architecture, Domain Driven Design, and includes advanced features such as multi-tenancy (using Finbuckle), CQRS, containerization, and cloud deployments.
• The README clearly indicates that the solution provides components such as Identity management, Catalog operations, Background Jobs, Notifications, and more.
Break Down the Main Components & Layers
• Frontend/API Layer (Web API):
– Represented by the “src/WebApi” folder which contains Controllers (Catalog, Identity, Dashboard, Multitenancy, Personal, etc.), Program.cs, and configuration files.
– Highlight API versioning, Swagger/OpenAPI integration, and end-user entry points.
• Application Layer:
– Located in “src/Core/Application” (inside the template) which encapsulates business logic, CQRS commands and queries, request validators, event handlers, DTOs, and caching.
– Include components like Identity (token service, user/role services) and Catalog (brands, products).
• Domain Layer:
– Located in “src/Core/Domain” which defines the domain models, aggregates, domain events, and contracts.
– Emphasize domain entities like Product, Brand and supporting contracts for Domain Events.
• Infrastructure Layer:
– Found in “src/Infrastructure” – This layer integrates external systems such as databases (with EF Core and Dapper for persistence), caching, file storage, mailing, logging (Serilog integration), and authentication (JWT, Azure AD).
– Show sub-components like persistence (repositories, DB contexts), external service integrations, and middleware (error handling, request/response logging).
• Cross-Cutting Concerns:
– Background jobs (Hangfire, as seen in the Hangfire-related files).
– Multi-tenancy support (configuration and tenant management in both Application and Infrastructure).
– Notifications/SignalR services for pushing real-time events.
– Mapping utilities (Mapster) and API security (permissions, role-based authorization).
Additional Supporting Elements
• Migrators:
– The “src/Migrators” directory, which includes migration projects for multiple databases (MSSQL, MySQL, Oracle, PostgreSQL, SQLite).
– Show data migration as an external process to synchronize the Domain/Infrastructure layer with the database schema.
• DevOps & Containerization:
– GitHub workflows (from “.github/workflows”) and Makefile commands.
– Docker-related files (docker-compose files, Dockerfile in the template) and Terraform configuration (for AWS ECS deployments).
– Indicate a CI/CD pipeline and container orchestration as external services.
• Testing:
– Note the presence of “src/template/tests” which contains unit and integration tests validating infrastructure, caching, localization, persistence, and custom validations.