# melvinp473/simple-user-management-api architecture

> Architecture diagram of the GitHub repository melvinp473/simple-user-management-api, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/melvinp473/simple-user-management-api
- Repository: https://github.com/melvinp473/simple-user-management-api

## Overview

This is a small ASP.NET Core user-management API. An HTTP client reaches the configured middleware pipeline, then controller endpoints that validate and normalize user data and use a repository for CRUD and email-uniqueness checks. The repository stores users in memory. Program.cs also exposes a health response at `/` and configures Swagger in development. Middleware ordering and registrations are shown; the README gives no further product details.

Main entry points: [`Program.cs`](https://github.com/melvinp473/simple-user-management-api/blob/main/Program.cs) (ASP.NET host), [`Controllers/UserController.cs`](https://github.com/melvinp473/simple-user-management-api/blob/main/Controllers/UserController.cs) (User endpoints), [`Repositories/InMemoryUserRepository.cs`](https://github.com/melvinp473/simple-user-management-api/blob/main/Repositories/InMemoryUserRepository.cs) (In-memory repository), [`Middleware/ErrorHandlingMiddleware.cs`](https://github.com/melvinp473/simple-user-management-api/blob/main/Middleware/ErrorHandlingMiddleware.cs) (Error handling)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["API runtime"]
  node_host["ASP.NET host<br/>[Program.cs]"]
  node_errors["Error handling"]
  node_auth["Token authentication"]
  node_logging["Request logging"]
  node_endpoints["Health and Swagger<br/>[Program.cs]"]
end

subgraph group_domain["User management"]
  node_controller["User endpoints<br/>[UserController.cs]"]
  node_user["User model<br/>[User.cs]"]
end

subgraph group_storage["User storage"]
  node_contract["Repository contract<br/>[IUserRepository.cs]"]
  node_repository[("In-memory repository")]
end

node_client(("HTTP client"))

node_client -->|"sends requests"| node_host
node_host -->|"configures first"| node_errors
node_errors -->|"passes request"| node_auth
node_auth -->|"passes request"| node_logging
node_logging -->|"passes request"| node_controller
node_host -->|"maps controllers"| node_controller
node_host -->|"maps and configures"| node_endpoints
node_controller -->|"calls CRUD methods"| node_contract
node_controller -->|"validates and returns"| node_user
node_repository -->|"implements"| node_contract
node_repository -->|"stores users"| node_user
node_host -->|"registers service"| node_repository

click node_host "https://github.com/melvinp473/simple-user-management-api/blob/main/Program.cs"
click node_errors "https://github.com/melvinp473/simple-user-management-api/blob/main/Middleware/ErrorHandlingMiddleware.cs"
click node_auth "https://github.com/melvinp473/simple-user-management-api/blob/main/Middleware/TokenAuthenticationMiddleware.cs"
click node_logging "https://github.com/melvinp473/simple-user-management-api/blob/main/Middleware/RequestResponseLoggingMiddleware.cs"
click node_endpoints "https://github.com/melvinp473/simple-user-management-api/blob/main/Program.cs"
click node_controller "https://github.com/melvinp473/simple-user-management-api/blob/main/Controllers/UserController.cs"
click node_user "https://github.com/melvinp473/simple-user-management-api/blob/main/Models/User.cs"
click node_contract "https://github.com/melvinp473/simple-user-management-api/blob/main/Repositories/IUserRepository.cs"
click node_repository "https://github.com/melvinp473/simple-user-management-api/blob/main/Repositories/InMemoryUserRepository.cs"

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_host,node_errors,node_auth,node_logging,node_endpoints,node_client toneBlue
class node_controller,node_user toneAmber
class node_contract,node_repository toneMint
```

## Components

### API runtime

- [ASP.NET host](https://github.com/melvinp473/simple-user-management-api/blob/main/Program.cs): `Program.cs`
- [Error handling](https://github.com/melvinp473/simple-user-management-api/blob/main/Middleware/ErrorHandlingMiddleware.cs): `Middleware/ErrorHandlingMiddleware.cs`
- [Token authentication](https://github.com/melvinp473/simple-user-management-api/blob/main/Middleware/TokenAuthenticationMiddleware.cs): `Middleware/TokenAuthenticationMiddleware.cs`
- [Request logging](https://github.com/melvinp473/simple-user-management-api/blob/main/Middleware/RequestResponseLoggingMiddleware.cs): `Middleware/RequestResponseLoggingMiddleware.cs`
- [Health and Swagger](https://github.com/melvinp473/simple-user-management-api/blob/main/Program.cs): `Program.cs`

### User management

- [User endpoints](https://github.com/melvinp473/simple-user-management-api/blob/main/Controllers/UserController.cs): `Controllers/UserController.cs`
- [User model](https://github.com/melvinp473/simple-user-management-api/blob/main/Models/User.cs): `Models/User.cs`

### User storage

- [Repository contract](https://github.com/melvinp473/simple-user-management-api/blob/main/Repositories/IUserRepository.cs): `Repositories/IUserRepository.cs`
- [In-memory repository](https://github.com/melvinp473/simple-user-management-api/blob/main/Repositories/InMemoryUserRepository.cs): `Repositories/InMemoryUserRepository.cs`

### Other components

- **HTTP client**

## Connections

- HTTP client → ASP.NET host: sends requests (evidence: `Program.cs`)
- ASP.NET host → Error handling: configures first (evidence: `Program.cs`)
- Error handling → Token authentication: passes request (evidence: `Program.cs`)
- Token authentication → Request logging: passes request (evidence: `Program.cs`)
- Request logging → User endpoints: passes request
- ASP.NET host → User endpoints: maps controllers (evidence: `Program.cs`)
- ASP.NET host → Health and Swagger: maps and configures (evidence: `Program.cs`)
- User endpoints → Repository contract: calls CRUD methods (evidence: `Controllers/UserController.cs`)
- User endpoints → User model: validates and returns (evidence: `Controllers/UserController.cs`)
- In-memory repository → Repository contract: implements (evidence: `Repositories/InMemoryUserRepository.cs`)
- In-memory repository → User model: stores users (evidence: `Repositories/InMemoryUserRepository.cs`)
- ASP.NET host → In-memory repository: registers service (evidence: `Program.cs`)
