# anthueeccel/webstore architecture

> Architecture diagram of the GitHub repository anthueeccel/webstore, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-06-22). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/anthueeccel/webstore
- Repository: https://github.com/anthueeccel/webstore

## Overview

1. **Repository shape**
   - This is a multi-project .NET solution centered on `WebStore.API`, with supporting `WebStore.Domain`, `WebStore.Infrastructure`, and `WebStore.Tests`.
   - The architecture is intentionally split into a thin API layer, a domain model layer, a persistence/infrastructure layer, and a separate test suite.

2. **API style and runtime**
   - The API is an ASP.NET Core **Minimal API** running on **.NET 10**.
   - `Program.cs` is the composition root: it wires dependency injection, registers endpoints, and boots the app.
   - There are no MVC controllers; routing is organized through feature-specific endpoint classes.

3. **Vertical-slice feature structure**
   - The API is organized by business capability, not by technical layer.
   - Main feature groups are `WebStore`, `Product`, `Brand`, and `Category`.
   - Each operation has its own folder containing the endpoint, handler, request/response models, and validator where needed.
   - This means a single slice usually spans the full request path: HTTP endpoint → validation → handler → data access → response.

4. **Command/query boundaries**
   - The codebase follows **CQRS-style separation** in practice.
   - Write operations exist for `Create`, `Update`, and `Delete` flows, especially for `WebStore` and `Product`.
   - Read operations exist for `GetById`, `GetAll`, and filtered queries such as `GetProductsByWebStore`.
   - This keeps reads and mutations isolated at the handler level.

5. **Domain model**
   - `WebStore.Domain` contains the core entities: `WebStore`, `Product`, `Brand`, `Category`, `Address`, plus `BaseEntity`.
   - These are the business objects that map to the database and define the shape of the application’s data.
   - The presence of `BaseEntity` suggests shared identity/auditing behavior across entities.

6. **Data contracts and validation**
   - `WebStore.API/Shared/Dtos` holds DTOs used to move data between the API and clients without exposing domain entities directly.
   - `Shared/Validators` contains reusable validation logic, including an `AddressValidator`.
   - Feature-specific validators live beside their feature handlers, so input rules are localized to the slice that owns them.
   - This boundary matters: endpoints speak in request/response models, while handlers work with domain and persistence concerns.

7. **Persistence and infrastructure**
   - `WebStore.Infrastructure` contains the database implementation: `WebStoreDbContext`, EF Core migrations, and seeders.
   - The infrastructure project is the bridge from application logic to the database.
   - `IWebStoreSeeder` and `WebStoreSeeder` indicate initial data population is part of the infrastructure story.
   - `ServiceCollectionExtensions` in both API and Infrastructure suggests DI wiring is split by responsibility.

8. **Database lifecycle**
   - EF Core migrations are checked in, so schema evolution is managed in code.
   - The repo includes an initial migration and a model snapshot, which means the database schema is versioned alongside the application.
   - The README references PostgreSQL/Neon for deployment, while the test tooling references SQL Server containers; architecturally, the repository is built around EF Core with environment-specific database configuration.

9. **Testing strategy**
   - Unit tests are organized by feature and target the handlers directly, which validates business logic without going through HTTP.
   - Integration tests live separately and exercise the API/database boundary, including endpoint tests and database connection checks.
   - The test layout mirrors the production feature layout, which makes it easy to trace a failing test back to a specific slice.

10. **CI/CD and deployment**
   - `.github/workflows/dotnet.yml` defines a GitHub Actions pipeline for build, test, artifact creation, and deployment.
   - The pipeline runs on pull requests to `main` and includes multiple test stages, including integration/E2E-style checks.
   - The deployment target is **Azure App Service**, so the production boundary is externalized from the application code.
   - This repo treats CI/CD as part of the architecture, not just a build script.

11. **External tooling and contract-first workflow**
   - The README describes a **spec-driven** workflow using **Bruno** collections as the API contract.
   - That means endpoint shape is validated before and during implementation, making the HTTP contract an important architectural boundary.
   - Bruno is therefore not just a test tool; it acts as a specification artifact for the API surface.

