# dysthmia/web-forum-backend architecture

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

- Interactive diagram: https://gitdiagram.com/dysthmia/web-forum-backend
- Repository: https://github.com/dysthmia/web-forum-backend

## Overview

Fomo Forum is an ASP.NET Core REST API for a discussion forum. The principal workflow is a client authenticating, browsing categories and topics, then creating topics or replies; related capabilities include profiles, reactions, bookmarks, search, reports, and moderation. Feature controllers delegate to services, with PostgreSQL persistence and Redis-backed caching, rate limiting, and view counting. The source index and excerpts support the shown relationships; unsampled feature internals are represented at their listed service paths, with uncertain wiring omitted.

Main entry points: [`src/Forum.Api/Infrastructure/Persistence/ForumDbContext.cs`](https://github.com/dysthmia/web-forum-backend/blob/main/src/Forum.Api/Infrastructure/Persistence/ForumDbContext.cs) (PostgreSQL data), [`src/Forum.Api/Features/Topics/TopicsService.cs`](https://github.com/dysthmia/web-forum-backend/blob/main/src/Forum.Api/Features/Topics/TopicsService.cs) (Topics and replies), [`src/Forum.Api/Common/Authorization/ActiveUserBanService.cs`](https://github.com/dysthmia/web-forum-backend/blob/main/src/Forum.Api/Common/Authorization/ActiveUserBanService.cs) (Ban checks), [`src/Forum.Api/Features/Auth/AuthController.cs`](https://github.com/dysthmia/web-forum-backend/blob/main/src/Forum.Api/Features/Auth/AuthController.cs) (Authentication)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API features"]
end

subgraph group_forum["Forum content"]
  node_categories["Categories"]
  node_topics["Topics and replies<br/>[TopicsService.cs]"]
  node_posts["Post management<br/>[PostsService.cs]"]
  node_search["Full-text search<br/>[SearchService.cs]"]
end

subgraph group_community["Community tools"]
  node_reactions["Reactions"]
  node_bookmarks["Bookmarks"]
end

subgraph group_governance["Identity and moderation"]
  node_auth["Authentication<br/>[AuthController.cs]"]
  node_profiles["User profiles<br/>[UsersService.cs]"]
  node_adminusers["Admin users"]
  node_authorization["Ban checks"]
  node_reports["Reports<br/>[ReportsService.cs]"]
  node_moderation["Moderation"]
end

subgraph group_infrastructure["Runtime infrastructure"]
  node_postgres[("PostgreSQL data<br/>[ForumDbContext.cs]")]
  node_cache["Redis cache<br/>[CacheService.cs]"]
  node_ratelimit["Rate limiting"]
  node_views["View counter"]
  node_viewjob["View count worker"]
end

node_client(("Forum client"))
node_redis[("Redis")]

node_client -->|"sends auth requests"| node_auth
node_client -->|"uses profiles"| node_profiles
node_client -->|"browses categories"| node_categories
node_client -->|"reads and creates"| node_topics
node_client -->|"searches topics"| node_search
node_client -->|"reacts to posts"| node_reactions
node_client -->|"saves topics"| node_bookmarks
node_client -->|"submits reports"| node_reports
node_client -->|"moderates forum"| node_moderation
node_auth -->|"checks bans"| node_authorization
node_auth -->|"checks login limit"| node_ratelimit
node_categories -->|"reads and writes"| node_cache
node_topics -->|"caches category topics"| node_cache
node_topics -->|"checks bans"| node_authorization
node_topics -->|"checks publish limit"| node_ratelimit
node_topics -->|"records views"| node_views
node_posts -->|"checks bans"| node_authorization
node_reactions -->|"checks bans"| node_authorization
node_bookmarks -->|"checks bans"| node_authorization
node_search -->|"queries topics and posts"| node_postgres
node_authorization -->|"reads active bans"| node_postgres
node_auth -->|"reads and writes"| node_postgres
node_categories -->|"reads and writes"| node_postgres
node_topics -->|"reads and writes"| node_postgres
node_posts -->|"reads and writes"| node_postgres
node_reactions -->|"reads and writes"| node_postgres
node_bookmarks -->|"reads and writes"| node_postgres
node_moderation -->|"reads and writes"| node_postgres
node_profiles -.->|"reads and writes"| node_postgres
node_adminusers -.->|"reads and writes"| node_postgres
node_reports -.->|"reads and writes"| node_postgres
node_cache -->|"stores cached data"| node_redis
node_ratelimit -->|"increments limits"| node_redis
node_views -.->|"records view keys"| node_redis
node_viewjob -->|"drains view counts"| node_views
node_viewjob -->|"persists view counts"| node_postgres

click node_auth "https://github.com/dysthmia/web-forum-backend/blob/main/src/Forum.Api/Features/Auth/AuthController.cs"
click node_profiles "https://github.com/dysthmia/web-forum-backend/blob/main/src/Forum.Api/Features/Users/UsersService.cs"
click node_adminusers "https://github.com/dysthmia/web-forum-backend/blob/main/src/Forum.Api/Features/Users/AdminUsersService.cs"
click node_authorization "https://github.com/dysthmia/web-forum-backend/blob/main/src/Forum.Api/Common/Authorization/ActiveUserBanService.cs"
click node_categories "https://github.com/dysthmia/web-forum-backend/blob/main/src/Forum.Api/Features/Categories/CategoriesService.cs"
click node_topics "https://github.com/dysthmia/web-forum-backend/blob/main/src/Forum.Api/Features/Topics/TopicsService.cs"
click node_posts "https://github.com/dysthmia/web-forum-backend/blob/main/src/Forum.Api/Features/Posts/PostsService.cs"
click node_search "https://github.com/dysthmia/web-forum-backend/blob/main/src/Forum.Api/Features/Search/SearchService.cs"
click node_reactions "https://github.com/dysthmia/web-forum-backend/blob/main/src/Forum.Api/Features/Reactions/ReactionsService.cs"
click node_bookmarks "https://github.com/dysthmia/web-forum-backend/blob/main/src/Forum.Api/Features/Bookmarks/BookmarksService.cs"
click node_reports "https://github.com/dysthmia/web-forum-backend/blob/main/src/Forum.Api/Features/Reports/ReportsService.cs"
click node_moderation "https://github.com/dysthmia/web-forum-backend/blob/main/src/Forum.Api/Features/Moderation/ModerationService.cs"
click node_postgres "https://github.com/dysthmia/web-forum-backend/blob/main/src/Forum.Api/Infrastructure/Persistence/ForumDbContext.cs"
click node_cache "https://github.com/dysthmia/web-forum-backend/blob/main/src/Forum.Api/Infrastructure/Redis/CacheService.cs"
click node_ratelimit "https://github.com/dysthmia/web-forum-backend/blob/main/src/Forum.Api/Infrastructure/Redis/RateLimitService.cs"
click node_views "https://github.com/dysthmia/web-forum-backend/blob/main/src/Forum.Api/Infrastructure/Redis/ViewCounterService.cs"
click node_viewjob "https://github.com/dysthmia/web-forum-backend/blob/main/src/Forum.Api/Infrastructure/BackgroundJobs/ViewCounterBackgroundService.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_categories,node_topics,node_posts,node_search,node_redis toneAmber
class node_reactions,node_bookmarks toneMint
class node_auth,node_profiles,node_adminusers,node_authorization,node_reports,node_moderation toneRose
class node_postgres,node_cache,node_ratelimit,node_views,node_viewjob toneIndigo
class node_client toneBlue
```

## Components

### Forum content

- [Categories](https://github.com/dysthmia/web-forum-backend/blob/main/src/Forum.Api/Features/Categories/CategoriesService.cs): `src/Forum.Api/Features/Categories/CategoriesService.cs`
- [Topics and replies](https://github.com/dysthmia/web-forum-backend/blob/main/src/Forum.Api/Features/Topics/TopicsService.cs): `src/Forum.Api/Features/Topics/TopicsService.cs`
- [Post management](https://github.com/dysthmia/web-forum-backend/blob/main/src/Forum.Api/Features/Posts/PostsService.cs): `src/Forum.Api/Features/Posts/PostsService.cs`
- [Full-text search](https://github.com/dysthmia/web-forum-backend/blob/main/src/Forum.Api/Features/Search/SearchService.cs): `src/Forum.Api/Features/Search/SearchService.cs`

### Community tools

- [Reactions](https://github.com/dysthmia/web-forum-backend/blob/main/src/Forum.Api/Features/Reactions/ReactionsService.cs): `src/Forum.Api/Features/Reactions/ReactionsService.cs`
- [Bookmarks](https://github.com/dysthmia/web-forum-backend/blob/main/src/Forum.Api/Features/Bookmarks/BookmarksService.cs): `src/Forum.Api/Features/Bookmarks/BookmarksService.cs`

### Identity and moderation

- [Authentication](https://github.com/dysthmia/web-forum-backend/blob/main/src/Forum.Api/Features/Auth/AuthController.cs): `src/Forum.Api/Features/Auth/AuthController.cs`
- [User profiles](https://github.com/dysthmia/web-forum-backend/blob/main/src/Forum.Api/Features/Users/UsersService.cs): `src/Forum.Api/Features/Users/UsersService.cs`
- [Admin users](https://github.com/dysthmia/web-forum-backend/blob/main/src/Forum.Api/Features/Users/AdminUsersService.cs): `src/Forum.Api/Features/Users/AdminUsersService.cs`
- [Ban checks](https://github.com/dysthmia/web-forum-backend/blob/main/src/Forum.Api/Common/Authorization/ActiveUserBanService.cs): `src/Forum.Api/Common/Authorization/ActiveUserBanService.cs`
- [Reports](https://github.com/dysthmia/web-forum-backend/blob/main/src/Forum.Api/Features/Reports/ReportsService.cs): `src/Forum.Api/Features/Reports/ReportsService.cs`
- [Moderation](https://github.com/dysthmia/web-forum-backend/blob/main/src/Forum.Api/Features/Moderation/ModerationService.cs): `src/Forum.Api/Features/Moderation/ModerationService.cs`

### Runtime infrastructure

- [PostgreSQL data](https://github.com/dysthmia/web-forum-backend/blob/main/src/Forum.Api/Infrastructure/Persistence/ForumDbContext.cs): `src/Forum.Api/Infrastructure/Persistence/ForumDbContext.cs`
- [Redis cache](https://github.com/dysthmia/web-forum-backend/blob/main/src/Forum.Api/Infrastructure/Redis/CacheService.cs): `src/Forum.Api/Infrastructure/Redis/CacheService.cs`
- [Rate limiting](https://github.com/dysthmia/web-forum-backend/blob/main/src/Forum.Api/Infrastructure/Redis/RateLimitService.cs): `src/Forum.Api/Infrastructure/Redis/RateLimitService.cs`
- [View counter](https://github.com/dysthmia/web-forum-backend/blob/main/src/Forum.Api/Infrastructure/Redis/ViewCounterService.cs): `src/Forum.Api/Infrastructure/Redis/ViewCounterService.cs`
- [View count worker](https://github.com/dysthmia/web-forum-backend/blob/main/src/Forum.Api/Infrastructure/BackgroundJobs/ViewCounterBackgroundService.cs): `src/Forum.Api/Infrastructure/BackgroundJobs/ViewCounterBackgroundService.cs`

### Other components

- **Forum client**
- **Redis**

## Connections

- Forum client → Authentication: sends auth requests
- Forum client → User profiles: uses profiles
- Forum client → Categories: browses categories
- Forum client → Topics and replies: reads and creates
- Forum client → Full-text search: searches topics
- Forum client → Reactions: reacts to posts
- Forum client → Bookmarks: saves topics
- Forum client → Reports: submits reports
- Forum client → Moderation: moderates forum
- Authentication → Ban checks: checks bans
- Authentication → Rate limiting: checks login limit (evidence: `src/Forum.Api/Features/Auth/AuthController.cs`)
- Categories → Redis cache: reads and writes (evidence: `src/Forum.Api/Features/Categories/CategoriesService.cs`)
- Topics and replies → Redis cache: caches category topics (evidence: `src/Forum.Api/Features/Topics/TopicsService.cs`)
- Topics and replies → Ban checks: checks bans (evidence: `src/Forum.Api/Features/Topics/TopicsService.cs`)
- Topics and replies → Rate limiting: checks publish limit (evidence: `src/Forum.Api/Features/Topics/TopicsController.cs`)
- Topics and replies → View counter: records views (evidence: `src/Forum.Api/Features/Topics/TopicsController.cs`)
- Post management → Ban checks: checks bans (evidence: `src/Forum.Api/Features/Posts/PostsService.cs`)
- Reactions → Ban checks: checks bans (evidence: `src/Forum.Api/Features/Reactions/ReactionsService.cs`)
- Bookmarks → Ban checks: checks bans (evidence: `src/Forum.Api/Features/Bookmarks/BookmarksService.cs`)
- Full-text search → PostgreSQL data: queries topics and posts (evidence: `src/Forum.Api/Features/Search/SearchService.cs`)
- Ban checks → PostgreSQL data: reads active bans (evidence: `src/Forum.Api/Common/Authorization/ActiveUserBanService.cs`)
- Authentication → PostgreSQL data: reads and writes
- Categories → PostgreSQL data: reads and writes (evidence: `src/Forum.Api/Features/Categories/CategoriesService.cs`)
- Topics and replies → PostgreSQL data: reads and writes (evidence: `src/Forum.Api/Features/Topics/TopicsService.cs`)
- Post management → PostgreSQL data: reads and writes (evidence: `src/Forum.Api/Features/Posts/PostsService.cs`)
- Reactions → PostgreSQL data: reads and writes (evidence: `src/Forum.Api/Features/Reactions/ReactionsService.cs`)
- Bookmarks → PostgreSQL data: reads and writes (evidence: `src/Forum.Api/Features/Bookmarks/BookmarksService.cs`)
- Moderation → PostgreSQL data: reads and writes (evidence: `src/Forum.Api/Features/Moderation/ModerationService.cs`)
- User profiles → PostgreSQL data: reads and writes (evidence: `src/Forum.Api/Features/Users/UsersService.cs`)
- Admin users → PostgreSQL data: reads and writes (evidence: `src/Forum.Api/Features/Users/AdminUsersService.cs`)
- Reports → PostgreSQL data: reads and writes (evidence: `src/Forum.Api/Features/Reports/ReportsService.cs`)
- Redis cache → Redis: stores cached data (evidence: `src/Forum.Api/Infrastructure/Redis/CacheService.cs`)
- Rate limiting → Redis: increments limits (evidence: `src/Forum.Api/Infrastructure/Redis/RateLimitService.cs`)
- View counter → Redis: records view keys
- View count worker → View counter: drains view counts (evidence: `src/Forum.Api/Infrastructure/BackgroundJobs/ViewCounterBackgroundService.cs`)
- View count worker → PostgreSQL data: persists view counts (evidence: `src/Forum.Api/Infrastructure/BackgroundJobs/ViewCounterBackgroundService.cs`)
