# bola-edward/surveybasket architecture

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

- Interactive diagram: https://gitdiagram.com/bola-edward/surveybasket
- Repository: https://github.com/bola-edward/surveybasket

## Overview

SurveyBasket is an ASP.NET Core API for managing polls and issuing JWT authentication with refresh-token rotation and revocation. The main workflows enter through the poll or authentication controllers, delegate to services, and persist state through Entity Framework/ASP.NET Identity. Poll endpoints support listing, retrieval, creation, updates, soft deletion, and publish toggling. The excerpts show these workflows, but do not establish a direct mapping-configuration call path or the full database deployment details.

Main entry points: [`SurveyBasket.API/Services/Implementations/AuthService.cs`](https://github.com/bola-edward/surveybasket/blob/main/SurveyBasket.API/Services/Implementations/AuthService.cs) (Auth service), [`SurveyBasket.API/Controllers/PollsController.cs`](https://github.com/bola-edward/surveybasket/blob/main/SurveyBasket.API/Controllers/PollsController.cs) (Poll endpoints), [`SurveyBasket.API/Controllers/AuthController.cs`](https://github.com/bola-edward/surveybasket/blob/main/SurveyBasket.API/Controllers/AuthController.cs) (Auth endpoints), [`SurveyBasket.API/Persistence/ApplicationDbContext.cs`](https://github.com/bola-edward/surveybasket/blob/main/SurveyBasket.API/Persistence/ApplicationDbContext.cs) (Application context)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API endpoints"]
  node_poll_controller["Poll endpoints<br/>[PollsController.cs]"]
  node_auth_controller["Auth endpoints<br/>[AuthController.cs]"]
  node_poll_contracts["Poll contracts<br/>[PollRequest.cs]"]
  node_poll_response["Poll response<br/>[PollResponse.cs]"]
  node_poll_validator["Poll validation"]
  node_auth_requests["Auth requests<br/>[LoginRequest.cs]"]
  node_refresh_request["Refresh request"]
  node_auth_response["Auth response<br/>[AuthResponse.cs]"]
end

subgraph group_polls["Poll management"]
  node_poll_service["Poll service<br/>[PollService.cs]"]
  node_poll_interface["Poll service contract<br/>[IPollService.cs]"]
  node_poll_entity["Poll entity<br/>[Poll.cs]"]
  node_poll_mapping["Poll mapping config"]
end

subgraph group_auth["Authentication"]
  node_auth_service["Auth service<br/>[AuthService.cs]"]
  node_auth_interface["Auth service contract<br/>[IAuthService.cs]"]
  node_jwt_provider["JWT provider<br/>[JWTProvider.cs]"]
  node_jwt_options["JWT options<br/>[JwtOptions.cs]"]
  node_application_user["Application user<br/>[ApplicationUser.cs]"]
  node_refresh_token["Refresh token<br/>[RefreshToken.cs]"]
end

subgraph group_persistence["Persistence"]
  node_db_context["Application context"]
  node_sql_database[("SQL database")]
end

node_client(("API client"))

node_client -->|"calls poll routes"| node_poll_controller
node_client -->|"calls auth routes"| node_auth_controller
node_poll_controller -->|"delegates poll operations"| node_poll_interface
node_poll_service -->|"implements"| node_poll_interface
node_poll_controller -->|"accepts"| node_poll_contracts
node_poll_controller -->|"maps to"| node_poll_entity
node_poll_controller -->|"returns"| node_poll_response
node_poll_validator -->|"validates"| node_poll_contracts
node_poll_service -->|"reads and saves"| node_db_context
node_db_context -->|"models"| node_poll_entity
node_db_context -.->|"persists entities"| node_sql_database
node_auth_controller -->|"delegates auth operations"| node_auth_interface
node_auth_service -->|"implements"| node_auth_interface
node_auth_controller -->|"accepts login"| node_auth_requests
node_auth_controller -->|"accepts refresh and revoke"| node_refresh_request
node_auth_service -->|"returns"| node_auth_response
node_auth_service -->|"generates and validates tokens"| node_jwt_provider
node_auth_service -->|"authenticates and updates"| node_application_user
node_auth_service -->|"rotates and revokes"| node_refresh_token
node_application_user -->|"owns tokens"| node_refresh_token
node_jwt_provider -->|"uses settings"| node_jwt_options

click node_poll_controller "https://github.com/bola-edward/surveybasket/blob/main/SurveyBasket.API/Controllers/PollsController.cs"
click node_auth_controller "https://github.com/bola-edward/surveybasket/blob/main/SurveyBasket.API/Controllers/AuthController.cs"
click node_poll_contracts "https://github.com/bola-edward/surveybasket/blob/main/SurveyBasket.API/Contracts/Poll/Requests/PollRequest.cs"
click node_poll_response "https://github.com/bola-edward/surveybasket/blob/main/SurveyBasket.API/Contracts/Poll/Responses/PollResponse.cs"
click node_poll_validator "https://github.com/bola-edward/surveybasket/blob/main/SurveyBasket.API/Contracts/Poll/Validators/PollRequestValidator.cs"
click node_auth_requests "https://github.com/bola-edward/surveybasket/blob/main/SurveyBasket.API/Contracts/Authentication/Requests/LoginRequest.cs"
click node_refresh_request "https://github.com/bola-edward/surveybasket/blob/main/SurveyBasket.API/Contracts/Authentication/Requests/RefreshTokenRequest.cs"
click node_auth_response "https://github.com/bola-edward/surveybasket/blob/main/SurveyBasket.API/Contracts/Authentication/Responses/AuthResponse.cs"
click node_poll_service "https://github.com/bola-edward/surveybasket/blob/main/SurveyBasket.API/Services/Implementations/PollService.cs"
click node_poll_interface "https://github.com/bola-edward/surveybasket/blob/main/SurveyBasket.API/Services/Interfaces/IPollService.cs"
click node_poll_entity "https://github.com/bola-edward/surveybasket/blob/main/SurveyBasket.API/Entities/Poll.cs"
click node_poll_mapping "https://github.com/bola-edward/surveybasket/blob/main/SurveyBasket.API/Mapping/PollMappingConfig.cs"
click node_auth_service "https://github.com/bola-edward/surveybasket/blob/main/SurveyBasket.API/Services/Implementations/AuthService.cs"
click node_auth_interface "https://github.com/bola-edward/surveybasket/blob/main/SurveyBasket.API/Services/Interfaces/IAuthService.cs"
click node_jwt_provider "https://github.com/bola-edward/surveybasket/blob/main/SurveyBasket.API/Authentication/JWTProvider.cs"
click node_jwt_options "https://github.com/bola-edward/surveybasket/blob/main/SurveyBasket.API/Authentication/JwtOptions.cs"
click node_application_user "https://github.com/bola-edward/surveybasket/blob/main/SurveyBasket.API/Entities/ApplicationUser.cs"
click node_refresh_token "https://github.com/bola-edward/surveybasket/blob/main/SurveyBasket.API/Entities/RefreshToken.cs"
click node_db_context "https://github.com/bola-edward/surveybasket/blob/main/SurveyBasket.API/Persistence/ApplicationDbContext.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_poll_controller,node_auth_controller,node_poll_contracts,node_poll_response,node_poll_validator,node_auth_requests,node_refresh_request,node_auth_response,node_client toneBlue
class node_poll_service,node_poll_interface,node_poll_entity,node_poll_mapping toneAmber
class node_auth_service,node_auth_interface,node_jwt_provider,node_jwt_options,node_application_user,node_refresh_token toneMint
class node_db_context,node_sql_database toneRose
```

## Components

### API endpoints

- [Poll endpoints](https://github.com/bola-edward/surveybasket/blob/main/SurveyBasket.API/Controllers/PollsController.cs): `SurveyBasket.API/Controllers/PollsController.cs`
- [Auth endpoints](https://github.com/bola-edward/surveybasket/blob/main/SurveyBasket.API/Controllers/AuthController.cs): `SurveyBasket.API/Controllers/AuthController.cs`
- [Poll contracts](https://github.com/bola-edward/surveybasket/blob/main/SurveyBasket.API/Contracts/Poll/Requests/PollRequest.cs): `SurveyBasket.API/Contracts/Poll/Requests/PollRequest.cs`
- [Poll response](https://github.com/bola-edward/surveybasket/blob/main/SurveyBasket.API/Contracts/Poll/Responses/PollResponse.cs): `SurveyBasket.API/Contracts/Poll/Responses/PollResponse.cs`
- [Poll validation](https://github.com/bola-edward/surveybasket/blob/main/SurveyBasket.API/Contracts/Poll/Validators/PollRequestValidator.cs): `SurveyBasket.API/Contracts/Poll/Validators/PollRequestValidator.cs`
- [Auth requests](https://github.com/bola-edward/surveybasket/blob/main/SurveyBasket.API/Contracts/Authentication/Requests/LoginRequest.cs): `SurveyBasket.API/Contracts/Authentication/Requests/LoginRequest.cs`
- [Refresh request](https://github.com/bola-edward/surveybasket/blob/main/SurveyBasket.API/Contracts/Authentication/Requests/RefreshTokenRequest.cs): `SurveyBasket.API/Contracts/Authentication/Requests/RefreshTokenRequest.cs`
- [Auth response](https://github.com/bola-edward/surveybasket/blob/main/SurveyBasket.API/Contracts/Authentication/Responses/AuthResponse.cs): `SurveyBasket.API/Contracts/Authentication/Responses/AuthResponse.cs`

### Poll management

- [Poll service](https://github.com/bola-edward/surveybasket/blob/main/SurveyBasket.API/Services/Implementations/PollService.cs): `SurveyBasket.API/Services/Implementations/PollService.cs`
- [Poll service contract](https://github.com/bola-edward/surveybasket/blob/main/SurveyBasket.API/Services/Interfaces/IPollService.cs): `SurveyBasket.API/Services/Interfaces/IPollService.cs`
- [Poll entity](https://github.com/bola-edward/surveybasket/blob/main/SurveyBasket.API/Entities/Poll.cs): `SurveyBasket.API/Entities/Poll.cs`
- [Poll mapping config](https://github.com/bola-edward/surveybasket/blob/main/SurveyBasket.API/Mapping/PollMappingConfig.cs): `SurveyBasket.API/Mapping/PollMappingConfig.cs`

### Authentication

- [Auth service](https://github.com/bola-edward/surveybasket/blob/main/SurveyBasket.API/Services/Implementations/AuthService.cs): `SurveyBasket.API/Services/Implementations/AuthService.cs`
- [Auth service contract](https://github.com/bola-edward/surveybasket/blob/main/SurveyBasket.API/Services/Interfaces/IAuthService.cs): `SurveyBasket.API/Services/Interfaces/IAuthService.cs`
- [JWT provider](https://github.com/bola-edward/surveybasket/blob/main/SurveyBasket.API/Authentication/JWTProvider.cs): `SurveyBasket.API/Authentication/JWTProvider.cs`
- [JWT options](https://github.com/bola-edward/surveybasket/blob/main/SurveyBasket.API/Authentication/JwtOptions.cs): `SurveyBasket.API/Authentication/JwtOptions.cs`
- [Application user](https://github.com/bola-edward/surveybasket/blob/main/SurveyBasket.API/Entities/ApplicationUser.cs): `SurveyBasket.API/Entities/ApplicationUser.cs`
- [Refresh token](https://github.com/bola-edward/surveybasket/blob/main/SurveyBasket.API/Entities/RefreshToken.cs): `SurveyBasket.API/Entities/RefreshToken.cs`

### Persistence

- [Application context](https://github.com/bola-edward/surveybasket/blob/main/SurveyBasket.API/Persistence/ApplicationDbContext.cs): `SurveyBasket.API/Persistence/ApplicationDbContext.cs`
- **SQL database**

### Other components

- **API client**

## Connections

- API client → Poll endpoints: calls poll routes (evidence: `SurveyBasket.API/Controllers/PollsController.cs`)
- API client → Auth endpoints: calls auth routes (evidence: `SurveyBasket.API/Controllers/AuthController.cs`)
- Poll endpoints → Poll service contract: delegates poll operations (evidence: `SurveyBasket.API/Controllers/PollsController.cs`)
- Poll service → Poll service contract: implements (evidence: `SurveyBasket.API/Services/Implementations/PollService.cs`)
- Poll endpoints → Poll contracts: accepts (evidence: `SurveyBasket.API/Controllers/PollsController.cs`)
- Poll endpoints → Poll entity: maps to (evidence: `SurveyBasket.API/Controllers/PollsController.cs`)
- Poll endpoints → Poll response: returns (evidence: `SurveyBasket.API/Controllers/PollsController.cs`)
- Poll validation → Poll contracts: validates (evidence: `SurveyBasket.API/Contracts/Poll/Validators/PollRequestValidator.cs`)
- Poll service → Application context: reads and saves (evidence: `SurveyBasket.API/Services/Implementations/PollService.cs`)
- Application context → Poll entity: models (evidence: `SurveyBasket.API/Persistence/ApplicationDbContext.cs`)
- Application context → SQL database: persists entities
- Auth endpoints → Auth service contract: delegates auth operations (evidence: `SurveyBasket.API/Controllers/AuthController.cs`)
- Auth service → Auth service contract: implements (evidence: `SurveyBasket.API/Services/Implementations/AuthService.cs`)
- Auth endpoints → Auth requests: accepts login (evidence: `SurveyBasket.API/Controllers/AuthController.cs`)
- Auth endpoints → Refresh request: accepts refresh and revoke (evidence: `SurveyBasket.API/Controllers/AuthController.cs`)
- Auth service → Auth response: returns (evidence: `SurveyBasket.API/Services/Implementations/AuthService.cs`)
- Auth service → JWT provider: generates and validates tokens (evidence: `SurveyBasket.API/Services/Implementations/AuthService.cs`)
- Auth service → Application user: authenticates and updates (evidence: `SurveyBasket.API/Services/Implementations/AuthService.cs`)
- Auth service → Refresh token: rotates and revokes (evidence: `SurveyBasket.API/Services/Implementations/AuthService.cs`)
- Application user → Refresh token: owns tokens (evidence: `SurveyBasket.API/Entities/ApplicationUser.cs`)
- JWT provider → JWT options: uses settings (evidence: `SurveyBasket.API/Authentication/JWTProvider.cs`)
