# prodip-shadow/e-commerce-web-api architecture

> Architecture diagram of the GitHub repository prodip-shadow/e-commerce-web-api, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-08-17). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/prodip-shadow/e-commerce-web-api
- Repository: https://github.com/prodip-shadow/e-commerce-web-api

## Overview

#### Purpose and Entry Point
This is a minimal ASP.NET Core e-commerce API focused on category management. The application starts in `Program.cs`, which configures the host, service container, middleware pipeline, and controller routing. `E_commerce.csproj` defines the .NET project and package/runtime dependencies.

#### HTTP API Layer
`Controllers/CategoryController.cs` is the primary HTTP boundary. It receives category requests, maps request data into application/domain representations, and returns API responses. The repository currently exposes category functionality rather than a complete storefront, checkout, or product catalog system.

#### Category Domain Model
`Models/Category.cs` defines the central business entity: a category and its persisted or returned shape. It is the shared model at the boundary between controller behavior and any configured persistence mechanism.

#### Request Contracts
Category write operations use dedicated DTOs rather than binding clients directly to the domain model:
- `DTOs/CategoryCreateDto.cs` defines the accepted payload for creating categories.
- `DTOs/CategoryUpdateDto.cs` defines the accepted payload for modifying categories.

This separates externally writable fields from the `Category` entity and allows create/update contracts to evolve independently.

#### Primary Flow
1. A client calls a category endpoint handled by `Controllers/CategoryController.cs`.
2. ASP.NET Core model binding deserializes request JSON into `CategoryCreateDto` or `CategoryUpdateDto`.
3. Controller logic validates/maps input and creates or updates `Models/Category.cs` instances.
4. The controller produces an HTTP response, typically serializing category data back to JSON.

The controller is therefore both the current application orchestration layer and the main boundary between HTTP contracts and the domain model.

#### Runtime and Configuration Boundary
The service runs on ASP.NET Core/.NET, with local launch profiles in `Properties/launchSettings.json`. Runtime settings are supplied through:
- `appsettings.json`
- `appsettings.Development.json`

`E_commerce.http` provides request definitions for exercising the API during development. No repository, database context, authentication subsystem, message broker, or external service integration is present in the supplied tree; such concerns are either absent or configured outside the visible source.