12. **End-to-end request flow**
   - A typical request comes from a client or Bruno test into a feature endpoint.
   - The endpoint binds request data, validates it, and passes control to the handler.
   - The handler uses infrastructure services such as `DbContext` and returns a feature-specific response DTO.
   - The response exits back through the Minimal API pipeline, with the domain model remaining internal to the service.

Main entry points: [`WebStore.Infrastructure/Persistence/WebStoreDbContext.cs`](https://github.com/anthueeccel/webstore/blob/main/WebStore.Infrastructure/Persistence/WebStoreDbContext.cs) (DbContext), [`WebStore.API/Program.cs`](https://github.com/anthueeccel/webstore/blob/main/WebStore.API/Program.cs) (Program), [`WebStore.Tests/Features`](https://github.com/anthueeccel/webstore/blob/main/WebStore.Tests/Features) (Handler tests), [`WebStore.API/Features/WebStore`](https://github.com/anthueeccel/webstore/blob/main/WebStore.API/Features/WebStore) (WebStore)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API"]
  node_program["Program<br/>composition root<br/>[Program.cs]"]
  node_api_di["API DI<br/>service wiring"]
  node_api_dtos["DTOs<br/>contracts<br/>[Dtos]"]
  node_api_validators["Validators<br/>validation<br/>[Validators]"]
  node_webstore_slice["WebStore<br/>feature slice<br/>[WebStore]"]
  node_product_slice["Product<br/>feature slice<br/>[Product]"]
  node_brand_slice["Brand<br/>feature slice<br/>[Brand]"]
  node_category_slice["Category<br/>feature slice<br/>[Category]"]
end

subgraph group_domain["Domain"]
  node_domain_entities[("Entities<br/>domain model<br/>[Entities]")]
end

subgraph group_infra["Infrastructure"]
  node_dbcontext[("DbContext<br/>ef core context")]
  node_migrations["Migrations<br/>schema history<br/>[Migrations]"]
  node_seeder["Seeder<br/>bootstrap data<br/>[WebStoreSeeder.cs]"]
end

subgraph group_tests["Tests"]
  node_test_handlers["Handler tests<br/>unit tests<br/>[Features]"]
  node_test_integration["Integration tests<br/>[IntegrationTests]"]
end

subgraph group_delivery["Delivery"]
  node_workflow["CI pipeline<br/>github actions<br/>[dotnet.yml]"]
end

node_program -->|"loads services"| node_api_di
node_program -->|"maps endpoints"| node_webstore_slice
node_program -->|"maps endpoints"| node_product_slice
node_program -->|"maps endpoints"| node_brand_slice
node_program -->|"maps endpoints"| node_category_slice
node_webstore_slice -->|"returns DTOs"| node_api_dtos
node_product_slice -->|"returns DTOs"| node_api_dtos
node_brand_slice -->|"returns DTOs"| node_api_dtos
node_category_slice -->|"returns DTOs"| node_api_dtos
node_webstore_slice -->|"validates input"| node_api_validators
node_product_slice -->|"validates input"| node_api_validators
node_brand_slice -->|"validates input"| node_api_validators
node_category_slice -->|"validates input"| node_api_validators
node_webstore_slice -->|"queries writes"| node_dbcontext
node_product_slice -->|"queries writes"| node_dbcontext
node_brand_slice -->|"queries"| node_dbcontext
node_category_slice -->|"queries"| node_dbcontext
node_dbcontext -->|"maps entities"| node_domain_entities
node_dbcontext -->|"evolves schema"| node_migrations
node_seeder -->|"seeds data"| node_dbcontext
node_test_handlers -.->|"covers"| node_webstore_slice
node_test_handlers -.->|"covers"| node_product_slice
node_test_handlers -.->|"covers"| node_brand_slice
node_test_handlers -.->|"covers"| node_category_slice
node_test_integration -.->|"boots through"| node_program
node_test_integration -.->|"verifies db"| node_dbcontext
node_workflow -->|"runs"| node_test_handlers
node_workflow -->|"runs"| node_test_integration
node_workflow -->|"builds"| node_program

click node_program "https://github.com/anthueeccel/webstore/blob/main/WebStore.API/Program.cs"
click node_api_di "https://github.com/anthueeccel/webstore/blob/main/WebStore.API/Shared/Extensions/ServiceCollectionExtensions.cs"
click node_api_dtos "https://github.com/anthueeccel/webstore/blob/main/WebStore.API/Shared/Dtos"
click node_api_validators "https://github.com/anthueeccel/webstore/blob/main/WebStore.API/Shared/Validators"
click node_webstore_slice "https://github.com/anthueeccel/webstore/blob/main/WebStore.API/Features/WebStore"
click node_product_slice "https://github.com/anthueeccel/webstore/blob/main/WebStore.API/Features/Product"
click node_brand_slice "https://github.com/anthueeccel/webstore/blob/main/WebStore.API/Features/Brand"
click node_category_slice "https://github.com/anthueeccel/webstore/blob/main/WebStore.API/Features/Category"
click node_domain_entities "https://github.com/anthueeccel/webstore/blob/main/WebStore.Domain/Entities"
click node_dbcontext "https://github.com/anthueeccel/webstore/blob/main/WebStore.Infrastructure/Persistence/WebStoreDbContext.cs"
click node_migrations "https://github.com/anthueeccel/webstore/blob/main/WebStore.Infrastructure/Migrations"
click node_seeder "https://github.com/anthueeccel/webstore/blob/main/WebStore.Infrastructure/Seeders/WebStoreSeeder.cs"
click node_test_handlers "https://github.com/anthueeccel/webstore/blob/main/WebStore.Tests/Features"
click node_test_integration "https://github.com/anthueeccel/webstore/blob/main/WebStore.Tests/IntegrationTests"
click node_workflow "https://github.com/anthueeccel/webstore/blob/main/.github/workflows/dotnet.yml"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_program,node_api_di,node_api_dtos,node_api_validators,node_webstore_slice,node_product_slice,node_brand_slice,node_category_slice toneBlue
class node_domain_entities toneAmber
class node_dbcontext,node_migrations,node_seeder toneMint
class node_test_handlers,node_test_integration toneRose
class node_workflow toneIndigo
```

## Components

### API

Minimal API composition root, shared contracts, and feature slices

- [Program](https://github.com/anthueeccel/webstore/blob/main/WebStore.API/Program.cs): composition root · Bootstraps the Minimal API, DI, and endpoint wiring · `WebStore.API/Program.cs`
- [API DI](https://github.com/anthueeccel/webstore/blob/main/WebStore.API/Shared/Extensions/ServiceCollectionExtensions.cs): service wiring · Registers application services and shared API dependencies · `WebStore.API/Shared/Extensions/ServiceCollectionExtensions.cs`
- [DTOs](https://github.com/anthueeccel/webstore/blob/main/WebStore.API/Shared/Dtos): contracts · Shared request/response data contracts for the API surface · `WebStore.API/Shared/Dtos`
- [Validators](https://github.com/anthueeccel/webstore/blob/main/WebStore.API/Shared/Validators): validation · Reusable validation rules shared across feature slices · `WebStore.API/Shared/Validators`
- [WebStore](https://github.com/anthueeccel/webstore/blob/main/WebStore.API/Features/WebStore): feature slice · Create, read, update, and delete operations for stores · `WebStore.API/Features/WebStore`
- [Product](https://github.com/anthueeccel/webstore/blob/main/WebStore.API/Features/Product): feature slice · Product commands and queries, including store-scoped reads · `WebStore.API/Features/Product`
- [Brand](https://github.com/anthueeccel/webstore/blob/main/WebStore.API/Features/Brand): feature slice · Brand read endpoints · `WebStore.API/Features/Brand`
- [Category](https://github.com/anthueeccel/webstore/blob/main/WebStore.API/Features/Category): feature slice · Category read endpoints · `WebStore.API/Features/Category`

### Domain

Core business entities

- [Entities](https://github.com/anthueeccel/webstore/blob/main/WebStore.Domain/Entities): domain model · WebStore, Product, Brand, Category, Address, and shared base entity · `WebStore.Domain/Entities`

### Infrastructure

EF Core persistence, migrations, and seeding

- [DbContext](https://github.com/anthueeccel/webstore/blob/main/WebStore.Infrastructure/Persistence/WebStoreDbContext.cs): ef core context · Database session and model configuration · `WebStore.Infrastructure/Persistence/WebStoreDbContext.cs`
- [Migrations](https://github.com/anthueeccel/webstore/blob/main/WebStore.Infrastructure/Migrations): schema history · Versioned EF Core schema evolution · `WebStore.Infrastructure/Migrations`
- [Seeder](https://github.com/anthueeccel/webstore/blob/main/WebStore.Infrastructure/Seeders/WebStoreSeeder.cs): bootstrap data · Initial data population for the database · `WebStore.Infrastructure/Seeders/WebStoreSeeder.cs`

### Tests

Handler-level and integration test suites

- [Handler tests](https://github.com/anthueeccel/webstore/blob/main/WebStore.Tests/Features): unit tests · Feature-level tests that exercise handlers directly · `WebStore.Tests/Features`
- [Integration tests](https://github.com/anthueeccel/webstore/blob/main/WebStore.Tests/IntegrationTests): integration tests · Endpoint and database boundary checks · `WebStore.Tests/IntegrationTests`

### Delivery

CI/CD and deployment pipeline

- [CI pipeline](https://github.com/anthueeccel/webstore/blob/main/.github/workflows/dotnet.yml): github actions · Build, test, artifact, and deployment workflow · `.github/workflows/dotnet.yml`

## Connections

- Program → API DI: loads services · Composition root wires application and infrastructure services
- Program → WebStore: maps endpoints · Minimal API registration for the WebStore slice
- Program → Product: maps endpoints · Minimal API registration for the Product slice
- Program → Brand: maps endpoints · Minimal API registration for the Brand slice
- Program → Category: maps endpoints · Minimal API registration for the Category slice
- WebStore → DTOs: returns DTOs · Feature responses use shared API contracts
- Product → DTOs: returns DTOs · Feature responses use shared API contracts
- Brand → DTOs: returns DTOs · Feature responses use shared API contracts
- Category → DTOs: returns DTOs · Feature responses use shared API contracts
- WebStore → Validators: validates input · Feature requests are validated before handler execution
- Product → Validators: validates input · Feature requests are validated before handler execution
- Brand → Validators: validates input · Feature requests are validated before handler execution
- Category → Validators: validates input · Feature requests are validated before handler execution
- WebStore → DbContext: queries writes · Handlers access persistence through EF Core
- Product → DbContext: queries writes · Handlers access persistence through EF Core
- Brand → DbContext: queries · Read handlers query the database through EF Core
- Category → DbContext: queries · Read handlers query the database through EF Core
- DbContext → Entities: maps entities · EF Core model is built from the domain entities
- DbContext → Migrations: evolves schema · Schema changes are tracked in checked-in migrations
- Seeder → DbContext: seeds data · Seeder populates the database through the context
- Handler tests → WebStore: covers · Handler tests mirror the WebStore feature slice
- Handler tests → Product: covers · Handler tests mirror the Product feature slice
- Handler tests → Brand: covers · Handler tests mirror the Brand feature slice
- Handler tests → Category: covers · Handler tests mirror the Category feature slice
- Integration tests → Program: boots through · Integration tests exercise the API entry point
- Integration tests → DbContext: verifies db · Integration tests check database connectivity and behavior
- CI pipeline → Handler tests: runs · CI executes unit tests as part of validation
- CI pipeline → Integration tests: runs · CI executes integration checks as part of validation
- CI pipeline → Program: builds · Pipeline builds the API project for deployment
