# y9ndra/sotrix architecture

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

- Interactive diagram: https://gitdiagram.com/y9ndra/sotrix
- Repository: https://github.com/y9ndra/sotrix

## Overview

Sotrix is a full-stack social network: users authenticate, publish and discover posts, interact through follows/comments/likes, and chat with live presence and notifications. The web client presents these workflows through routed pages and API/socket services; the Express gateway dispatches domain routes to backend services and persistence, while BullMQ workers handle asynchronous media, notifications, and maintenance. README documents the broader feed, search, caching, and media capabilities; unsampled implementation details are represented at their existing directory paths. Edges are limited to calls or wiring shown in excerpts or explicit README statements.

Main entry points: [`server/src/models`](https://github.com/y9ndra/sotrix/tree/main/server/src/models) (MongoDB), [`web/src/App.tsx`](https://github.com/y9ndra/sotrix/blob/main/web/src/App.tsx) (Routed application), [`web/src/pages`](https://github.com/y9ndra/sotrix/tree/main/web/src/pages) (Social pages), [`server/src/app.ts`](https://github.com/y9ndra/sotrix/blob/main/server/src/app.ts) (Express app)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web client"]
  node_webapp["Routed application<br/>[App.tsx]"]
  node_pages["Social pages"]
  node_webservices["API and socket clients"]
  node_querycache["Query state cache<br/>[queryCache.ts]"]
end

subgraph group_gateway["API gateway"]
  node_api["Express app<br/>[app.ts]"]
  node_authroutes["Auth routes<br/>[auth.routes.ts]"]
  node_postroutes["Post routes<br/>[post.routes.ts]"]
  node_postcontroller["Post controller<br/>[post.controller.ts]"]
  node_authcontroller["Auth controller<br/>[auth.controller.ts]"]
end

subgraph group_social["Social domains"]
  node_authservice["Auth and sessions<br/>[auth.service.ts]"]
  node_posts["Posts and feeds<br/>[post.service.ts]"]
  node_discovery["Explore and search<br/>[explore.service.ts]"]
  node_engagement["Comments likes follows<br/>[comment.service.ts]"]
  node_profiles["Profiles and users<br/>[user.service.ts]"]
end

subgraph group_realtime["Realtime and jobs"]
  node_messaging["Conversations and messages<br/>[message.service.ts]"]
  node_chatcontroller["Conversation controller"]
  node_socket["Socket events and presence"]
  node_notifications["Notifications"]
  node_workers["Background workers"]
  node_media["Media processing"]
end

subgraph group_platform["Data and integrations"]
  node_mongodb[("MongoDB")]
  node_redis[("Redis queues and cache<br/>[redis.ts]")]
  node_cloudinary["Cloudinary assets"]
end

node_user(("Member"))
node_websocket["Socket.IO transport"]

node_user -->|"uses"| node_webapp
node_webapp -->|"routes to"| node_pages
node_pages -->|"requests data"| node_webservices
node_pages -->|"updates cache"| node_querycache
node_webservices -.->|"calls HTTP API"| node_api
node_webapp -->|"connects"| node_websocket
node_websocket -.->|"exchanges events"| node_socket
node_api -->|"mounts"| node_authroutes
node_api -->|"mounts"| node_postroutes
node_authroutes -->|"dispatches"| node_authcontroller
node_postroutes -->|"dispatches"| node_postcontroller
node_authcontroller -->|"calls"| node_authservice
node_postcontroller -->|"calls"| node_posts
node_postcontroller -->|"uploads assets"| node_cloudinary
node_authservice -->|"persists sessions"| node_mongodb
node_posts -.->|"reads and writes"| node_mongodb
node_discovery -.->|"searches content"| node_mongodb
node_engagement -.->|"stores interactions"| node_mongodb
node_profiles -.->|"stores profiles"| node_mongodb
node_chatcontroller -->|"calls"| node_messaging
node_messaging -.->|"persists history"| node_mongodb
node_chatcontroller -->|"broadcasts events"| node_socket
node_socket -.->|"emits live events"| node_websocket
node_notifications -.->|"queues work"| node_redis
node_workers -.->|"consumes jobs"| node_redis
node_workers -.->|"runs processing"| node_media
node_media -.->|"stores assets"| node_cloudinary

click node_webapp "https://github.com/y9ndra/sotrix/blob/main/web/src/App.tsx"
click node_pages "https://github.com/y9ndra/sotrix/tree/main/web/src/pages"
click node_webservices "https://github.com/y9ndra/sotrix/tree/main/web/src/services"
click node_querycache "https://github.com/y9ndra/sotrix/blob/main/web/src/lib/queryCache.ts"
click node_api "https://github.com/y9ndra/sotrix/blob/main/server/src/app.ts"
click node_authroutes "https://github.com/y9ndra/sotrix/blob/main/server/src/routes/auth.routes.ts"
click node_postroutes "https://github.com/y9ndra/sotrix/blob/main/server/src/routes/post.routes.ts"
click node_postcontroller "https://github.com/y9ndra/sotrix/blob/main/server/src/controllers/post.controller.ts"
click node_authcontroller "https://github.com/y9ndra/sotrix/blob/main/server/src/controllers/auth.controller.ts"
click node_authservice "https://github.com/y9ndra/sotrix/blob/main/server/src/services/auth.service.ts"
click node_posts "https://github.com/y9ndra/sotrix/blob/main/server/src/services/post.service.ts"
click node_discovery "https://github.com/y9ndra/sotrix/blob/main/server/src/services/explore.service.ts"
click node_engagement "https://github.com/y9ndra/sotrix/blob/main/server/src/services/comment.service.ts"
click node_profiles "https://github.com/y9ndra/sotrix/blob/main/server/src/services/user.service.ts"
click node_messaging "https://github.com/y9ndra/sotrix/blob/main/server/src/services/message.service.ts"
click node_chatcontroller "https://github.com/y9ndra/sotrix/blob/main/server/src/controllers/conversation.controller.ts"
click node_socket "https://github.com/y9ndra/sotrix/tree/main/server/src/socket"
click node_notifications "https://github.com/y9ndra/sotrix/blob/main/server/src/services/notification.service.ts"
click node_workers "https://github.com/y9ndra/sotrix/tree/main/server/src/workers"
click node_media "https://github.com/y9ndra/sotrix/blob/main/server/src/services/media-processing.service.ts"
click node_mongodb "https://github.com/y9ndra/sotrix/tree/main/server/src/models"
click node_redis "https://github.com/y9ndra/sotrix/blob/main/server/src/config/redis.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_webapp,node_pages,node_webservices,node_querycache toneBlue
class node_api,node_authroutes,node_postroutes,node_postcontroller,node_authcontroller toneAmber
class node_authservice,node_posts,node_discovery,node_engagement,node_profiles toneMint
class node_messaging,node_chatcontroller,node_socket,node_notifications,node_workers,node_media toneRose
class node_mongodb,node_redis,node_cloudinary,node_user,node_websocket toneIndigo
```

## Components

### Web client

- [Routed application](https://github.com/y9ndra/sotrix/blob/main/web/src/App.tsx): `web/src/App.tsx`
- [Social pages](https://github.com/y9ndra/sotrix/tree/main/web/src/pages): `web/src/pages`
- [API and socket clients](https://github.com/y9ndra/sotrix/tree/main/web/src/services): `web/src/services`
- [Query state cache](https://github.com/y9ndra/sotrix/blob/main/web/src/lib/queryCache.ts): `web/src/lib/queryCache.ts`

### API gateway

- [Express app](https://github.com/y9ndra/sotrix/blob/main/server/src/app.ts): `server/src/app.ts`
- [Auth routes](https://github.com/y9ndra/sotrix/blob/main/server/src/routes/auth.routes.ts): `server/src/routes/auth.routes.ts`
- [Post routes](https://github.com/y9ndra/sotrix/blob/main/server/src/routes/post.routes.ts): `server/src/routes/post.routes.ts`
- [Post controller](https://github.com/y9ndra/sotrix/blob/main/server/src/controllers/post.controller.ts): `server/src/controllers/post.controller.ts`
- [Auth controller](https://github.com/y9ndra/sotrix/blob/main/server/src/controllers/auth.controller.ts): `server/src/controllers/auth.controller.ts`

### Social domains

- [Auth and sessions](https://github.com/y9ndra/sotrix/blob/main/server/src/services/auth.service.ts): `server/src/services/auth.service.ts`
- [Posts and feeds](https://github.com/y9ndra/sotrix/blob/main/server/src/services/post.service.ts): `server/src/services/post.service.ts`
- [Explore and search](https://github.com/y9ndra/sotrix/blob/main/server/src/services/explore.service.ts): `server/src/services/explore.service.ts`
- [Comments likes follows](https://github.com/y9ndra/sotrix/blob/main/server/src/services/comment.service.ts): `server/src/services/comment.service.ts`
- [Profiles and users](https://github.com/y9ndra/sotrix/blob/main/server/src/services/user.service.ts): `server/src/services/user.service.ts`

### Realtime and jobs

- [Conversations and messages](https://github.com/y9ndra/sotrix/blob/main/server/src/services/message.service.ts): `server/src/services/message.service.ts`
- [Conversation controller](https://github.com/y9ndra/sotrix/blob/main/server/src/controllers/conversation.controller.ts): `server/src/controllers/conversation.controller.ts`
- [Socket events and presence](https://github.com/y9ndra/sotrix/tree/main/server/src/socket): `server/src/socket`
- [Notifications](https://github.com/y9ndra/sotrix/blob/main/server/src/services/notification.service.ts): `server/src/services/notification.service.ts`
- [Background workers](https://github.com/y9ndra/sotrix/tree/main/server/src/workers): `server/src/workers`
- [Media processing](https://github.com/y9ndra/sotrix/blob/main/server/src/services/media-processing.service.ts): `server/src/services/media-processing.service.ts`

### Data and integrations

- [MongoDB](https://github.com/y9ndra/sotrix/tree/main/server/src/models): `server/src/models`
- [Redis queues and cache](https://github.com/y9ndra/sotrix/blob/main/server/src/config/redis.ts): `server/src/config/redis.ts`
- **Cloudinary assets**

### Other components

- **Member**
- **Socket.IO transport**

## Connections

- Member → Routed application: uses
- Routed application → Social pages: routes to (evidence: `web/src/App.tsx`)
- Social pages → API and socket clients: requests data (evidence: `web/src/pages/Search.tsx`)
- Social pages → Query state cache: updates cache (evidence: `web/src/lib/queryCache.ts`)
- API and socket clients → Express app: calls HTTP API
- Routed application → Socket.IO transport: connects (evidence: `web/src/App.tsx`)
- Socket.IO transport → Socket events and presence: exchanges events
- Express app → Auth routes: mounts (evidence: `server/src/app.ts`)
- Express app → Post routes: mounts (evidence: `server/src/app.ts`)
- Auth routes → Auth controller: dispatches (evidence: `server/src/routes/auth.routes.ts`)
- Post routes → Post controller: dispatches (evidence: `server/src/routes/post.routes.ts`)
- Auth controller → Auth and sessions: calls (evidence: `server/src/controllers/auth.controller.ts`)
- Post controller → Posts and feeds: calls (evidence: `server/src/controllers/post.controller.ts`)
- Post controller → Cloudinary assets: uploads assets (evidence: `server/src/controllers/post.controller.ts`)
- Auth and sessions → MongoDB: persists sessions (evidence: `server/src/services/auth.service.ts`)
- Posts and feeds → MongoDB: reads and writes
- Explore and search → MongoDB: searches content
- Comments likes follows → MongoDB: stores interactions
- Profiles and users → MongoDB: stores profiles
- Conversation controller → Conversations and messages: calls (evidence: `server/src/controllers/conversation.controller.ts`)
- Conversations and messages → MongoDB: persists history
- Conversation controller → Socket events and presence: broadcasts events (evidence: `server/src/controllers/conversation.controller.ts`)
- Socket events and presence → Socket.IO transport: emits live events
- Notifications → Redis queues and cache: queues work
- Background workers → Redis queues and cache: consumes jobs
- Background workers → Media processing: runs processing
- Media processing → Cloudinary assets: stores assets
