# abdusaid/fullstack-chat-app architecture

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

- Interactive diagram: https://gitdiagram.com/abdusaid/fullstack-chat-app
- Repository: https://github.com/abdusaid/fullstack-chat-app

## Overview

This is a fullstack real-time chat application. Users sign up or log in, select another user, exchange text or image messages, and see online presence; profile-image uploads and theme settings are additional capabilities. The React client uses Zustand stores and HTTP requests, while the Express backend routes requests through controllers and persists users and messages in MongoDB. Socket.IO distributes presence and incoming messages. The graph follows documented capabilities and indexed source references; links without direct wiring evidence are omitted.

Main entry points: [`frontend/src/App.jsx`](https://github.com/abdusaid/fullstack-chat-app/blob/main/frontend/src/App.jsx) (App and routes), [`frontend/src/store/useAuthStore.js`](https://github.com/abdusaid/fullstack-chat-app/blob/main/frontend/src/store/useAuthStore.js) (Auth and presence state), [`backend/src/controllers/message.controller.js`](https://github.com/abdusaid/fullstack-chat-app/blob/main/backend/src/controllers/message.controller.js) (Message operations), [`frontend/src/store/useChatStore.js`](https://github.com/abdusaid/fullstack-chat-app/blob/main/frontend/src/store/useChatStore.js) (Chat state)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Chat client"]
  node_app["App and routes<br/>[App.jsx]"]
  node_authpages["Sign-in and signup"]
  node_home["Chat home<br/>[HomePage.jsx]"]
  node_profile["Profile page<br/>[ProfilePage.jsx]"]
  node_settings["Theme settings<br/>[SettingsPage.jsx]"]
  node_chatui["Conversation UI<br/>[ChatContainer.jsx]"]
  node_sidebar["User sidebar<br/>[Sidebar.jsx]"]
  node_authstore["Auth and presence state<br/>[useAuthStore.js]"]
  node_chatstore["Chat state<br/>[useChatStore.js]"]
  node_themestore["Theme state<br/>[useThemeStore.js]"]
end

subgraph group_api["HTTP backend"]
  node_authroutes["Auth routes<br/>[auth.route.js]"]
  node_messageroutes["Message routes<br/>[message.route.js]"]
  node_authcontroller["Authentication and profile<br/>[auth.controller.js]"]
  node_messagecontroller["Message operations"]
  node_authmiddleware["JWT protection<br/>[auth.middleware.js]"]
  node_server["Server assembly<br/>[index.js]"]
end

subgraph group_realtime["Realtime messaging"]
  node_socket["Socket presence and delivery<br/>[socket.js]"]
end

subgraph group_data["Persistence and media"]
  node_users[("User records<br/>[user.model.js]")]
  node_messages[("Message records<br/>[message.model.js]")]
end

node_person(("Chat user"))
node_mongo[("MongoDB")]
node_cloudinary["Cloudinary uploads"]

node_person -->|"uses"| node_app
node_app -->|"checks auth"| node_authstore
node_app -->|"routes to"| node_authpages
node_app -->|"routes to"| node_home
node_app -->|"routes to"| node_profile
node_app -->|"routes to"| node_settings
node_authpages -->|"submits auth"| node_authstore
node_home -->|"loads chat state"| node_chatstore
node_home -->|"renders"| node_sidebar
node_home -->|"renders"| node_chatui
node_profile -->|"updates profile"| node_authstore
node_settings -->|"sets theme"| node_themestore
node_chatui -->|"loads and sends"| node_chatstore
node_sidebar -->|"selects users"| node_chatstore
node_authstore -.->|"requests auth"| node_authroutes
node_chatstore -.->|"requests messages"| node_messageroutes
node_server -->|"registers"| node_authroutes
node_server -->|"registers"| node_messageroutes
node_server -->|"uses server"| node_socket
node_authroutes -->|"dispatches"| node_authcontroller
node_authroutes -->|"protects routes"| node_authmiddleware
node_messageroutes -->|"dispatches"| node_messagecontroller
node_messageroutes -->|"protects routes"| node_authmiddleware
node_authmiddleware -->|"loads user"| node_users
node_authcontroller -->|"reads and writes"| node_users
node_authcontroller -->|"uploads profile"| node_cloudinary
node_messagecontroller -->|"reads users"| node_users
node_messagecontroller -->|"reads and writes"| node_messages
node_messagecontroller -->|"uploads images"| node_cloudinary
node_messagecontroller -->|"delivers messages"| node_socket
node_authstore -->|"connects presence"| node_socket
node_chatstore -->|"uses socket"| node_authstore
node_users -.->|"persists in"| node_mongo
node_messages -.->|"persists in"| node_mongo

click node_app "https://github.com/abdusaid/fullstack-chat-app/blob/main/frontend/src/App.jsx"
click node_authpages "https://github.com/abdusaid/fullstack-chat-app/tree/main/frontend/src/pages"
click node_home "https://github.com/abdusaid/fullstack-chat-app/blob/main/frontend/src/pages/HomePage.jsx"
click node_profile "https://github.com/abdusaid/fullstack-chat-app/blob/main/frontend/src/pages/ProfilePage.jsx"
click node_settings "https://github.com/abdusaid/fullstack-chat-app/blob/main/frontend/src/pages/SettingsPage.jsx"
click node_chatui "https://github.com/abdusaid/fullstack-chat-app/blob/main/frontend/src/components/ChatContainer.jsx"
click node_sidebar "https://github.com/abdusaid/fullstack-chat-app/blob/main/frontend/src/components/Sidebar.jsx"
click node_authstore "https://github.com/abdusaid/fullstack-chat-app/blob/main/frontend/src/store/useAuthStore.js"
click node_chatstore "https://github.com/abdusaid/fullstack-chat-app/blob/main/frontend/src/store/useChatStore.js"
click node_themestore "https://github.com/abdusaid/fullstack-chat-app/blob/main/frontend/src/store/useThemeStore.js"
click node_authroutes "https://github.com/abdusaid/fullstack-chat-app/blob/main/backend/src/routes/auth.route.js"
click node_messageroutes "https://github.com/abdusaid/fullstack-chat-app/blob/main/backend/src/routes/message.route.js"
click node_authcontroller "https://github.com/abdusaid/fullstack-chat-app/blob/main/backend/src/controllers/auth.controller.js"
click node_messagecontroller "https://github.com/abdusaid/fullstack-chat-app/blob/main/backend/src/controllers/message.controller.js"
click node_authmiddleware "https://github.com/abdusaid/fullstack-chat-app/blob/main/backend/src/middleware/auth.middleware.js"
click node_server "https://github.com/abdusaid/fullstack-chat-app/blob/main/backend/src/index.js"
click node_socket "https://github.com/abdusaid/fullstack-chat-app/blob/main/backend/src/lib/socket.js"
click node_users "https://github.com/abdusaid/fullstack-chat-app/blob/main/backend/src/models/user.model.js"
click node_messages "https://github.com/abdusaid/fullstack-chat-app/blob/main/backend/src/models/message.model.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_app,node_authpages,node_home,node_profile,node_settings,node_chatui,node_sidebar,node_authstore,node_chatstore,node_themestore,node_person toneBlue
class node_authroutes,node_messageroutes,node_authcontroller,node_messagecontroller,node_authmiddleware,node_server,node_mongo toneAmber
class node_socket toneMint
class node_users,node_messages toneRose
class node_cloudinary toneIndigo
```

## Components

### Chat client

- [App and routes](https://github.com/abdusaid/fullstack-chat-app/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Sign-in and signup](https://github.com/abdusaid/fullstack-chat-app/tree/main/frontend/src/pages): `frontend/src/pages`
- [Chat home](https://github.com/abdusaid/fullstack-chat-app/blob/main/frontend/src/pages/HomePage.jsx): `frontend/src/pages/HomePage.jsx`
- [Profile page](https://github.com/abdusaid/fullstack-chat-app/blob/main/frontend/src/pages/ProfilePage.jsx): `frontend/src/pages/ProfilePage.jsx`
- [Theme settings](https://github.com/abdusaid/fullstack-chat-app/blob/main/frontend/src/pages/SettingsPage.jsx): `frontend/src/pages/SettingsPage.jsx`
- [Conversation UI](https://github.com/abdusaid/fullstack-chat-app/blob/main/frontend/src/components/ChatContainer.jsx): `frontend/src/components/ChatContainer.jsx`
- [User sidebar](https://github.com/abdusaid/fullstack-chat-app/blob/main/frontend/src/components/Sidebar.jsx): `frontend/src/components/Sidebar.jsx`
- [Auth and presence state](https://github.com/abdusaid/fullstack-chat-app/blob/main/frontend/src/store/useAuthStore.js): `frontend/src/store/useAuthStore.js`
- [Chat state](https://github.com/abdusaid/fullstack-chat-app/blob/main/frontend/src/store/useChatStore.js): `frontend/src/store/useChatStore.js`
- [Theme state](https://github.com/abdusaid/fullstack-chat-app/blob/main/frontend/src/store/useThemeStore.js): `frontend/src/store/useThemeStore.js`

### HTTP backend

- [Auth routes](https://github.com/abdusaid/fullstack-chat-app/blob/main/backend/src/routes/auth.route.js): `backend/src/routes/auth.route.js`
- [Message routes](https://github.com/abdusaid/fullstack-chat-app/blob/main/backend/src/routes/message.route.js): `backend/src/routes/message.route.js`
- [Authentication and profile](https://github.com/abdusaid/fullstack-chat-app/blob/main/backend/src/controllers/auth.controller.js): `backend/src/controllers/auth.controller.js`
- [Message operations](https://github.com/abdusaid/fullstack-chat-app/blob/main/backend/src/controllers/message.controller.js): `backend/src/controllers/message.controller.js`
- [JWT protection](https://github.com/abdusaid/fullstack-chat-app/blob/main/backend/src/middleware/auth.middleware.js): `backend/src/middleware/auth.middleware.js`
- [Server assembly](https://github.com/abdusaid/fullstack-chat-app/blob/main/backend/src/index.js): `backend/src/index.js`

### Realtime messaging

- [Socket presence and delivery](https://github.com/abdusaid/fullstack-chat-app/blob/main/backend/src/lib/socket.js): `backend/src/lib/socket.js`

### Persistence and media

- [User records](https://github.com/abdusaid/fullstack-chat-app/blob/main/backend/src/models/user.model.js): `backend/src/models/user.model.js`
- [Message records](https://github.com/abdusaid/fullstack-chat-app/blob/main/backend/src/models/message.model.js): `backend/src/models/message.model.js`

### Other components

- **Chat user**
- **MongoDB**
- **Cloudinary uploads**

## Connections

- Chat user → App and routes: uses (evidence: `README.md`)
- App and routes → Auth and presence state: checks auth (evidence: `frontend/src/App.jsx`)
- App and routes → Sign-in and signup: routes to (evidence: `frontend/src/App.jsx`)
- App and routes → Chat home: routes to (evidence: `frontend/src/App.jsx`)
- App and routes → Profile page: routes to (evidence: `frontend/src/App.jsx`)
- App and routes → Theme settings: routes to (evidence: `frontend/src/App.jsx`)
- Sign-in and signup → Auth and presence state: submits auth (evidence: `frontend/src/pages/SignUpPage.jsx`)
- Chat home → Chat state: loads chat state (evidence: `frontend/src/pages/HomePage.jsx`)
- Chat home → User sidebar: renders (evidence: `frontend/src/pages/HomePage.jsx`)
- Chat home → Conversation UI: renders (evidence: `frontend/src/pages/HomePage.jsx`)
- Profile page → Auth and presence state: updates profile (evidence: `frontend/src/pages/ProfilePage.jsx`)
- Theme settings → Theme state: sets theme (evidence: `frontend/src/pages/SettingsPage.jsx`)
- Conversation UI → Chat state: loads and sends (evidence: `frontend/src/components/ChatContainer.jsx`)
- User sidebar → Chat state: selects users (evidence: `frontend/src/components/Sidebar.jsx`)
- Auth and presence state → Auth routes: requests auth
- Chat state → Message routes: requests messages
- Server assembly → Auth routes: registers (evidence: `backend/src/index.js`)
- Server assembly → Message routes: registers (evidence: `backend/src/index.js`)
- Server assembly → Socket presence and delivery: uses server (evidence: `backend/src/index.js`)
- Auth routes → Authentication and profile: dispatches (evidence: `backend/src/routes/auth.route.js`)
- Auth routes → JWT protection: protects routes (evidence: `backend/src/routes/auth.route.js`)
- Message routes → Message operations: dispatches (evidence: `backend/src/routes/message.route.js`)
- Message routes → JWT protection: protects routes (evidence: `backend/src/routes/message.route.js`)
- JWT protection → User records: loads user (evidence: `backend/src/middleware/auth.middleware.js`)
- Authentication and profile → User records: reads and writes (evidence: `backend/src/controllers/auth.controller.js`)
- Authentication and profile → Cloudinary uploads: uploads profile (evidence: `backend/src/controllers/auth.controller.js`)
- Message operations → User records: reads users (evidence: `backend/src/controllers/message.controller.js`)
- Message operations → Message records: reads and writes (evidence: `backend/src/controllers/message.controller.js`)
- Message operations → Cloudinary uploads: uploads images (evidence: `backend/src/controllers/message.controller.js`)
- Message operations → Socket presence and delivery: delivers messages (evidence: `backend/src/controllers/message.controller.js`)
- Auth and presence state → Socket presence and delivery: connects presence (evidence: `frontend/src/store/useAuthStore.js`)
- Chat state → Auth and presence state: uses socket (evidence: `frontend/src/store/useChatStore.js`)
- User records → MongoDB: persists in
- Message records → MongoDB: persists in