Main entry points: [`Controllers/CategoryController.cs`](https://github.com/prodip-shadow/e-commerce-web-api/blob/main/Controllers/CategoryController.cs) (Category controller), [`Program.cs`](https://github.com/prodip-shadow/e-commerce-web-api/blob/main/Program.cs) (Application host), [`E_commerce.csproj`](https://github.com/prodip-shadow/e-commerce-web-api/blob/main/E_commerce.csproj) (E-commerce project), [`appsettings.json`](https://github.com/prodip-shadow/e-commerce-web-api/blob/main/appsettings.json) (Runtime settings)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Runtime"]
  node_project["E-commerce project<br/>.NET project<br/>[E_commerce.csproj]"]
  node_program{{"Application host<br/>ASP.NET Core bootstrap<br/>[Program.cs]"}}
  node_settings["Runtime settings<br/>configuration<br/>[appsettings.json]"]
  node_dev_settings["Development settings<br/>configuration"]
  node_launch_profiles["Launch profiles<br/>local runtime config"]
end

subgraph group_api["Category API"]
  node_category_controller["Category controller<br/>HTTP controller"]
  node_http_requests["API request definitions<br/>development client<br/>[E_commerce.http]"]
end

subgraph group_contracts["Contracts &amp; Domain"]
  node_create_dto["Create category request<br/>write DTO"]
  node_update_dto["Update category request<br/>write DTO"]
  node_category["Category<br/>domain entity<br/>[Category.cs]"]
end

node_project -->|"builds and runs"| node_program
node_settings -.->|"supplies settings"| node_program
node_dev_settings -.->|"overrides in development"| node_program
node_launch_profiles -.->|"launches locally"| node_program
node_program -->|"routes requests"| node_category_controller
node_http_requests -.->|"calls endpoints"| node_category_controller
node_category_controller -->|"binds create JSON"| node_create_dto
node_category_controller -->|"binds update JSON"| node_update_dto
node_category_controller -->|"validates, maps, and returns"| node_category

click node_project "https://github.com/prodip-shadow/e-commerce-web-api/blob/main/E_commerce.csproj"
click node_program "https://github.com/prodip-shadow/e-commerce-web-api/blob/main/Program.cs"
click node_settings "https://github.com/prodip-shadow/e-commerce-web-api/blob/main/appsettings.json"
click node_dev_settings "https://github.com/prodip-shadow/e-commerce-web-api/blob/main/appsettings.Development.json"
click node_launch_profiles "https://github.com/prodip-shadow/e-commerce-web-api/blob/main/Properties/launchSettings.json"
click node_category_controller "https://github.com/prodip-shadow/e-commerce-web-api/blob/main/Controllers/CategoryController.cs"
click node_create_dto "https://github.com/prodip-shadow/e-commerce-web-api/blob/main/DTOs/CategoryCreateDto.cs"
click node_update_dto "https://github.com/prodip-shadow/e-commerce-web-api/blob/main/DTOs/CategoryUpdateDto.cs"
click node_category "https://github.com/prodip-shadow/e-commerce-web-api/blob/main/Models/Category.cs"
click node_http_requests "https://github.com/prodip-shadow/e-commerce-web-api/blob/main/E_commerce.http"

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_project,node_program,node_settings,node_dev_settings,node_launch_profiles toneBlue
class node_category_controller,node_http_requests toneAmber
class node_create_dto,node_update_dto,node_category toneMint
```

## Components

### Runtime

- [E-commerce project](https://github.com/prodip-shadow/e-commerce-web-api/blob/main/E_commerce.csproj): .NET project · Defines project and runtime dependencies. · `E_commerce.csproj`
- [Application host](https://github.com/prodip-shadow/e-commerce-web-api/blob/main/Program.cs): ASP.NET Core bootstrap · Configures services, middleware, and controller routing. · `Program.cs`
- [Runtime settings](https://github.com/prodip-shadow/e-commerce-web-api/blob/main/appsettings.json): configuration · `appsettings.json`
- [Development settings](https://github.com/prodip-shadow/e-commerce-web-api/blob/main/appsettings.Development.json): configuration · `appsettings.Development.json`
- [Launch profiles](https://github.com/prodip-shadow/e-commerce-web-api/blob/main/Properties/launchSettings.json): local runtime config · `Properties/launchSettings.json`

### Category API

- [Category controller](https://github.com/prodip-shadow/e-commerce-web-api/blob/main/Controllers/CategoryController.cs): HTTP controller · Current orchestration layer for category endpoints. · `Controllers/CategoryController.cs`
- [API request definitions](https://github.com/prodip-shadow/e-commerce-web-api/blob/main/E_commerce.http): development client · Exercises API endpoints during development. · `E_commerce.http`

### Contracts & Domain

- [Create category request](https://github.com/prodip-shadow/e-commerce-web-api/blob/main/DTOs/CategoryCreateDto.cs): write DTO · `DTOs/CategoryCreateDto.cs`
- [Update category request](https://github.com/prodip-shadow/e-commerce-web-api/blob/main/DTOs/CategoryUpdateDto.cs): write DTO · `DTOs/CategoryUpdateDto.cs`
- [Category](https://github.com/prodip-shadow/e-commerce-web-api/blob/main/Models/Category.cs): domain entity · Shared persisted and returned category representation. · `Models/Category.cs`

## Connections

- E-commerce project → Application host: builds and runs
- Runtime settings → Application host: supplies settings
- Development settings → Application host: overrides in development
- Launch profiles → Application host: launches locally
- Application host → Category controller: routes requests
- API request definitions → Category controller: calls endpoints
- Category controller → Create category request: binds create JSON
- Category controller → Update category request: binds update JSON
- Category controller → Category: validates, maps, and returns
