# codeplaygroundhub/pasochat architecture

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

- Interactive diagram: https://gitdiagram.com/codeplaygroundhub/pasochat
- Repository: https://github.com/codeplaygroundhub/pasochat

## Overview

PASO is a realtime messaging and communication platform: users authenticate, create or join conversations, exchange persistent messages with realtime delivery, and use media, AI assistance, calling, and temporary statuses. The backend exposes REST workflows alongside Socket.IO, with MongoDB persistence and Redis-based realtime scaling described in the README. Administration and reporting form a separate moderation branch. Several feature modules were not sampled; their paths are supported by the tree, but uncertain call-level wiring is omitted.

Main entry points: [`backend/src/index.js`](https://github.com/codeplaygroundhub/pasochat/blob/main/backend/src/index.js) (Express API), [`backend/src/controllers/message.controller.js`](https://github.com/codeplaygroundhub/pasochat/blob/main/backend/src/controllers/message.controller.js) (Message workflows), [`frontend/src/App.jsx`](https://github.com/codeplaygroundhub/pasochat/blob/main/frontend/src/App.jsx) (React application), [`backend/src/lib/socket.js`](https://github.com/codeplaygroundhub/pasochat/blob/main/backend/src/lib/socket.js) (Socket.IO server)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Client experience"]
  node_webapp["React application<br/>[App.jsx]"]
  node_authui["Auth state<br/>[useAuthStore.js]"]
  node_chatui["Chat experience<br/>[HomePage.jsx]"]
  node_chatstate["Chat state<br/>[useChatStore.js]"]
  node_calls["Voice/video calls<br/>[useCallStore.js]"]
  node_adminui["Admin console<br/>[AdminDashboard.jsx]"]
end

subgraph group_api["Application API"]
  node_apientry["Express API<br/>[index.js]"]
  node_auth["Authentication<br/>[auth.controller.js]"]
  node_groups["Group conversations"]
  node_messages["Message workflows"]
  node_statuses["Temporary statuses"]
  node_polls["Polls<br/>[poll.controller.js]"]
  node_users["User features<br/>[user.controller.js]"]
  node_db[("MongoDB connection<br/>[db.js]")]
  node_userstore[("User records<br/>[user.model.js]")]
  node_messagestore[("Message records<br/>[message.model.js]")]
  node_groupstore[("Group records<br/>[group.model.js]")]
  node_statusstore[("Status records<br/>[status.model.js]")]
  node_pollstore[("Poll records<br/>[poll.model.js]")]
end

subgraph group_realtime["Realtime communication"]
  node_socket["Socket.IO server<br/>[socket.js]"]
  node_redis[("Redis Pub/Sub<br/>[redis.js]")]
end

subgraph group_intelligence["AI and media"]
  node_ai["AI workflows<br/>[ai.service.js]"]
  node_mlclient["ML client<br/>[mlService.js]"]
  node_ml["Moderation inference<br/>[app.py]"]
  node_gif["GIF search<br/>[gif.service.js]"]
  node_cloudinary["Cloudinary media<br/>[cloudinary.js]"]
end

subgraph group_governance["Administration"]
  node_moderation["Admin and reports"]
  node_report["Report workflows"]
  node_reportstore[("Report records<br/>[report.model.js]")]
end

node_user(("User"))
node_groq["Groq API"]
node_giphy["GIPHY"]
node_cloudinaryservice["Cloudinary service"]
node_zego["ZegoCloud calling"]

node_user -->|"uses"| node_webapp
node_webapp -->|"checks identity"| node_authui
node_authui -->|"auth requests"| node_apientry
node_apientry -->|"dispatches auth"| node_auth
node_auth -->|"reads/writes users"| node_userstore
node_auth -->|"uploads profile media"| node_cloudinary
node_cloudinary -->|"uploads"| node_cloudinaryservice
node_webapp -->|"renders chat"| node_chatui
node_chatui -->|"uses chat state"| node_chatstate
node_chatstate -->|"conversation requests"| node_apientry
node_apientry -->|"dispatches messages"| node_messages
node_apientry -->|"dispatches groups"| node_groups
node_apientry -->|"dispatches statuses"| node_statuses
node_apientry -->|"dispatches polls"| node_polls
node_apientry -->|"dispatches users"| node_users
node_messages -->|"reads/writes messages"| node_messagestore
node_messages -->|"checks membership"| node_groupstore
node_groups -->|"reads/writes groups"| node_groupstore
node_groups -->|"validates members"| node_userstore
node_statuses -->|"reads/writes statuses"| node_statusstore
node_polls -->|"reads/writes polls"| node_pollstore
node_users -->|"reads/writes users"| node_userstore
node_messages -->|"analyzes text"| node_mlclient
node_mlclient -->|"sends analysis"| node_ml
node_ml -->|"returns scores/replies"| node_messages
node_messages -->|"emits message events"| node_socket
node_authui -->|"connects socket"| node_socket
node_socket -->|"delivers events"| node_chatstate
node_socket -.->|"synchronizes events"| node_redis
node_messages -->|"uploads attachments"| node_cloudinary
node_apientry -->|"dispatches AI routes"| node_ai
node_ai -.->|"requests generation"| node_groq
node_apientry -->|"dispatches GIF routes"| node_gif
node_gif -->|"searches/trends"| node_giphy
node_webapp -->|"renders calling"| node_calls
node_calls -.->|"places calls"| node_zego
node_apientry -->|"dispatches admin"| node_moderation
node_apientry -->|"dispatches reports"| node_report
node_report -->|"reads/writes reports"| node_reportstore
node_adminui -->|"admin requests"| node_apientry
node_moderation -->|"manages accounts"| node_userstore
node_apientry -->|"connects persistence"| node_db

click node_webapp "https://github.com/codeplaygroundhub/pasochat/blob/main/frontend/src/App.jsx"
click node_authui "https://github.com/codeplaygroundhub/pasochat/blob/main/frontend/src/store/useAuthStore.js"
click node_chatui "https://github.com/codeplaygroundhub/pasochat/blob/main/frontend/src/pages/HomePage.jsx"
click node_chatstate "https://github.com/codeplaygroundhub/pasochat/blob/main/frontend/src/store/useChatStore.js"
click node_calls "https://github.com/codeplaygroundhub/pasochat/blob/main/frontend/src/store/useCallStore.js"
click node_apientry "https://github.com/codeplaygroundhub/pasochat/blob/main/backend/src/index.js"
click node_auth "https://github.com/codeplaygroundhub/pasochat/blob/main/backend/src/controllers/auth.controller.js"
click node_groups "https://github.com/codeplaygroundhub/pasochat/blob/main/backend/src/controllers/group.controller.js"
click node_messages "https://github.com/codeplaygroundhub/pasochat/blob/main/backend/src/controllers/message.controller.js"
click node_statuses "https://github.com/codeplaygroundhub/pasochat/blob/main/backend/src/controllers/status.controller.js"
click node_polls "https://github.com/codeplaygroundhub/pasochat/blob/main/backend/src/controllers/poll.controller.js"
click node_users "https://github.com/codeplaygroundhub/pasochat/blob/main/backend/src/controllers/user.controller.js"
click node_socket "https://github.com/codeplaygroundhub/pasochat/blob/main/backend/src/lib/socket.js"
click node_redis "https://github.com/codeplaygroundhub/pasochat/blob/main/backend/src/lib/redis.js"
click node_db "https://github.com/codeplaygroundhub/pasochat/blob/main/backend/src/lib/db.js"
click node_userstore "https://github.com/codeplaygroundhub/pasochat/blob/main/backend/src/models/user.model.js"
click node_messagestore "https://github.com/codeplaygroundhub/pasochat/blob/main/backend/src/models/message.model.js"
click node_groupstore "https://github.com/codeplaygroundhub/pasochat/blob/main/backend/src/models/group.model.js"
click node_statusstore "https://github.com/codeplaygroundhub/pasochat/blob/main/backend/src/models/status.model.js"
click node_pollstore "https://github.com/codeplaygroundhub/pasochat/blob/main/backend/src/models/poll.model.js"
click node_ai "https://github.com/codeplaygroundhub/pasochat/blob/main/backend/src/services/ai.service.js"
click node_mlclient "https://github.com/codeplaygroundhub/pasochat/blob/main/backend/src/lib/mlService.js"
click node_ml "https://github.com/codeplaygroundhub/pasochat/blob/main/ml-service/app.py"
click node_gif "https://github.com/codeplaygroundhub/pasochat/blob/main/backend/src/services/gif.service.js"
click node_cloudinary "https://github.com/codeplaygroundhub/pasochat/blob/main/backend/src/lib/cloudinary.js"
click node_moderation "https://github.com/codeplaygroundhub/pasochat/blob/main/backend/src/controllers/admin.controller.js"
click node_report "https://github.com/codeplaygroundhub/pasochat/blob/main/backend/src/controllers/report.controller.js"
click node_reportstore "https://github.com/codeplaygroundhub/pasochat/blob/main/backend/src/models/report.model.js"
click node_adminui "https://github.com/codeplaygroundhub/pasochat/blob/main/frontend/src/pages/AdminDashboard.jsx"

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_authui,node_chatui,node_chatstate,node_calls,node_adminui,node_user toneBlue
class node_apientry,node_auth,node_groups,node_messages,node_statuses,node_polls,node_users,node_db,node_userstore,node_messagestore,node_groupstore,node_statusstore,node_pollstore toneAmber
class node_socket,node_redis,node_groq toneMint
class node_ai,node_mlclient,node_ml,node_gif,node_cloudinary toneRose
class node_moderation,node_report,node_reportstore,node_giphy,node_cloudinaryservice,node_zego toneIndigo
```

## Components

### Client experience

- [React application](https://github.com/codeplaygroundhub/pasochat/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Auth state](https://github.com/codeplaygroundhub/pasochat/blob/main/frontend/src/store/useAuthStore.js): `frontend/src/store/useAuthStore.js`
- [Chat experience](https://github.com/codeplaygroundhub/pasochat/blob/main/frontend/src/pages/HomePage.jsx): `frontend/src/pages/HomePage.jsx`
- [Chat state](https://github.com/codeplaygroundhub/pasochat/blob/main/frontend/src/store/useChatStore.js): `frontend/src/store/useChatStore.js`
- [Voice/video calls](https://github.com/codeplaygroundhub/pasochat/blob/main/frontend/src/store/useCallStore.js): `frontend/src/store/useCallStore.js`
- [Admin console](https://github.com/codeplaygroundhub/pasochat/blob/main/frontend/src/pages/AdminDashboard.jsx): `frontend/src/pages/AdminDashboard.jsx`

### Application API

- [Express API](https://github.com/codeplaygroundhub/pasochat/blob/main/backend/src/index.js): `backend/src/index.js`
- [Authentication](https://github.com/codeplaygroundhub/pasochat/blob/main/backend/src/controllers/auth.controller.js): `backend/src/controllers/auth.controller.js`
- [Group conversations](https://github.com/codeplaygroundhub/pasochat/blob/main/backend/src/controllers/group.controller.js): `backend/src/controllers/group.controller.js`
- [Message workflows](https://github.com/codeplaygroundhub/pasochat/blob/main/backend/src/controllers/message.controller.js): `backend/src/controllers/message.controller.js`
- [Temporary statuses](https://github.com/codeplaygroundhub/pasochat/blob/main/backend/src/controllers/status.controller.js): `backend/src/controllers/status.controller.js`
- [Polls](https://github.com/codeplaygroundhub/pasochat/blob/main/backend/src/controllers/poll.controller.js): `backend/src/controllers/poll.controller.js`
- [User features](https://github.com/codeplaygroundhub/pasochat/blob/main/backend/src/controllers/user.controller.js): `backend/src/controllers/user.controller.js`
- [MongoDB connection](https://github.com/codeplaygroundhub/pasochat/blob/main/backend/src/lib/db.js): `backend/src/lib/db.js`
- [User records](https://github.com/codeplaygroundhub/pasochat/blob/main/backend/src/models/user.model.js): `backend/src/models/user.model.js`
- [Message records](https://github.com/codeplaygroundhub/pasochat/blob/main/backend/src/models/message.model.js): `backend/src/models/message.model.js`
- [Group records](https://github.com/codeplaygroundhub/pasochat/blob/main/backend/src/models/group.model.js): `backend/src/models/group.model.js`
- [Status records](https://github.com/codeplaygroundhub/pasochat/blob/main/backend/src/models/status.model.js): `backend/src/models/status.model.js`
- [Poll records](https://github.com/codeplaygroundhub/pasochat/blob/main/backend/src/models/poll.model.js): `backend/src/models/poll.model.js`

### Realtime communication

- [Socket.IO server](https://github.com/codeplaygroundhub/pasochat/blob/main/backend/src/lib/socket.js): `backend/src/lib/socket.js`
- [Redis Pub/Sub](https://github.com/codeplaygroundhub/pasochat/blob/main/backend/src/lib/redis.js): `backend/src/lib/redis.js`

### AI and media

- [AI workflows](https://github.com/codeplaygroundhub/pasochat/blob/main/backend/src/services/ai.service.js): `backend/src/services/ai.service.js`
- [ML client](https://github.com/codeplaygroundhub/pasochat/blob/main/backend/src/lib/mlService.js): `backend/src/lib/mlService.js`
- [Moderation inference](https://github.com/codeplaygroundhub/pasochat/blob/main/ml-service/app.py): `ml-service/app.py`
- [GIF search](https://github.com/codeplaygroundhub/pasochat/blob/main/backend/src/services/gif.service.js): `backend/src/services/gif.service.js`
- [Cloudinary media](https://github.com/codeplaygroundhub/pasochat/blob/main/backend/src/lib/cloudinary.js): `backend/src/lib/cloudinary.js`

### Administration

- [Admin and reports](https://github.com/codeplaygroundhub/pasochat/blob/main/backend/src/controllers/admin.controller.js): `backend/src/controllers/admin.controller.js`
- [Report workflows](https://github.com/codeplaygroundhub/pasochat/blob/main/backend/src/controllers/report.controller.js): `backend/src/controllers/report.controller.js`
- [Report records](https://github.com/codeplaygroundhub/pasochat/blob/main/backend/src/models/report.model.js): `backend/src/models/report.model.js`

### Other components

- **User**
- **Groq API**
- **GIPHY**
- **Cloudinary service**
- **ZegoCloud calling**

## Connections

- User → React application: uses
- React application → Auth state: checks identity
- Auth state → Express API: auth requests
- Express API → Authentication: dispatches auth
- Authentication → User records: reads/writes users
- Authentication → Cloudinary media: uploads profile media
- Cloudinary media → Cloudinary service: uploads
- React application → Chat experience: renders chat
- Chat experience → Chat state: uses chat state
- Chat state → Express API: conversation requests
- Express API → Message workflows: dispatches messages
- Express API → Group conversations: dispatches groups
- Express API → Temporary statuses: dispatches statuses
- Express API → Polls: dispatches polls
- Express API → User features: dispatches users
- Message workflows → Message records: reads/writes messages
- Message workflows → Group records: checks membership
- Group conversations → Group records: reads/writes groups
- Group conversations → User records: validates members
- Temporary statuses → Status records: reads/writes statuses
- Polls → Poll records: reads/writes polls
- User features → User records: reads/writes users
- Message workflows → ML client: analyzes text
- ML client → Moderation inference: sends analysis
- Moderation inference → Message workflows: returns scores/replies
- Message workflows → Socket.IO server: emits message events
- Auth state → Socket.IO server: connects socket
- Socket.IO server → Chat state: delivers events
- Socket.IO server → Redis Pub/Sub: synchronizes events
- Message workflows → Cloudinary media: uploads attachments
- Express API → AI workflows: dispatches AI routes
- AI workflows → Groq API: requests generation
- Express API → GIF search: dispatches GIF routes
- GIF search → GIPHY: searches/trends
- React application → Voice/video calls: renders calling
- Voice/video calls → ZegoCloud calling: places calls
- Express API → Admin and reports: dispatches admin
- Express API → Report workflows: dispatches reports
- Report workflows → Report records: reads/writes reports
- Admin console → Express API: admin requests
- Admin and reports → User records: manages accounts
- Express API → MongoDB connection: connects persistence
