This project is a modular monolith template built with ASP.NET Core, aimed at large-scale applications that may later evolve into a microservices architecture.
src/
├── API/ # AppHost - Entry point, API Gateway, composition root
├── Modules/ # Feature-based modules
│ ├── Users/
│ │ ├── API/
│ │ ├── Application/
│ │ ├── Domain/
│ │ └── Infrastructure/
│ └── ... # Other modules (e.g., Orders, Billing)
└── Shared/ # Shared framework: config, base abstractions, middleware, etc.
API/AppHost – acts as the API Gateway and composition root for the application. Contains Program.cs entry application file.
Modules – isolated business features organized using Clean Architecture, each with its own API, Application, Infrastructure, and Domain layers.
Shared/SharedFramework – contains reusable components, cross-cutting concerns, and configuration logic shared across all modules.
The Users.Auth module handles user identity and access management. It supports:
- User registration with email confirmation
- Authentication using JWT tokens
- Two-factor authentication (2FA) with a temporary short-lived JWT and numeric code
- Enabling/disabling 2FA through user settings
POST /api/users/auth/login– Standard email/password loginPOST /api/users/auth/login/two-factor– Verifies 2FA code after loginPOST /api/users/auth/register– Registers a new userPOST /api/users/auth/confirm-email– Confirms user emailGET /api/users/settings/two-factor– Retrieves 2FA statusPUT /api/users/settings/two-factor– Enables or disables 2FA
This module is fully isolated and designed for clean integration with other application modules.
To run the project locally or deploy it in a containerized environment:
- Create or edit the .env file in src/API/AppHost/ and set the required environment variables.
JWT_KEY=
TWO_FA_KEY=
SMTP_USER_ADDRESS=
SMTP_USER_PASSWORD=
- Start the application. Spin up all services via Docker:
docker-compose up --build
This will launch the API Gateway, modules, database, and other required services defined in docker-compose.yml.
ASP.NET Core
Entity Framework Core
Postgre SQL
JWT Bearer
SMTP / MailKit
Docker and Docker Compose
Swagger