How alberth527/commonapi works
Main Components
A. API Layer
• Controllers (Entry Points)
• AuthController (Authentication/Authorization)
• WeatherForecastController (Sample/Demo functionality)
• BaseController (Common controller functionality)
B. Middleware Layer
• ErrorHandlerMiddleware (Global error handling)
• JWT Authentication (JwtHelper)
C. Data Access Layer
• DbContext (Database connection handling)
• SqlBuilder & SqlQuery (SQL generation and execution)
• BaseRepository & IRepository (Repository pattern implementation)
D. Model Layer
• Entity folder (Domain models)
• APIResult (Standardized response format)
• WeatherForecast (Sample entity)
E. Configuration
• MyAppConfig (Application configuration)
• NLog (Logging infrastructure)
┌─────────────────────────────────────────────────────────┐
• Client Requests │
• ┬───────────────────────────────────────┘
• ↓
┌─────────────────────────────────────────────────────────┐
• Middleware Layer │
• ┌─────────────────┐ ┌────────────────────┐ │
• Error Handler │ │ JWT Authentication │ │
• ┘ └────────────────────┘ │
• ┬───────────────────────────────────────┘
• ↓
┌─────────────────────────────────────────────────────────┐
• Controllers │
• ┌─────────────┐ ┌──────────────┐ ┌──────────────┐ │
• Auth │ │ Weather │ │ Base │ │
• ┘ └──────────────┘ └──────────────┘ │
• ┬───────────────────────────────────────┘
• ↓
┌─────────────────────────────────────────────────────────┐
• Repository Layer │
• ┌─────────────────┐ ┌────────────────────┐ │
• BaseRepository │ │ IRepository │ │
• ┘ └────────────────────┘ │
• ┬───────────────────────────────────────┘
• ↓
┌─────────────────────────────────────────────────────────┐
• Data Access Layer │
• ┌─────────────────┐ ┌────────────────────┐ │
• DbContext │ │ SQL Builders │ │
• ┘ └────────────────────┘ │
• ┘
Important Relationships to Highlight
• How ErrorHandlerMiddleware intercepts all requests
• Demonstrate the inheritance relationship between BaseController and other controllers
• Implementation of IRepository by BaseRepository
• How DbContext is used by the Repository layer
• How JwtHelper integrates with the Auth flow
Technical Stack Indicators
• .NET Core Web API
• JWT Authentication
• SQL Database (implied by SqlBuilder and DbContext)
• NLog logging framework
Remember to:
• Use consistent styling
• Brief descriptions for key components
• Both synchronous and asynchronous flows where applicable
This architecture represents a typical layered application with clear separation of concerns, following common enterprise patterns like Repository Pattern and Middleware Pipeline.