How calabonga/microservice-template works
• An Identity Module Template (which leverages OpenIddict for OAuth2.0 authentication and supports both cookie and bearer schemes)
• A Module Template (designed to act as a “business” or application service without built‐in OpenIddict)
There’s also a sample client application (a Blazor Web App under AuthClientSamples) intended to demonstrate how to consume the identity service for authentication. Additionally, note that several folder structures are repeated for two versions of the ASP.NET Core platform (v8.0 and v9.0), and this is done to support multiple target environments.
Main Components
• Identity Service Microservice – Show the IdentityModule template with its layered structure. Inside this service, indicate:
– Domain Layer (Domain models, Base classes, interfaces like IAuditable, IHaveId)
– Infrastructure Layer (DB Contexts, Database Initialization, ApplicationUser, ApplicationRole, etc.)
– Web/API Layer (Endpoints for authorization, token, profiles; hosted services like OpenIddictWorker; messaging endpoints)
– Definitions – Group the “Definitions” folders that include components for error handling, dependency injection (ContainerDefinition), ETag generation, mediator configuration, and OpenIddict pieces.
• Module/Business Microservice – Similar to the Identity module, show it with it’s own Domain, Infrastructure, Web/API, and Definitions layers. Note that it handles endpoints for EventItem and Profile messages.
• Client Applications – Include the “AuthClientSamples/BlazorWebApp” sample which demonstrates integration with the Identity Module for authentication.
• Shared/External Dependencies – Represent common libraries (for example, the shared nuget packages such as Calabonga.Results and UnitOfWork, OpenIddict, Mediatr, AutoMapper, and Swagger/OpenAPI generators). Indicate external systems such as the database and possibly external authorization providers that might be used if extended.
Relationships and Interactions
• That the Identity Microservice provides authentication, authorization, and token issuance functionality, which is consumed by both the Module Microservice (for cross-service security) and the client (via OAuth2.0 flows).
• How the Module Microservice exposes its API endpoints (using mediator patterns and error handling middleware) and uses a similar architectural layering.
Architectural Patterns and Design Principles
• The project clearly follows a layered architecture (Domain, Infrastructure, API/Web, and Application/Services) with a mix of Clean/Vertical Slice patterns.
• Use of Mediatr for command/queries – illustrate how API endpoints call into the mediator layer that then interacts with business logic.
• You might also illustrate key design components such as Dependency Injection (using ContainerDefinition classes), error handling (via middleware and OperationResult or FluentValidation), and the use of hosted services.
Relevant Technologies, Frameworks, and Libraries
• ASP.NET Core (with different target versions, v8.0, v9.0, etc.)
• OpenIddict (integrated into the Identity Module for secure token-based authentication)
• Mediatr (for internal messaging and encapsulation of business logic)
• Swagger/OpenAPI (to generate interactive API documentation)
• Entity Framework (with custom DBContext implementations in the Infrastructure layer)
• NuGet packages such as Calabonga.Results, UnitOfWork and others that support cross-cutting concerns.