How satrapu/aspnet-core-logging works
Project type and purpose
• This is a full-stack (server-side) ASP.NET Core 9 Web API for managing “Todo” items, instrumented with structured logging (Serilog/Seq) and distributed tracing (OpenTelemetry/Jaeger), secured by JWT, and backed by PostgreSQL. It’s organized as a multi-project .NET solution that demonstrates best practices around layering, dependency injection, EF Core migrations, Docker Compose, and CI/CD pipelines (Azure Pipelines).
File structure
• Top-level: solution files (Todo.WebApi.sln), build scripts (Build/), Docker Compose (docker-compose.yml), CI templates.
• Sources/: six class-library projects plus the Web API:
• Todo.WebApi: presentation layer (Controllers, Middleware, Startup, appsettings)
• Todo.Services: domain services (business logic, JWT service)
• Todo.ApplicationFlows: orchestrators for application flows (CRUD flows, JWT flow)
• Todo.Persistence: EF Core DbContext, entities, migrations
• Todo.Telemetry: HTTP and EF Core instrumentation, Serilog and OpenTelemetry configuration
• Todo.Commons: shared constants, startup helpers, diagnostics
• Tests/: acceptance, integration, architecture and unit tests using Docker Compose for test DBs.
README for additional insights
• Confirms use of PostgreSQL, pgAdmin, Seq, Jaeger via Docker Compose.
• Emphasizes JSON Web Token authentication with a simplified generation flow.
• Outlines local‐dev setup, EF Core migrations, and telemetry UIs.
a. Main components
• External Clients (e.g., Web/Mobile UI, Postman)
• Todo.WebApi (ASP.NET Core HTTP pipeline)
• Todo.Services (business-level services)
• Todo.ApplicationFlows (flow orchestrators)
• Todo.Persistence (EF Core data-access)
• PostgreSQL database
• Telemetry: Serilog → Seq; OpenTelemetry → Jaeger
• Infrastructure: Docker Compose network; Azure Pipelines
b. Relationships and interactions
• Clients → HTTP request → WebApi Controllers
• Controllers → invoke Services via DI
• Services → orchestrate flows in ApplicationFlows
• ApplicationFlows → call Persistence (DbContext)
• DbContext → SQL queries → PostgreSQL
• WebApi & Persistence emit logs/traces → Telemetry library
• Telemetry library exports logs to Seq and traces to Jaeger
• Build & deployment via Azure Pipelines, Docker Compose hosts DB, pgAdmin, Seq, Jaeger
c. Architectural patterns & design principles
• Layered architecture (Presentation → Service → ApplicationFlow → Data)
• Dependency Injection across all layers
• Single-responsibility modules (Services vs Flows vs Persistence)
• EF Core Code-First migrations
• Middleware for exception handling, authorization, telemetry
d. Key technologies, frameworks, libraries
• ASP.NET Core 9, Controllers, Middleware
• Microsoft DI, Options pattern
• EF Core (Npgsql provider), Code-First Migrations
• Serilog (structured logging)
• OpenTelemetry (.NET SDK)
• Docker Compose, PostgreSQL, pgAdmin, Seq, Jaeger
• Azure DevOps Pipelines