# tharuni-git/social-media-platform architecture

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

- Interactive diagram: https://gitdiagram.com/tharuni-git/social-media-platform
- Repository: https://github.com/tharuni-git/social-media-platform

## Overview

SocialPulse is a social feed and real-time chat application, with a React client behind an API gateway and separate user, content, chat, notification, and media services. The main workflow is signing in, then browsing or creating posts and interacting with people; chat and notification updates provide real-time branches. The README documents service, database, object-storage, and event-bus connections. Sampled source confirms selected controller-to-service and service-to-event relationships; other documented service internals are represented at subsystem level.

Main entry points: [`api-gateway/src/server.ts`](https://github.com/tharuni-git/social-media-platform/blob/main/api-gateway/src/server.ts) (API gateway), [`user-service/src/users/users.controller.ts`](https://github.com/tharuni-git/social-media-platform/blob/main/user-service/src/users/users.controller.ts) (User service), [`chat-service/src/messages/messages.service.ts`](https://github.com/tharuni-git/social-media-platform/blob/main/chat-service/src/messages/messages.service.ts) (Messages and receipts), [`socialpulse/src/App.jsx`](https://github.com/tharuni-git/social-media-platform/blob/main/socialpulse/src/App.jsx) (SocialPulse UI)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Client and gateway"]
  node_frontend["SocialPulse UI<br/>[App.jsx]"]
  node_gateway["API gateway<br/>[server.ts]"]
end

subgraph group_identity["Identity and social graph"]
  node_user_api["User service"]
  node_auth["Authentication<br/>[auth.service.ts]"]
  node_user_store[("User Postgres")]
end

subgraph group_content["Feed and moderation"]
  node_content_api["Posts and comments"]
  node_posts["Feed and interactions<br/>[posts.service.ts]"]
  node_moderation["Content moderation"]
  node_content_store[("Content Postgres")]
end

subgraph group_chat["Messaging"]
  node_chat_gateway["Chat WebSocket<br/>[chat.gateway.ts]"]
  node_conversations["Conversations"]
  node_messages["Messages and receipts"]
  node_blocks["Chat blocks<br/>[blocks.service.ts]"]
  node_chat_store[("Chat MongoDB")]
  node_presence["Presence and Redis"]
end

subgraph group_notify["Notifications and media"]
  node_notification_service["Notification service"]
  node_notification_store[("Notification MongoDB")]
  node_media["Media service<br/>[media.service.ts]"]
  node_minio[("MinIO storage")]
end

node_person(("User"))
node_events["RabbitMQ events"]

node_person -->|"uses"| node_frontend
node_frontend -->|"REST and WS"| node_gateway
node_frontend -->|"uploads and reads"| node_minio
node_gateway -->|"routes requests"| node_user_api
node_gateway -->|"routes requests"| node_content_api
node_gateway -->|"routes requests"| node_chat_gateway
node_gateway -->|"routes requests"| node_notification_service
node_gateway -->|"routes requests"| node_media
node_user_api -.->|"delegates"| node_auth
node_auth -->|"reads and writes"| node_user_store
node_auth -->|"publishes registration"| node_events
node_user_api -->|"reads and writes"| node_user_store
node_user_api -->|"publishes social events"| node_events
node_content_api -->|"delegates"| node_posts
node_posts -->|"reads and writes"| node_content_store
node_posts -->|"publishes post events"| node_events
node_moderation -.->|"moderates content"| node_content_store
node_chat_gateway -.->|"dispatches messages"| node_messages
node_chat_gateway -.->|"dispatches chat"| node_conversations
node_conversations -->|"checks blocks"| node_blocks
node_messages -->|"checks blocks"| node_blocks
node_messages -->|"publishes sent event"| node_events
node_conversations -->|"reads and writes"| node_chat_store
node_messages -->|"reads and writes"| node_chat_store
node_presence -.->|"presence via Redis"| node_chat_store
node_events -->|"delivers events"| node_notification_service
node_notification_service -->|"reads and writes"| node_notification_store
node_media -->|"stores media"| node_minio
node_events -->|"delivers follow events"| node_content_api
node_events -->|"delivers block events"| node_blocks

click node_frontend "https://github.com/tharuni-git/social-media-platform/blob/main/socialpulse/src/App.jsx"
click node_gateway "https://github.com/tharuni-git/social-media-platform/blob/main/api-gateway/src/server.ts"
click node_user_api "https://github.com/tharuni-git/social-media-platform/blob/main/user-service/src/users/users.controller.ts"
click node_auth "https://github.com/tharuni-git/social-media-platform/blob/main/user-service/src/auth/auth.service.ts"
click node_content_api "https://github.com/tharuni-git/social-media-platform/blob/main/content-service/src/posts/posts.controller.ts"
click node_posts "https://github.com/tharuni-git/social-media-platform/blob/main/content-service/src/posts/posts.service.ts"
click node_moderation "https://github.com/tharuni-git/social-media-platform/blob/main/content-service/src/moderation/moderation.controller.ts"
click node_chat_gateway "https://github.com/tharuni-git/social-media-platform/blob/main/chat-service/src/gateway/chat.gateway.ts"
click node_conversations "https://github.com/tharuni-git/social-media-platform/blob/main/chat-service/src/conversations/conversations.service.ts"
click node_messages "https://github.com/tharuni-git/social-media-platform/blob/main/chat-service/src/messages/messages.service.ts"
click node_blocks "https://github.com/tharuni-git/social-media-platform/blob/main/chat-service/src/blocks/blocks.service.ts"
click node_presence "https://github.com/tharuni-git/social-media-platform/blob/main/chat-service/src/redis/presence.service.ts"
click node_notification_service "https://github.com/tharuni-git/social-media-platform/blob/main/notification-service/src/notifications.service.ts"
click node_media "https://github.com/tharuni-git/social-media-platform/blob/main/media-service/src/media.service.ts"

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_frontend,node_gateway,node_person toneBlue
class node_user_api,node_auth,node_user_store toneAmber
class node_content_api,node_posts,node_moderation,node_content_store toneMint
class node_chat_gateway,node_conversations,node_messages,node_blocks,node_chat_store,node_presence toneRose
class node_notification_service,node_notification_store,node_media,node_minio,node_events toneIndigo
```

## Components

### Client and gateway

- [SocialPulse UI](https://github.com/tharuni-git/social-media-platform/blob/main/socialpulse/src/App.jsx): `socialpulse/src/App.jsx`
- [API gateway](https://github.com/tharuni-git/social-media-platform/blob/main/api-gateway/src/server.ts): `api-gateway/src/server.ts`

### Identity and social graph

- [User service](https://github.com/tharuni-git/social-media-platform/blob/main/user-service/src/users/users.controller.ts): `user-service/src/users/users.controller.ts`
- [Authentication](https://github.com/tharuni-git/social-media-platform/blob/main/user-service/src/auth/auth.service.ts): `user-service/src/auth/auth.service.ts`
- **User Postgres**

### Feed and moderation

- [Posts and comments](https://github.com/tharuni-git/social-media-platform/blob/main/content-service/src/posts/posts.controller.ts): `content-service/src/posts/posts.controller.ts`
- [Feed and interactions](https://github.com/tharuni-git/social-media-platform/blob/main/content-service/src/posts/posts.service.ts): `content-service/src/posts/posts.service.ts`
- [Content moderation](https://github.com/tharuni-git/social-media-platform/blob/main/content-service/src/moderation/moderation.controller.ts): `content-service/src/moderation/moderation.controller.ts`
- **Content Postgres**

### Messaging

- [Chat WebSocket](https://github.com/tharuni-git/social-media-platform/blob/main/chat-service/src/gateway/chat.gateway.ts): `chat-service/src/gateway/chat.gateway.ts`
- [Conversations](https://github.com/tharuni-git/social-media-platform/blob/main/chat-service/src/conversations/conversations.service.ts): `chat-service/src/conversations/conversations.service.ts`
- [Messages and receipts](https://github.com/tharuni-git/social-media-platform/blob/main/chat-service/src/messages/messages.service.ts): `chat-service/src/messages/messages.service.ts`
- [Chat blocks](https://github.com/tharuni-git/social-media-platform/blob/main/chat-service/src/blocks/blocks.service.ts): `chat-service/src/blocks/blocks.service.ts`
- **Chat MongoDB**
- [Presence and Redis](https://github.com/tharuni-git/social-media-platform/blob/main/chat-service/src/redis/presence.service.ts): `chat-service/src/redis/presence.service.ts`

### Notifications and media

- [Notification service](https://github.com/tharuni-git/social-media-platform/blob/main/notification-service/src/notifications.service.ts): `notification-service/src/notifications.service.ts`
- **Notification MongoDB**
- [Media service](https://github.com/tharuni-git/social-media-platform/blob/main/media-service/src/media.service.ts): `media-service/src/media.service.ts`
- **MinIO storage**

### Other components

- **User**
- **RabbitMQ events**

## Connections

- User → SocialPulse UI: uses (evidence: `README.md`)
- SocialPulse UI → API gateway: REST and WS (evidence: `README.md`)
- SocialPulse UI → MinIO storage: uploads and reads (evidence: `README.md`)
- API gateway → User service: routes requests (evidence: `README.md`)
- API gateway → Posts and comments: routes requests (evidence: `README.md`)
- API gateway → Chat WebSocket: routes requests (evidence: `README.md`)
- API gateway → Notification service: routes requests (evidence: `README.md`)
- API gateway → Media service: routes requests (evidence: `README.md`)
- User service → Authentication: delegates
- Authentication → User Postgres: reads and writes (evidence: `user-service/src/auth/auth.service.ts`)
- Authentication → RabbitMQ events: publishes registration (evidence: `user-service/src/auth/auth.service.ts`)
- User service → User Postgres: reads and writes (evidence: `README.md`)
- User service → RabbitMQ events: publishes social events (evidence: `README.md`)
- Posts and comments → Feed and interactions: delegates (evidence: `content-service/src/posts/posts.controller.ts`)
- Feed and interactions → Content Postgres: reads and writes (evidence: `content-service/src/posts/posts.service.ts`)
- Feed and interactions → RabbitMQ events: publishes post events (evidence: `content-service/src/posts/posts.service.ts`)
- Content moderation → Content Postgres: moderates content
- Chat WebSocket → Messages and receipts: dispatches messages
- Chat WebSocket → Conversations: dispatches chat
- Conversations → Chat blocks: checks blocks (evidence: `chat-service/src/conversations/conversations.service.ts`)
- Messages and receipts → Chat blocks: checks blocks (evidence: `chat-service/src/messages/messages.service.ts`)
- Messages and receipts → RabbitMQ events: publishes sent event (evidence: `chat-service/src/messages/messages.service.ts`)
- Conversations → Chat MongoDB: reads and writes (evidence: `README.md`)
- Messages and receipts → Chat MongoDB: reads and writes (evidence: `chat-service/src/messages/messages.service.ts`)
- Presence and Redis → Chat MongoDB: presence via Redis
- RabbitMQ events → Notification service: delivers events (evidence: `README.md`)
- Notification service → Notification MongoDB: reads and writes (evidence: `README.md`)
- Media service → MinIO storage: stores media (evidence: `README.md`)
- RabbitMQ events → Posts and comments: delivers follow events (evidence: `README.md`)
- RabbitMQ events → Chat blocks: delivers block events (evidence: `README.md`)
