# ishakhamzaoui/socialhub-backend architecture

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

- Interactive diagram: https://gitdiagram.com/ishakhamzaoui/socialhub-backend
- Repository: https://github.com/ishakhamzaoui/socialhub-backend

## Overview

SocialHub is a social-networking API for accounts and profiles, social connections and safety, posts and comments, media, hashtags, and personalized feeds. The user-facing flow enters through API controllers and is handled by application features; the sampled feed handler confirms requester validation, suggested-user lookup, feed retrieval, and DTO assembly. The tree also shows authentication, scheduling, media processing, and persistence subsystems. The README is empty, and most source was not sampled, so links for those broader capabilities are omitted where caller relationships cannot be verified.

Main entry points: [`src/SocialHub.Application/Features/Feed/GetPersonalizedFeedQueryHandler.cs`](https://github.com/ishakhamzaoui/socialhub-backend/blob/main/src/SocialHub.Application/Features/Feed/GetPersonalizedFeedQueryHandler.cs) (Feed queries), [`src/SocialHub.API/Controllers`](https://github.com/ishakhamzaoui/socialhub-backend/tree/main/src/SocialHub.API/Controllers) (API controllers), [`src/SocialHub.Application/Features/Comments`](https://github.com/ishakhamzaoui/socialhub-backend/tree/main/src/SocialHub.Application/Features/Comments) (Comments), [`src/SocialHub.Application/Features/Users/Follow`](https://github.com/ishakhamzaoui/socialhub-backend/tree/main/src/SocialHub.Application/Features/Users/Follow) (Follow graph)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API boundary"]
  node_api_endpoints["API controllers<br/>[Controllers]"]
end

subgraph group_social["Social features"]
  node_auth["Authentication<br/>[Authentication]"]
  node_profiles["Profiles<br/>[Profile]"]
  node_follows["Follow graph<br/>[Follow]"]
  node_safety["User safety<br/>[Safety]"]
end

subgraph group_content["Content features"]
  node_posts["Posts<br/>[Posts]"]
  node_feed["Feed queries"]
  node_comments["Comments<br/>[Comments]"]
  node_media["Media<br/>[Media]"]
  node_hashtags["Hashtags<br/>[Hashtags]"]
end

subgraph group_platform["Application platform"]
  node_domain["Domain model<br/>[SocialHub.Domain]"]
  node_results["Result handling<br/>[Result.cs]"]
  node_messaging["Query handlers<br/>[IQueryHandler.cs]"]
  node_identity["Identity services<br/>[SocialHub.Identity]"]
end

subgraph group_infra["Infrastructure"]
  node_database[("Application database")]
  node_repositories["Repositories<br/>[Repositories]"]
  node_file_storage["File storage"]
  node_background["Background jobs<br/>[BackgroundJobs]"]
  node_media_processing["Media processing<br/>[Media]"]
end

node_user(("User"))

node_user -.->|"sends requests"| node_api_endpoints
node_api_endpoints -->|"dispatches profile actions"| node_profiles
node_api_endpoints -->|"dispatches follow actions"| node_follows
node_api_endpoints -->|"dispatches uploads"| node_media
node_feed -->|"gets suggestions"| node_follows
node_feed -->|"loads feed entries"| node_repositories
node_feed -->|"returns result"| node_results
node_feed -->|"implements query handler"| node_messaging
node_comments -->|"reads comments"| node_repositories
node_comments -->|"returns result"| node_results
node_comments -->|"implements query handler"| node_messaging
node_feed -->|"reads post entities"| node_domain
node_posts -->|"models post lifecycle"| node_domain
node_follows -->|"models follow edges"| node_domain
node_file_storage -->|"implements storage contract"| node_media

click node_api_endpoints "https://github.com/ishakhamzaoui/socialhub-backend/tree/main/src/SocialHub.API/Controllers"
click node_auth "https://github.com/ishakhamzaoui/socialhub-backend/tree/main/src/SocialHub.Application/Features/Authentication"
click node_profiles "https://github.com/ishakhamzaoui/socialhub-backend/tree/main/src/SocialHub.Application/Features/Users/Profile"
click node_follows "https://github.com/ishakhamzaoui/socialhub-backend/tree/main/src/SocialHub.Application/Features/Users/Follow"
click node_safety "https://github.com/ishakhamzaoui/socialhub-backend/tree/main/src/SocialHub.Application/Features/Users/Safety"
click node_posts "https://github.com/ishakhamzaoui/socialhub-backend/tree/main/src/SocialHub.Application/Features/Posts"
click node_feed "https://github.com/ishakhamzaoui/socialhub-backend/blob/main/src/SocialHub.Application/Features/Feed/GetPersonalizedFeedQueryHandler.cs"
click node_comments "https://github.com/ishakhamzaoui/socialhub-backend/tree/main/src/SocialHub.Application/Features/Comments"
click node_media "https://github.com/ishakhamzaoui/socialhub-backend/tree/main/src/SocialHub.Application/Features/Media"
click node_hashtags "https://github.com/ishakhamzaoui/socialhub-backend/tree/main/src/SocialHub.Application/Features/Hashtags"
click node_domain "https://github.com/ishakhamzaoui/socialhub-backend/tree/main/src/SocialHub.Domain"
click node_results "https://github.com/ishakhamzaoui/socialhub-backend/blob/main/src/SocialHub.Application/Common/Results/Result.cs"
click node_messaging "https://github.com/ishakhamzaoui/socialhub-backend/blob/main/src/SocialHub.Application/Common/Messaging/IQueryHandler.cs"
click node_identity "https://github.com/ishakhamzaoui/socialhub-backend/tree/main/src/SocialHub.Identity"
click node_database "https://github.com/ishakhamzaoui/socialhub-backend/blob/main/src/SocialHub.Persistence/Context/ApplicationDbContext.cs"
click node_repositories "https://github.com/ishakhamzaoui/socialhub-backend/tree/main/src/SocialHub.Persistence/Repositories"
click node_file_storage "https://github.com/ishakhamzaoui/socialhub-backend/blob/main/src/SocialHub.Infrastructure/Storage/LocalFileStorageService.cs"
click node_background "https://github.com/ishakhamzaoui/socialhub-backend/tree/main/src/SocialHub.Infrastructure/BackgroundJobs"
click node_media_processing "https://github.com/ishakhamzaoui/socialhub-backend/tree/main/src/SocialHub.Infrastructure/Media"

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_api_endpoints,node_user toneBlue
class node_auth,node_profiles,node_follows,node_safety toneAmber
class node_posts,node_feed,node_comments,node_media,node_hashtags toneMint
class node_domain,node_results,node_messaging,node_identity toneRose
class node_database,node_repositories,node_file_storage,node_background,node_media_processing toneIndigo
```

## Components

### API boundary

- [API controllers](https://github.com/ishakhamzaoui/socialhub-backend/tree/main/src/SocialHub.API/Controllers): `src/SocialHub.API/Controllers`

### Social features

- [Authentication](https://github.com/ishakhamzaoui/socialhub-backend/tree/main/src/SocialHub.Application/Features/Authentication): `src/SocialHub.Application/Features/Authentication`
- [Profiles](https://github.com/ishakhamzaoui/socialhub-backend/tree/main/src/SocialHub.Application/Features/Users/Profile): `src/SocialHub.Application/Features/Users/Profile`
- [Follow graph](https://github.com/ishakhamzaoui/socialhub-backend/tree/main/src/SocialHub.Application/Features/Users/Follow): `src/SocialHub.Application/Features/Users/Follow`
- [User safety](https://github.com/ishakhamzaoui/socialhub-backend/tree/main/src/SocialHub.Application/Features/Users/Safety): `src/SocialHub.Application/Features/Users/Safety`

### Content features

- [Posts](https://github.com/ishakhamzaoui/socialhub-backend/tree/main/src/SocialHub.Application/Features/Posts): `src/SocialHub.Application/Features/Posts`
- [Feed queries](https://github.com/ishakhamzaoui/socialhub-backend/blob/main/src/SocialHub.Application/Features/Feed/GetPersonalizedFeedQueryHandler.cs): `src/SocialHub.Application/Features/Feed/GetPersonalizedFeedQueryHandler.cs`
- [Comments](https://github.com/ishakhamzaoui/socialhub-backend/tree/main/src/SocialHub.Application/Features/Comments): `src/SocialHub.Application/Features/Comments`
- [Media](https://github.com/ishakhamzaoui/socialhub-backend/tree/main/src/SocialHub.Application/Features/Media): `src/SocialHub.Application/Features/Media`
- [Hashtags](https://github.com/ishakhamzaoui/socialhub-backend/tree/main/src/SocialHub.Application/Features/Hashtags): `src/SocialHub.Application/Features/Hashtags`

### Application platform

- [Domain model](https://github.com/ishakhamzaoui/socialhub-backend/tree/main/src/SocialHub.Domain): `src/SocialHub.Domain`
- [Result handling](https://github.com/ishakhamzaoui/socialhub-backend/blob/main/src/SocialHub.Application/Common/Results/Result.cs): `src/SocialHub.Application/Common/Results/Result.cs`
- [Query handlers](https://github.com/ishakhamzaoui/socialhub-backend/blob/main/src/SocialHub.Application/Common/Messaging/IQueryHandler.cs): `src/SocialHub.Application/Common/Messaging/IQueryHandler.cs`
- [Identity services](https://github.com/ishakhamzaoui/socialhub-backend/tree/main/src/SocialHub.Identity): `src/SocialHub.Identity`

### Infrastructure

- [Application database](https://github.com/ishakhamzaoui/socialhub-backend/blob/main/src/SocialHub.Persistence/Context/ApplicationDbContext.cs): `src/SocialHub.Persistence/Context/ApplicationDbContext.cs`
- [Repositories](https://github.com/ishakhamzaoui/socialhub-backend/tree/main/src/SocialHub.Persistence/Repositories): `src/SocialHub.Persistence/Repositories`
- [File storage](https://github.com/ishakhamzaoui/socialhub-backend/blob/main/src/SocialHub.Infrastructure/Storage/LocalFileStorageService.cs): `src/SocialHub.Infrastructure/Storage/LocalFileStorageService.cs`
- [Background jobs](https://github.com/ishakhamzaoui/socialhub-backend/tree/main/src/SocialHub.Infrastructure/BackgroundJobs): `src/SocialHub.Infrastructure/BackgroundJobs`
- [Media processing](https://github.com/ishakhamzaoui/socialhub-backend/tree/main/src/SocialHub.Infrastructure/Media): `src/SocialHub.Infrastructure/Media`

### Other components

- **User**

## Connections

- User → API controllers: sends requests
- API controllers → Profiles: dispatches profile actions (evidence: `src/SocialHub.API/Controllers/UsersController.cs`)
- API controllers → Follow graph: dispatches follow actions (evidence: `src/SocialHub.API/Controllers/UsersController.cs`)
- API controllers → Media: dispatches uploads (evidence: `src/SocialHub.API/Controllers/UsersController.cs`)
- Feed queries → Follow graph: gets suggestions (evidence: `src/SocialHub.Application/Features/Feed/GetPersonalizedFeedQueryHandler.cs`)
- Feed queries → Repositories: loads feed entries (evidence: `src/SocialHub.Application/Features/Feed/GetPersonalizedFeedQueryHandler.cs`)
- Feed queries → Result handling: returns result (evidence: `src/SocialHub.Application/Features/Feed/GetPersonalizedFeedQueryHandler.cs`)
- Feed queries → Query handlers: implements query handler (evidence: `src/SocialHub.Application/Features/Feed/GetPersonalizedFeedQueryHandler.cs`)
- Comments → Repositories: reads comments (evidence: `src/SocialHub.Application/Features/Comments/GetCommentRepliesQueryHandler.cs`)
- Comments → Result handling: returns result (evidence: `src/SocialHub.Application/Features/Comments/GetCommentRepliesQueryHandler.cs`)
- Comments → Query handlers: implements query handler (evidence: `src/SocialHub.Application/Features/Comments/GetCommentRepliesQueryHandler.cs`)
- Feed queries → Domain model: reads post entities (evidence: `src/SocialHub.Application/Features/Feed/GetPersonalizedFeedQueryHandler.cs`)
- Posts → Domain model: models post lifecycle (evidence: `src/SocialHub.Domain/Posts/Post.cs`)
- Follow graph → Domain model: models follow edges (evidence: `src/SocialHub.Domain/Users/Follow.cs`)
- File storage → Media: implements storage contract (evidence: `src/SocialHub.Infrastructure/Storage/LocalFileStorageService.cs`)
