# hausenlot/socmed-backend architecture

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

- Interactive diagram: https://gitdiagram.com/hausenlot/socmed-backend
- Repository: https://github.com/hausenlot/socmed-backend

## Overview

This is a social-media backend for accounts, posts (“rants”), threaded replies, timelines, follows, notifications, and direct or group messaging. The principal flow is a user request through an API controller into a domain service, which reads or changes application data and returns a response; posts and replies can also trigger notifications. The graph preserves the documented-by-code media and real-time messaging capabilities. Several service implementations were not excerpted, so their internal calls and timeline behavior are not asserted.

Main entry points: [`socmed-backend/Program.cs`](https://github.com/hausenlot/socmed-backend/blob/main/socmed-backend/Program.cs) (Application host), [`socmed-backend/Data/AppDbContext.cs`](https://github.com/hausenlot/socmed-backend/blob/main/socmed-backend/Data/AppDbContext.cs) (Data access), [`socmed-backend/Services/NotificationService.cs`](https://github.com/hausenlot/socmed-backend/blob/main/socmed-backend/Services/NotificationService.cs) (Notifications), [`socmed-backend/Services/MessageService.cs`](https://github.com/hausenlot/socmed-backend/blob/main/socmed-backend/Services/MessageService.cs) (Direct messaging)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["HTTP API"]
  node_auth_api["Authentication API<br/>[AuthController.cs]"]
  node_rants_api["Rants API<br/>[RantsController.cs]"]
  node_replies_api["Replies API"]
  node_timelines_api["Timelines API"]
  node_users_api["Users API<br/>[UsersController.cs]"]
  node_messages_api["Messages API"]
  node_notifications_api["Notifications API"]
end

subgraph group_social["Social features"]
  node_auth["Authentication<br/>[AuthService.cs]"]
  node_rants["Rant posts<br/>[RantService.cs]"]
  node_replies["Threaded replies<br/>[ReplyService.cs]"]
  node_timelines["Timeline queries<br/>[TimelineService.cs]"]
  node_follows["Follow relationships<br/>[FollowService.cs]"]
  node_users["User profiles<br/>[UserService.cs]"]
end

subgraph group_messaging["Messaging and alerts"]
  node_messages["Direct messaging<br/>[MessageService.cs]"]
  node_notifications["Notifications"]
  node_hub["Notification hub<br/>[NotificationHub.cs]"]
  node_encryption["Message encryption"]
end

subgraph group_runtime["Runtime and integrations"]
  node_program["Application host<br/>[Program.cs]"]
  node_media["Multimedia handling"]
  node_media_api["File manager"]
end

subgraph group_data["Domain data"]
  node_dbcontext["Data access<br/>[AppDbContext.cs]"]
  node_users_model["Account model<br/>[User.cs]"]
  node_rant_model["Rant model<br/>[Rant.cs]"]
  node_reply_model["Reply model<br/>[RantReply.cs]"]
  node_message_model["Message model<br/>[Message.cs]"]
  node_conversation_model["Conversation model<br/>[Conversation.cs]"]
  node_notification_model["Notification model<br/>[Notification.cs]"]
  node_follow_model["Follow model<br/>[Follow.cs]"]
end

node_user(("User"))

node_user -.->|"sends requests"| node_program
node_program -->|"maps controllers"| node_auth_api
node_program -->|"maps controllers"| node_rants_api
node_program -->|"maps controllers"| node_replies_api
node_program -->|"maps controllers"| node_timelines_api
node_program -->|"maps controllers"| node_users_api
node_program -->|"maps controllers"| node_messages_api
node_program -->|"maps controllers"| node_notifications_api
node_auth_api -->|"delegates to"| node_auth
node_rants_api -->|"delegates to"| node_rants
node_rants_api -->|"delegates to"| node_replies
node_replies_api -->|"delegates to"| node_replies
node_timelines_api -->|"delegates to"| node_timelines
node_users_api -->|"delegates to"| node_users
node_users_api -->|"delegates to"| node_follows
node_messages_api -->|"delegates to"| node_messages
node_notifications_api -->|"delegates to"| node_notifications
node_program -->|"configures database"| node_dbcontext
node_program -->|"maps hub"| node_hub
node_program -->|"registers service"| node_media
node_program -->|"registers service"| node_messages
node_program -->|"registers service"| node_notifications
node_program -->|"registers service"| node_rants
node_auth -->|"reads and writes"| node_dbcontext
node_auth -->|"gets media URL"| node_media
node_rants -->|"queries and saves"| node_dbcontext
node_rants -->|"processes mentions"| node_notifications
node_replies -->|"queries and saves"| node_dbcontext
node_replies -->|"creates alerts"| node_notifications
node_replies -->|"gets media URL"| node_media
node_messages -->|"uses data context"| node_dbcontext
node_messages -->|"uses encryption"| node_encryption
node_messages -->|"uses notification hub"| node_hub
node_messages -->|"uses media service"| node_media
node_notifications -->|"uses data context"| node_dbcontext
node_notifications -->|"uses notification hub"| node_hub
node_notifications -->|"uses media service"| node_media
node_media -.->|"forwards uploads"| node_media_api
node_dbcontext -->|"maps entity"| node_users_model
node_dbcontext -->|"maps entity"| node_rant_model
node_dbcontext -->|"maps entity"| node_reply_model
node_dbcontext -->|"maps entity"| node_message_model
node_dbcontext -->|"maps entity"| node_conversation_model
node_dbcontext -->|"maps entity"| node_notification_model
node_dbcontext -->|"maps entity"| node_follow_model

click node_program "https://github.com/hausenlot/socmed-backend/blob/main/socmed-backend/Program.cs"
click node_auth_api "https://github.com/hausenlot/socmed-backend/blob/main/socmed-backend/Controllers/AuthController.cs"
click node_rants_api "https://github.com/hausenlot/socmed-backend/blob/main/socmed-backend/Controllers/RantsController.cs"
click node_replies_api "https://github.com/hausenlot/socmed-backend/blob/main/socmed-backend/Controllers/RepliesController.cs"
click node_timelines_api "https://github.com/hausenlot/socmed-backend/blob/main/socmed-backend/Controllers/TimelinesController.cs"
click node_users_api "https://github.com/hausenlot/socmed-backend/blob/main/socmed-backend/Controllers/UsersController.cs"
click node_messages_api "https://github.com/hausenlot/socmed-backend/blob/main/socmed-backend/Controllers/MessagesController.cs"
click node_notifications_api "https://github.com/hausenlot/socmed-backend/blob/main/socmed-backend/Controllers/NotificationsController.cs"
click node_auth "https://github.com/hausenlot/socmed-backend/blob/main/socmed-backend/Services/AuthService.cs"
click node_rants "https://github.com/hausenlot/socmed-backend/blob/main/socmed-backend/Services/RantService.cs"
click node_replies "https://github.com/hausenlot/socmed-backend/blob/main/socmed-backend/Services/ReplyService.cs"
click node_timelines "https://github.com/hausenlot/socmed-backend/blob/main/socmed-backend/Services/TimelineService.cs"
click node_follows "https://github.com/hausenlot/socmed-backend/blob/main/socmed-backend/Services/FollowService.cs"
click node_users "https://github.com/hausenlot/socmed-backend/blob/main/socmed-backend/Services/UserService.cs"
click node_messages "https://github.com/hausenlot/socmed-backend/blob/main/socmed-backend/Services/MessageService.cs"
click node_notifications "https://github.com/hausenlot/socmed-backend/blob/main/socmed-backend/Services/NotificationService.cs"
click node_hub "https://github.com/hausenlot/socmed-backend/blob/main/socmed-backend/Hubs/NotificationHub.cs"
click node_encryption "https://github.com/hausenlot/socmed-backend/blob/main/socmed-backend/Services/EncryptionService.cs"
click node_media "https://github.com/hausenlot/socmed-backend/blob/main/socmed-backend/Services/MultimediaService.cs"
click node_dbcontext "https://github.com/hausenlot/socmed-backend/blob/main/socmed-backend/Data/AppDbContext.cs"
click node_users_model "https://github.com/hausenlot/socmed-backend/blob/main/socmed-backend/Models/User.cs"
click node_rant_model "https://github.com/hausenlot/socmed-backend/blob/main/socmed-backend/Models/Rant.cs"
click node_reply_model "https://github.com/hausenlot/socmed-backend/blob/main/socmed-backend/Models/RantReply.cs"
click node_message_model "https://github.com/hausenlot/socmed-backend/blob/main/socmed-backend/Models/Message.cs"
click node_conversation_model "https://github.com/hausenlot/socmed-backend/blob/main/socmed-backend/Models/Conversation.cs"
click node_notification_model "https://github.com/hausenlot/socmed-backend/blob/main/socmed-backend/Models/Notification.cs"
click node_follow_model "https://github.com/hausenlot/socmed-backend/blob/main/socmed-backend/Models/Follow.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_auth_api,node_rants_api,node_replies_api,node_timelines_api,node_users_api,node_messages_api,node_notifications_api,node_user toneBlue
class node_auth,node_rants,node_replies,node_timelines,node_follows,node_users toneAmber
class node_messages,node_notifications,node_hub,node_encryption toneMint
class node_program,node_media,node_media_api toneRose
class node_dbcontext,node_users_model,node_rant_model,node_reply_model,node_message_model,node_conversation_model,node_notification_model,node_follow_model toneIndigo
```

## Components

### HTTP API

- [Authentication API](https://github.com/hausenlot/socmed-backend/blob/main/socmed-backend/Controllers/AuthController.cs): `socmed-backend/Controllers/AuthController.cs`
- [Rants API](https://github.com/hausenlot/socmed-backend/blob/main/socmed-backend/Controllers/RantsController.cs): `socmed-backend/Controllers/RantsController.cs`
- [Replies API](https://github.com/hausenlot/socmed-backend/blob/main/socmed-backend/Controllers/RepliesController.cs): `socmed-backend/Controllers/RepliesController.cs`
- [Timelines API](https://github.com/hausenlot/socmed-backend/blob/main/socmed-backend/Controllers/TimelinesController.cs): `socmed-backend/Controllers/TimelinesController.cs`
- [Users API](https://github.com/hausenlot/socmed-backend/blob/main/socmed-backend/Controllers/UsersController.cs): `socmed-backend/Controllers/UsersController.cs`
- [Messages API](https://github.com/hausenlot/socmed-backend/blob/main/socmed-backend/Controllers/MessagesController.cs): `socmed-backend/Controllers/MessagesController.cs`
- [Notifications API](https://github.com/hausenlot/socmed-backend/blob/main/socmed-backend/Controllers/NotificationsController.cs): `socmed-backend/Controllers/NotificationsController.cs`

### Social features

- [Authentication](https://github.com/hausenlot/socmed-backend/blob/main/socmed-backend/Services/AuthService.cs): `socmed-backend/Services/AuthService.cs`
- [Rant posts](https://github.com/hausenlot/socmed-backend/blob/main/socmed-backend/Services/RantService.cs): `socmed-backend/Services/RantService.cs`
- [Threaded replies](https://github.com/hausenlot/socmed-backend/blob/main/socmed-backend/Services/ReplyService.cs): `socmed-backend/Services/ReplyService.cs`
- [Timeline queries](https://github.com/hausenlot/socmed-backend/blob/main/socmed-backend/Services/TimelineService.cs): `socmed-backend/Services/TimelineService.cs`
- [Follow relationships](https://github.com/hausenlot/socmed-backend/blob/main/socmed-backend/Services/FollowService.cs): `socmed-backend/Services/FollowService.cs`
- [User profiles](https://github.com/hausenlot/socmed-backend/blob/main/socmed-backend/Services/UserService.cs): `socmed-backend/Services/UserService.cs`

### Messaging and alerts

- [Direct messaging](https://github.com/hausenlot/socmed-backend/blob/main/socmed-backend/Services/MessageService.cs): `socmed-backend/Services/MessageService.cs`
- [Notifications](https://github.com/hausenlot/socmed-backend/blob/main/socmed-backend/Services/NotificationService.cs): `socmed-backend/Services/NotificationService.cs`
- [Notification hub](https://github.com/hausenlot/socmed-backend/blob/main/socmed-backend/Hubs/NotificationHub.cs): `socmed-backend/Hubs/NotificationHub.cs`
- [Message encryption](https://github.com/hausenlot/socmed-backend/blob/main/socmed-backend/Services/EncryptionService.cs): `socmed-backend/Services/EncryptionService.cs`

### Runtime and integrations

- [Application host](https://github.com/hausenlot/socmed-backend/blob/main/socmed-backend/Program.cs): `socmed-backend/Program.cs`
- [Multimedia handling](https://github.com/hausenlot/socmed-backend/blob/main/socmed-backend/Services/MultimediaService.cs): `socmed-backend/Services/MultimediaService.cs`
- **File manager**

### Domain data

- [Data access](https://github.com/hausenlot/socmed-backend/blob/main/socmed-backend/Data/AppDbContext.cs): `socmed-backend/Data/AppDbContext.cs`
- [Account model](https://github.com/hausenlot/socmed-backend/blob/main/socmed-backend/Models/User.cs): `socmed-backend/Models/User.cs`
- [Rant model](https://github.com/hausenlot/socmed-backend/blob/main/socmed-backend/Models/Rant.cs): `socmed-backend/Models/Rant.cs`
- [Reply model](https://github.com/hausenlot/socmed-backend/blob/main/socmed-backend/Models/RantReply.cs): `socmed-backend/Models/RantReply.cs`
- [Message model](https://github.com/hausenlot/socmed-backend/blob/main/socmed-backend/Models/Message.cs): `socmed-backend/Models/Message.cs`
- [Conversation model](https://github.com/hausenlot/socmed-backend/blob/main/socmed-backend/Models/Conversation.cs): `socmed-backend/Models/Conversation.cs`
- [Notification model](https://github.com/hausenlot/socmed-backend/blob/main/socmed-backend/Models/Notification.cs): `socmed-backend/Models/Notification.cs`
- [Follow model](https://github.com/hausenlot/socmed-backend/blob/main/socmed-backend/Models/Follow.cs): `socmed-backend/Models/Follow.cs`

### Other components

- **User**

## Connections

- User → Application host: sends requests
- Application host → Authentication API: maps controllers (evidence: `socmed-backend/Program.cs`)
- Application host → Rants API: maps controllers (evidence: `socmed-backend/Program.cs`)
- Application host → Replies API: maps controllers (evidence: `socmed-backend/Program.cs`)
- Application host → Timelines API: maps controllers (evidence: `socmed-backend/Program.cs`)
- Application host → Users API: maps controllers (evidence: `socmed-backend/Program.cs`)
- Application host → Messages API: maps controllers (evidence: `socmed-backend/Program.cs`)
- Application host → Notifications API: maps controllers (evidence: `socmed-backend/Program.cs`)
- Authentication API → Authentication: delegates to (evidence: `socmed-backend/Controllers/AuthController.cs`)
- Rants API → Rant posts: delegates to (evidence: `socmed-backend/Controllers/RantsController.cs`)
- Rants API → Threaded replies: delegates to (evidence: `socmed-backend/Controllers/RantsController.cs`)
- Replies API → Threaded replies: delegates to (evidence: `socmed-backend/Controllers/RepliesController.cs`)
- Timelines API → Timeline queries: delegates to (evidence: `socmed-backend/Controllers/TimelinesController.cs`)
- Users API → User profiles: delegates to (evidence: `socmed-backend/Controllers/UsersController.cs`)
- Users API → Follow relationships: delegates to (evidence: `socmed-backend/Controllers/UsersController.cs`)
- Messages API → Direct messaging: delegates to (evidence: `socmed-backend/Controllers/MessagesController.cs`)
- Notifications API → Notifications: delegates to (evidence: `socmed-backend/Controllers/NotificationsController.cs`)
- Application host → Data access: configures database (evidence: `socmed-backend/Program.cs`)
- Application host → Notification hub: maps hub (evidence: `socmed-backend/Program.cs`)
- Application host → Multimedia handling: registers service (evidence: `socmed-backend/Program.cs`)
- Application host → Direct messaging: registers service (evidence: `socmed-backend/Program.cs`)
- Application host → Notifications: registers service (evidence: `socmed-backend/Program.cs`)
- Application host → Rant posts: registers service (evidence: `socmed-backend/Program.cs`)
- Authentication → Data access: reads and writes (evidence: `socmed-backend/Services/AuthService.cs`)
- Authentication → Multimedia handling: gets media URL (evidence: `socmed-backend/Services/AuthService.cs`)
- Rant posts → Data access: queries and saves (evidence: `socmed-backend/Services/RantService.cs`)
- Rant posts → Notifications: processes mentions (evidence: `socmed-backend/Services/RantService.cs`)
- Threaded replies → Data access: queries and saves (evidence: `socmed-backend/Services/ReplyService.cs`)
- Threaded replies → Notifications: creates alerts (evidence: `socmed-backend/Services/ReplyService.cs`)
- Threaded replies → Multimedia handling: gets media URL (evidence: `socmed-backend/Services/ReplyService.cs`)
- Direct messaging → Data access: uses data context (evidence: `socmed-backend/Services/MessageService.cs`)
- Direct messaging → Message encryption: uses encryption (evidence: `socmed-backend/Services/MessageService.cs`)
- Direct messaging → Notification hub: uses notification hub (evidence: `socmed-backend/Services/MessageService.cs`)
- Direct messaging → Multimedia handling: uses media service (evidence: `socmed-backend/Services/MessageService.cs`)
- Notifications → Data access: uses data context (evidence: `socmed-backend/Services/NotificationService.cs`)
- Notifications → Notification hub: uses notification hub (evidence: `socmed-backend/Services/NotificationService.cs`)
- Notifications → Multimedia handling: uses media service (evidence: `socmed-backend/Services/NotificationService.cs`)
- Multimedia handling → File manager: forwards uploads
- Data access → Account model: maps entity (evidence: `socmed-backend/Data/AppDbContext.cs`)
- Data access → Rant model: maps entity (evidence: `socmed-backend/Data/AppDbContext.cs`)
- Data access → Reply model: maps entity (evidence: `socmed-backend/Data/AppDbContext.cs`)
- Data access → Message model: maps entity (evidence: `socmed-backend/Data/AppDbContext.cs`)
- Data access → Conversation model: maps entity (evidence: `socmed-backend/Data/AppDbContext.cs`)
- Data access → Notification model: maps entity (evidence: `socmed-backend/Data/AppDbContext.cs`)
- Data access → Follow model: maps entity (evidence: `socmed-backend/Data/AppDbContext.cs`)
