# muzammil-ali09/web-api architecture

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

- Interactive diagram: https://gitdiagram.com/muzammil-ali09/web-api
- Repository: https://github.com/muzammil-ali09/web-api

## Overview

This is an ASP.NET Core API for authentication, employee management, and API-log retrieval. A client sends requests through the configured application pipeline to controller endpoints: authentication issues and refreshes JWTs, employee endpoints perform paginated CRUD operations, and log queries filter and paginate captured request records. Controllers and the logging middleware access SQL Server directly; the middleware also appends request summaries to a local file. The excerpts show these paths, but do not establish the database schema or deployment topology.

Main entry points: [`Controllers/AuthController.cs`](https://github.com/muzammil-ali09/web-api/blob/main/Controllers/AuthController.cs) (Auth endpoints), [`Program.cs`](https://github.com/muzammil-ali09/web-api/blob/main/Program.cs) (ASP.NET pipeline), [`Controllers/EmployeeController.cs`](https://github.com/muzammil-ali09/web-api/blob/main/Controllers/EmployeeController.cs) (Employee endpoints), [`Controllers/LogsController.cs`](https://github.com/muzammil-ali09/web-api/blob/main/Controllers/LogsController.cs) (Log query endpoint)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["API runtime"]
  node_host["ASP.NET pipeline<br/>[Program.cs]"]
end

subgraph group_identity["Identity"]
  node_auth["Auth endpoints<br/>[AuthController.cs]"]
  node_login_request["Login request<br/>[LoginRequest.cs]"]
  node_refresh_model["Refresh token model<br/>[RefreshToken.cs]"]
end

subgraph group_employees["Employee management"]
  node_employee_api["Employee endpoints"]
  node_employee_model["Employee model<br/>[Employee.cs]"]
end

subgraph group_observability["Request logging"]
  node_logging_middleware["Request logger"]
  node_logs_api["Log query endpoint<br/>[LogsController.cs]"]
  node_api_log_model["API log model<br/>[ApiLog.cs]"]
end

node_client(("API client"))
node_sql_server[("SQL Server")]
node_log_file["Local log file"]

node_host -->|"routes requests"| node_auth
node_host -->|"routes requests"| node_employee_api
node_host -->|"routes requests"| node_logs_api
node_client -->|"calls auth routes"| node_auth
node_client -->|"calls employee routes"| node_employee_api
node_client -->|"calls log route"| node_logs_api
node_auth -->|"reads and writes tokens"| node_sql_server
node_auth -->|"accepts login data"| node_login_request
node_auth -->|"uses refresh tokens"| node_refresh_model
node_employee_api -->|"executes CRUD procedure"| node_sql_server
node_employee_api -->|"maps employee data"| node_employee_model
node_host -->|"registers middleware"| node_logging_middleware
node_logging_middleware -->|"writes request records"| node_sql_server
node_logging_middleware -->|"appends request summaries"| node_log_file
node_logs_api -->|"queries log records"| node_sql_server
node_logs_api -->|"maps query results"| node_api_log_model

click node_host "https://github.com/muzammil-ali09/web-api/blob/main/Program.cs"
click node_auth "https://github.com/muzammil-ali09/web-api/blob/main/Controllers/AuthController.cs"
click node_login_request "https://github.com/muzammil-ali09/web-api/blob/main/Models/LoginRequest.cs"
click node_refresh_model "https://github.com/muzammil-ali09/web-api/blob/main/Models/RefreshToken.cs"
click node_employee_api "https://github.com/muzammil-ali09/web-api/blob/main/Controllers/EmployeeController.cs"
click node_employee_model "https://github.com/muzammil-ali09/web-api/blob/main/Models/Employee.cs"
click node_logging_middleware "https://github.com/muzammil-ali09/web-api/blob/main/Middleware/ApiLoggingMiddleware.cs.cs"
click node_logs_api "https://github.com/muzammil-ali09/web-api/blob/main/Controllers/LogsController.cs"
click node_api_log_model "https://github.com/muzammil-ali09/web-api/blob/main/Models/ApiLog.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_client toneBlue
class node_auth,node_login_request,node_refresh_model,node_sql_server toneAmber
class node_employee_api,node_employee_model toneMint
class node_logging_middleware,node_logs_api,node_api_log_model toneRose
class node_log_file toneIndigo
```

## Components

### API runtime

- [ASP.NET pipeline](https://github.com/muzammil-ali09/web-api/blob/main/Program.cs): `Program.cs`

### Identity

- [Auth endpoints](https://github.com/muzammil-ali09/web-api/blob/main/Controllers/AuthController.cs): `Controllers/AuthController.cs`
- [Login request](https://github.com/muzammil-ali09/web-api/blob/main/Models/LoginRequest.cs): `Models/LoginRequest.cs`
- [Refresh token model](https://github.com/muzammil-ali09/web-api/blob/main/Models/RefreshToken.cs): `Models/RefreshToken.cs`

### Employee management

- [Employee endpoints](https://github.com/muzammil-ali09/web-api/blob/main/Controllers/EmployeeController.cs): `Controllers/EmployeeController.cs`
- [Employee model](https://github.com/muzammil-ali09/web-api/blob/main/Models/Employee.cs): `Models/Employee.cs`

### Request logging

- [Request logger](https://github.com/muzammil-ali09/web-api/blob/main/Middleware/ApiLoggingMiddleware.cs.cs): `Middleware/ApiLoggingMiddleware.cs.cs`
- [Log query endpoint](https://github.com/muzammil-ali09/web-api/blob/main/Controllers/LogsController.cs): `Controllers/LogsController.cs`
- [API log model](https://github.com/muzammil-ali09/web-api/blob/main/Models/ApiLog.cs): `Models/ApiLog.cs`

### Other components

- **API client**
- **SQL Server**
- **Local log file**

## Connections

- ASP.NET pipeline → Auth endpoints: routes requests (evidence: `Program.cs`)
- ASP.NET pipeline → Employee endpoints: routes requests (evidence: `Program.cs`)
- ASP.NET pipeline → Log query endpoint: routes requests (evidence: `Program.cs`)
- API client → Auth endpoints: calls auth routes (evidence: `Controllers/AuthController.cs`)
- API client → Employee endpoints: calls employee routes (evidence: `Controllers/EmployeeController.cs`)
- API client → Log query endpoint: calls log route (evidence: `Controllers/LogsController.cs`)
- Auth endpoints → SQL Server: reads and writes tokens (evidence: `Controllers/AuthController.cs`)
- Auth endpoints → Login request: accepts login data (evidence: `Controllers/AuthController.cs`)
- Auth endpoints → Refresh token model: uses refresh tokens (evidence: `Controllers/AuthController.cs`)
- Employee endpoints → SQL Server: executes CRUD procedure (evidence: `Controllers/EmployeeController.cs`)
- Employee endpoints → Employee model: maps employee data (evidence: `Controllers/EmployeeController.cs`)
- ASP.NET pipeline → Request logger: registers middleware (evidence: `Program.cs`)
- Request logger → SQL Server: writes request records (evidence: `Middleware/ApiLoggingMiddleware.cs.cs`)
- Request logger → Local log file: appends request summaries (evidence: `Middleware/ApiLoggingMiddleware.cs.cs`)
- Log query endpoint → SQL Server: queries log records (evidence: `Controllers/LogsController.cs`)
- Log query endpoint → API log model: maps query results (evidence: `Controllers/LogsController.cs`)
