Appearance
Backend Overview
The MedRegia backend is a .NET 10 modular monolith — a single ASP.NET Core process that contains multiple clearly-bounded modules, each responsible for a distinct domain.
Project Structure
backend/
├── MedRegia.API/ ← Main API project
│ ├── Modules/ ← One folder per bounded context
│ │ ├── Identity/
│ │ ├── VendorManagement/
│ │ ├── Settings/
│ │ ├── Dashboard/
│ │ ├── Reports/
│ │ ├── Onboarding/
│ │ └── UserProfile/
│ ├── Infrastructure/
│ │ ├── DependencyInjection.cs
│ │ └── Persistence/
│ │ ├── DbConnectionFactory.cs
│ │ └── EnumTypeHandlers.cs
│ ├── Filters/
│ │ ├── RequirePermissionAttribute.cs
│ │ └── PermissionAuthorizationFilter.cs
│ ├── Shared/
│ │ ├── Result/PagedResult.cs
│ │ ├── Constants/
│ │ ├── Extensions/
│ │ ├── Helpers/
│ │ └── Services/
│ └── Program.cs
├── MedRegia.API.Tests/ ← xUnit unit tests
└── MedRegia.Migrations/ ← DbUp schema migrationsKey Technologies
| Package | Purpose |
|---|---|
| Dapper | Micro-ORM for all SQL queries |
| MySqlConnector | ADO.NET MySQL driver |
| AutoMapper | Domain → DTO mapping |
| BCrypt.Net-Next | Password hashing |
| Microsoft.AspNetCore.Authentication.JwtBearer | JWT validation |
| Scalar.AspNetCore | OpenAPI UI at /scalar/v1 |
| DbUp | Database migration runner |
| ClosedXML | Excel report generation |
| xUnit + Moq | Unit testing |
Startup Sequence (Program.cs)
- Dapper global config:
MatchNamesWithUnderscores = true+ enum type handlers - Controllers registered with camelCase JSON policy
AddInfrastructure()— registersIDbConnectionFactoryAddModules()— registers all repositories and services- JWT authentication configured from
appsettings.json - AutoMapper scans all
Profileclasses in the assembly - CORS
AllowAllpolicy (dev) / restrict in production - OpenAPI / Scalar registered
- Middleware pipeline:
UseCors → UseAuthentication → UseAuthorization → MapControllers