# ankitaaa29/chat architecture

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

- Interactive diagram: https://gitdiagram.com/ankitaaa29/chat
- Repository: https://github.com/ankitaaa29/chat

## Overview

PulseChat is a real-time private messaging platform with web and mobile clients sharing an Express API and Socket.io backend. Users authenticate, discover users and exchange contact requests; acceptance establishes a conversation, where participants retrieve and send persisted messages and can exchange live updates. The README also documents image uploads, presence, typing indicators and calls. The graph captures the sampled REST and contact flow; several feature implementations are unsampled, so their internal wiring is not asserted.

Main entry points: [`backend/src/app.js`](https://github.com/ankitaaa29/chat/blob/main/backend/src/app.js) (API routes), [`backend/src/config/db.js`](https://github.com/ankitaaa29/chat/blob/main/backend/src/config/db.js) (Prisma connection), [`mobile/src/screens/DashboardScreen.js`](https://github.com/ankitaaa29/chat/blob/main/mobile/src/screens/DashboardScreen.js) (Mobile dashboard), [`backend/src/server.js`](https://github.com/ankitaaa29/chat/blob/main/backend/src/server.js) (Express server)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_clients["Client applications"]
  node_webapp["Web app<br/>[App.jsx]"]
  node_webdashboard["Web dashboard<br/>[DashboardPage.jsx]"]
  node_webapi["Web REST client<br/>[api.js]"]
  node_websocket["Web socket client<br/>[socket.js]"]
  node_webcall["Web calling UI<br/>[CallModal.jsx]"]
  node_mobileapp["Mobile app<br/>[App.js]"]
  node_mobiledashboard["Mobile dashboard<br/>[DashboardScreen.js]"]
  node_mobileauth["Mobile login<br/>[LoginScreen.js]"]
  node_mobileapi["Mobile REST client<br/>[api.js]"]
  node_mobilesocket["Mobile socket client<br/>[socket.js]"]
  node_mobilecall["Mobile calling UI<br/>[CallModal.js]"]
end

subgraph group_api["HTTP API and domain"]
  node_server["Express server<br/>[server.js]"]
  node_routes["API routes<br/>[app.js]"]
  node_authroutes["Auth routes<br/>[auth.routes.js]"]
  node_authcontroller["Authentication<br/>[auth.controller.js]"]
  node_userdomain["User accounts<br/>[user.service.js]"]
  node_contactroutes["Contact routes<br/>[contact.routes.js]"]
  node_contactcontroller["Contact requests"]
  node_contactservice["Contact rules<br/>[contact.service.js]"]
  node_convroutes["Conversation routes"]
  node_convcontroller["Conversation API"]
  node_convservice["Conversation logic"]
  node_messageservice["Message logic<br/>[message.service.js]"]
  node_authmiddleware["JWT protection<br/>[auth.middleware.js]"]
end

subgraph group_realtime["Realtime and media"]
  node_realtime["Socket handlers<br/>[chat.socket.js]"]
  node_socketmanager["Socket manager<br/>[socketManager.js]"]
  node_uploads["Image uploads"]
end

subgraph group_persistence["Persistence"]
  node_dbconfig["Prisma connection<br/>[db.js]"]
  node_database[("PostgreSQL")]
end

node_user(("Chat user"))

node_user -->|"uses"| node_webapp
node_user -->|"uses"| node_mobileapp
node_webapp -->|"renders"| node_webdashboard
node_webdashboard -->|"requests"| node_webapi
node_webdashboard -->|"uses"| node_websocket
node_webcall -->|"uses"| node_websocket
node_mobileapp -->|"renders"| node_mobileauth
node_mobileapp -->|"renders"| node_mobiledashboard
node_mobileauth -->|"authenticates"| node_mobileapi
node_mobiledashboard -->|"requests"| node_mobileapi
node_mobiledashboard -->|"uses"| node_mobilesocket
node_mobiledashboard -->|"renders"| node_mobilecall
node_webapi -->|"REST requests"| node_server
node_mobileapi -->|"REST requests"| node_server
node_websocket -->|"connects"| node_realtime
node_mobilesocket -->|"connects"| node_realtime
node_server -->|"configures"| node_routes
node_server -->|"starts"| node_realtime
node_routes -->|"mounts"| node_authroutes
node_authroutes -->|"routes to"| node_authcontroller
node_authcontroller -->|"calls"| node_userdomain
node_routes -->|"mounts"| node_contactroutes
node_contactroutes -->|"routes to"| node_contactcontroller
node_contactcontroller -->|"calls"| node_contactservice
node_contactcontroller -->|"notifies via"| node_socketmanager
node_routes -->|"mounts"| node_convroutes
node_convroutes -->|"routes to"| node_convcontroller
node_convcontroller -->|"calls"| node_convservice
node_convcontroller -->|"broadcasts via"| node_socketmanager
node_contactservice -->|"supports contacts"| node_convservice
node_authroutes -->|"protects"| node_authmiddleware
node_contactroutes -->|"protects"| node_authmiddleware
node_convroutes -->|"protects"| node_authmiddleware
node_contactservice -->|"queries"| node_dbconfig
node_convservice -->|"queries"| node_dbconfig
node_userdomain -->|"queries"| node_dbconfig
node_messageservice -.->|"queries"| node_dbconfig
node_dbconfig -->|"persists through ORM"| node_database
node_routes -->|"mounts upload API"| node_uploads

click node_webapp "https://github.com/ankitaaa29/chat/blob/main/web/src/App.jsx"
click node_webdashboard "https://github.com/ankitaaa29/chat/blob/main/web/src/pages/DashboardPage.jsx"
click node_webapi "https://github.com/ankitaaa29/chat/blob/main/web/src/services/api.js"
click node_websocket "https://github.com/ankitaaa29/chat/blob/main/web/src/services/socket.js"
click node_webcall "https://github.com/ankitaaa29/chat/blob/main/web/src/components/CallModal.jsx"
click node_mobileapp "https://github.com/ankitaaa29/chat/blob/main/mobile/App.js"
click node_mobiledashboard "https://github.com/ankitaaa29/chat/blob/main/mobile/src/screens/DashboardScreen.js"
click node_mobileauth "https://github.com/ankitaaa29/chat/blob/main/mobile/src/screens/LoginScreen.js"
click node_mobileapi "https://github.com/ankitaaa29/chat/blob/main/mobile/src/services/api.js"
click node_mobilesocket "https://github.com/ankitaaa29/chat/blob/main/mobile/src/services/socket.js"
click node_mobilecall "https://github.com/ankitaaa29/chat/blob/main/mobile/src/components/CallModal.js"
click node_server "https://github.com/ankitaaa29/chat/blob/main/backend/src/server.js"
click node_routes "https://github.com/ankitaaa29/chat/blob/main/backend/src/app.js"
click node_authroutes "https://github.com/ankitaaa29/chat/blob/main/backend/src/routes/auth.routes.js"
click node_authcontroller "https://github.com/ankitaaa29/chat/blob/main/backend/src/controllers/auth.controller.js"
click node_userdomain "https://github.com/ankitaaa29/chat/blob/main/backend/src/services/user.service.js"
click node_contactroutes "https://github.com/ankitaaa29/chat/blob/main/backend/src/routes/contact.routes.js"
click node_contactcontroller "https://github.com/ankitaaa29/chat/blob/main/backend/src/controllers/contact.controller.js"
click node_contactservice "https://github.com/ankitaaa29/chat/blob/main/backend/src/services/contact.service.js"
click node_convroutes "https://github.com/ankitaaa29/chat/blob/main/backend/src/routes/conversation.routes.js"
click node_convcontroller "https://github.com/ankitaaa29/chat/blob/main/backend/src/controllers/conversation.controller.js"
click node_convservice "https://github.com/ankitaaa29/chat/blob/main/backend/src/services/conversation.service.js"
click node_messageservice "https://github.com/ankitaaa29/chat/blob/main/backend/src/services/message.service.js"
click node_authmiddleware "https://github.com/ankitaaa29/chat/blob/main/backend/src/middleware/auth.middleware.js"
click node_realtime "https://github.com/ankitaaa29/chat/blob/main/backend/src/sockets/chat.socket.js"
click node_socketmanager "https://github.com/ankitaaa29/chat/blob/main/backend/src/sockets/socketManager.js"
click node_uploads "https://github.com/ankitaaa29/chat/blob/main/backend/src/controllers/upload.controller.js"
click node_dbconfig "https://github.com/ankitaaa29/chat/blob/main/backend/src/config/db.js"

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_webdashboard,node_webapi,node_websocket,node_webcall,node_mobileapp,node_mobiledashboard,node_mobileauth,node_mobileapi,node_mobilesocket,node_mobilecall,node_user toneBlue
class node_server,node_routes,node_authroutes,node_authcontroller,node_userdomain,node_contactroutes,node_contactcontroller,node_contactservice,node_convroutes,node_convcontroller,node_convservice,node_messageservice,node_authmiddleware toneAmber
class node_realtime,node_socketmanager,node_uploads toneMint
class node_dbconfig,node_database toneRose
```

## Components

### Client applications

- [Web app](https://github.com/ankitaaa29/chat/blob/main/web/src/App.jsx): `web/src/App.jsx`
- [Web dashboard](https://github.com/ankitaaa29/chat/blob/main/web/src/pages/DashboardPage.jsx): `web/src/pages/DashboardPage.jsx`
- [Web REST client](https://github.com/ankitaaa29/chat/blob/main/web/src/services/api.js): `web/src/services/api.js`
- [Web socket client](https://github.com/ankitaaa29/chat/blob/main/web/src/services/socket.js): `web/src/services/socket.js`
- [Web calling UI](https://github.com/ankitaaa29/chat/blob/main/web/src/components/CallModal.jsx): `web/src/components/CallModal.jsx`
- [Mobile app](https://github.com/ankitaaa29/chat/blob/main/mobile/App.js): `mobile/App.js`
- [Mobile dashboard](https://github.com/ankitaaa29/chat/blob/main/mobile/src/screens/DashboardScreen.js): `mobile/src/screens/DashboardScreen.js`
- [Mobile login](https://github.com/ankitaaa29/chat/blob/main/mobile/src/screens/LoginScreen.js): `mobile/src/screens/LoginScreen.js`
- [Mobile REST client](https://github.com/ankitaaa29/chat/blob/main/mobile/src/services/api.js): `mobile/src/services/api.js`
- [Mobile socket client](https://github.com/ankitaaa29/chat/blob/main/mobile/src/services/socket.js): `mobile/src/services/socket.js`
- [Mobile calling UI](https://github.com/ankitaaa29/chat/blob/main/mobile/src/components/CallModal.js): `mobile/src/components/CallModal.js`

### HTTP API and domain

- [Express server](https://github.com/ankitaaa29/chat/blob/main/backend/src/server.js): `backend/src/server.js`
- [API routes](https://github.com/ankitaaa29/chat/blob/main/backend/src/app.js): `backend/src/app.js`
- [Auth routes](https://github.com/ankitaaa29/chat/blob/main/backend/src/routes/auth.routes.js): `backend/src/routes/auth.routes.js`
- [Authentication](https://github.com/ankitaaa29/chat/blob/main/backend/src/controllers/auth.controller.js): `backend/src/controllers/auth.controller.js`
- [User accounts](https://github.com/ankitaaa29/chat/blob/main/backend/src/services/user.service.js): `backend/src/services/user.service.js`
- [Contact routes](https://github.com/ankitaaa29/chat/blob/main/backend/src/routes/contact.routes.js): `backend/src/routes/contact.routes.js`
- [Contact requests](https://github.com/ankitaaa29/chat/blob/main/backend/src/controllers/contact.controller.js): `backend/src/controllers/contact.controller.js`
- [Contact rules](https://github.com/ankitaaa29/chat/blob/main/backend/src/services/contact.service.js): `backend/src/services/contact.service.js`
- [Conversation routes](https://github.com/ankitaaa29/chat/blob/main/backend/src/routes/conversation.routes.js): `backend/src/routes/conversation.routes.js`
- [Conversation API](https://github.com/ankitaaa29/chat/blob/main/backend/src/controllers/conversation.controller.js): `backend/src/controllers/conversation.controller.js`
- [Conversation logic](https://github.com/ankitaaa29/chat/blob/main/backend/src/services/conversation.service.js): `backend/src/services/conversation.service.js`
- [Message logic](https://github.com/ankitaaa29/chat/blob/main/backend/src/services/message.service.js): `backend/src/services/message.service.js`
- [JWT protection](https://github.com/ankitaaa29/chat/blob/main/backend/src/middleware/auth.middleware.js): `backend/src/middleware/auth.middleware.js`

### Realtime and media

- [Socket handlers](https://github.com/ankitaaa29/chat/blob/main/backend/src/sockets/chat.socket.js): `backend/src/sockets/chat.socket.js`
- [Socket manager](https://github.com/ankitaaa29/chat/blob/main/backend/src/sockets/socketManager.js): `backend/src/sockets/socketManager.js`
- [Image uploads](https://github.com/ankitaaa29/chat/blob/main/backend/src/controllers/upload.controller.js): `backend/src/controllers/upload.controller.js`

### Persistence

- [Prisma connection](https://github.com/ankitaaa29/chat/blob/main/backend/src/config/db.js): `backend/src/config/db.js`
- **PostgreSQL**

### Other components

- **Chat user**

## Connections

- Chat user → Web app: uses (evidence: `README.md`)
- Chat user → Mobile app: uses (evidence: `README.md`)
- Web app → Web dashboard: renders (evidence: `web/src/App.jsx`)
- Web dashboard → Web REST client: requests (evidence: `web/src/pages/DashboardPage.jsx`)
- Web dashboard → Web socket client: uses (evidence: `web/src/pages/DashboardPage.jsx`)
- Web calling UI → Web socket client: uses (evidence: `web/src/components/CallModal.jsx`)
- Mobile app → Mobile login: renders (evidence: `mobile/App.js`)
- Mobile app → Mobile dashboard: renders (evidence: `mobile/App.js`)
- Mobile login → Mobile REST client: authenticates (evidence: `mobile/src/screens/LoginScreen.js`)
- Mobile dashboard → Mobile REST client: requests (evidence: `mobile/src/screens/DashboardScreen.js`)
- Mobile dashboard → Mobile socket client: uses (evidence: `mobile/src/screens/DashboardScreen.js`)
- Mobile dashboard → Mobile calling UI: renders (evidence: `mobile/src/screens/DashboardScreen.js`)
- Web REST client → Express server: REST requests (evidence: `README.md`)
- Mobile REST client → Express server: REST requests (evidence: `mobile/src/services/api.js`)
- Web socket client → Socket handlers: connects (evidence: `README.md`)
- Mobile socket client → Socket handlers: connects (evidence: `README.md`)
- Express server → API routes: configures (evidence: `backend/src/app.js`)
- Express server → Socket handlers: starts (evidence: `backend/src/server.js`)
- API routes → Auth routes: mounts (evidence: `backend/src/app.js`)
- Auth routes → Authentication: routes to (evidence: `backend/src/routes/auth.routes.js`)
- Authentication → User accounts: calls (evidence: `backend/src/controllers/auth.controller.js`)
- API routes → Contact routes: mounts (evidence: `backend/src/app.js`)
- Contact routes → Contact requests: routes to (evidence: `backend/src/routes/contact.routes.js`)
- Contact requests → Contact rules: calls (evidence: `backend/src/controllers/contact.controller.js`)
- Contact requests → Socket manager: notifies via (evidence: `backend/src/controllers/contact.controller.js`)
- API routes → Conversation routes: mounts (evidence: `backend/src/app.js`)
- Conversation routes → Conversation API: routes to (evidence: `backend/src/routes/conversation.routes.js`)
- Conversation API → Conversation logic: calls (evidence: `backend/src/controllers/conversation.controller.js`)
- Conversation API → Socket manager: broadcasts via (evidence: `backend/src/controllers/conversation.controller.js`)
- Contact rules → Conversation logic: supports contacts (evidence: `backend/src/services/conversation.service.js`)
- Auth routes → JWT protection: protects (evidence: `backend/src/routes/auth.routes.js`)
- Contact routes → JWT protection: protects (evidence: `backend/src/routes/contact.routes.js`)
- Conversation routes → JWT protection: protects (evidence: `backend/src/routes/conversation.routes.js`)
- Contact rules → Prisma connection: queries (evidence: `backend/src/services/contact.service.js`)
- Conversation logic → Prisma connection: queries (evidence: `backend/src/services/conversation.service.js`)
- User accounts → Prisma connection: queries (evidence: `backend/src/services/user.service.js`)
- Message logic → Prisma connection: queries
- Prisma connection → PostgreSQL: persists through ORM (evidence: `README.md`)
- API routes → Image uploads: mounts upload API (evidence: `backend/src/app.js`)
