# sandhyaparashar/chatifyy architecture

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

- Interactive diagram: https://gitdiagram.com/sandhyaparashar/chatifyy
- Repository: https://github.com/sandhyaparashar/chatifyy

## Overview

Chatify is a web chat application. A user signs up or logs in, the frontend checks authentication and opens the chat workspace; users can browse contacts and chat partners, and the backend provides message and profile operations. The backend also handles session protection, profile/message image uploads, welcome email, and request protection. The graph separates frontend experience and state from backend API, identity, and integrations. Several UI and backend connections are supported only by the source index; unsampled implementations and live message delivery are not inferred.

Main entry points: [`frontend/src/App.jsx`](https://github.com/sandhyaparashar/chatifyy/blob/main/frontend/src/App.jsx) (App routing), [`frontend/src/pages/chatpage.jsx`](https://github.com/sandhyaparashar/chatifyy/blob/main/frontend/src/pages/chatpage.jsx) (Chat workspace), [`frontend/src/store/useAuthStore.js`](https://github.com/sandhyaparashar/chatifyy/blob/main/frontend/src/store/useAuthStore.js) (Auth state), [`backened/src/main.js`](https://github.com/sandhyaparashar/chatifyy/blob/main/backened/src/main.js) (API server)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Frontend experience"]
  node_app["App routing<br/>[App.jsx]"]
  node_login["Login page<br/>[Login.jsx]"]
  node_signup["Signup page<br/>[Sign.jsx]"]
  node_chatpage["Chat workspace<br/>[chatpage.jsx]"]
  node_chatlist["Chat list<br/>[ChatList.jsx]"]
  node_contacts["Contact list<br/>[ContactList.jsx]"]
  node_profile["Profile header<br/>[ProfileHeader.jsx]"]
  node_chatcontainer["Conversation view<br/>[ChatContainer.jsx]"]
  node_authstore["Auth state<br/>[useAuthStore.js]"]
  node_chatstore["Chat state<br/>[useChatStore.js]"]
  node_socketstore["Socket state<br/>[useSocketStore.js]"]
  node_http["HTTP client<br/>[axios.js]"]
end

subgraph group_backend["Backend API"]
  node_server["API server<br/>[main.js]"]
  node_authroutes["Auth routes<br/>[auth.route.js]"]
  node_messageroutes["Message routes<br/>[message.route.js]"]
  node_authcontroller["Auth operations<br/>[auth.controller.js]"]
  node_messagecontroller["Message operations"]
  node_socketserver["Socket server<br/>[socket.js]"]
end

subgraph group_identity["Identity and data"]
  node_authmiddleware["Session guard<br/>[auth.middleware.js]"]
  node_arcmiddleware["Request protection<br/>[arc.middleware.js]"]
  node_userdb[("User records<br/>[User.js]")]
  node_messagedb[("Message records<br/>[message.js]")]
  node_dbconnect["Database connection<br/>[db.js]"]
  node_env["Environment config<br/>[env.js]"]
end

subgraph group_integrations["External integrations"]
  node_arcjet["Arcjet client<br/>[arcjet.js]"]
  node_cloudinary["Image hosting<br/>[cloudinary.js]"]
  node_welcome["Welcome email<br/>[emailHandler.js]"]
  node_emailtemplate["Email template<br/>[emailTemplate.js]"]
  node_resend["Resend client<br/>[resend.js]"]
end

node_user(("Chat user"))

node_user -->|"uses"| node_app
node_app -->|"checks auth"| node_authstore
node_app -->|"connects socket"| node_socketstore
node_app -->|"routes to"| node_login
node_app -->|"routes to"| node_signup
node_app -->|"routes to"| node_chatpage
node_login -->|"submits login"| node_authstore
node_signup -->|"submits signup"| node_authstore
node_chatpage -->|"reads state"| node_chatstore
node_chatpage -->|"renders"| node_profile
node_chatpage -->|"renders"| node_chatlist
node_chatpage -->|"renders"| node_contacts
node_chatpage -->|"renders"| node_chatcontainer
node_chatlist -->|"reads state"| node_chatstore
node_contacts -->|"reads state"| node_chatstore
node_profile -->|"reads state"| node_authstore
node_profile -->|"reads state"| node_chatstore
node_authstore -->|"sends requests"| node_http
node_chatstore -->|"sends requests"| node_http
node_socketstore -->|"reads identity"| node_authstore
node_http -.->|"calls API"| node_server
node_server -->|"mounts routes"| node_authroutes
node_server -->|"mounts routes"| node_messageroutes
node_server -->|"connects database"| node_dbconnect
node_authroutes -->|"dispatches"| node_authcontroller
node_authroutes -->|"guards profile"| node_authmiddleware
node_authroutes -->|"applies protection"| node_arcmiddleware
node_messageroutes -->|"dispatches"| node_messagecontroller
node_messageroutes -->|"guards routes"| node_authmiddleware
node_messageroutes -->|"applies protection"| node_arcmiddleware
node_authcontroller -->|"reads and writes"| node_userdb
node_authcontroller -->|"uploads profile"| node_cloudinary
node_authcontroller -->|"sends welcome"| node_welcome
node_welcome -->|"sends email"| node_resend
node_welcome -->|"renders"| node_emailtemplate
node_messagecontroller -->|"looks up users"| node_userdb
node_messagecontroller -->|"reads and writes"| node_messagedb
node_messagecontroller -->|"uploads images"| node_cloudinary
node_authmiddleware -->|"loads session user"| node_userdb
node_arcmiddleware -->|"checks requests"| node_arcjet
node_dbconnect -.->|"uses database"| node_userdb
node_dbconnect -.->|"uses database"| node_messagedb
node_server -->|"uses server"| node_socketserver
node_socketstore -.->|"opens socket"| node_socketserver
node_env -->|"configures"| node_arcjet
node_env -->|"configures"| node_cloudinary
node_env -->|"configures"| node_resend

click node_app "https://github.com/sandhyaparashar/chatifyy/blob/main/frontend/src/App.jsx"
click node_login "https://github.com/sandhyaparashar/chatifyy/blob/main/frontend/src/pages/Login.jsx"
click node_signup "https://github.com/sandhyaparashar/chatifyy/blob/main/frontend/src/pages/Sign.jsx"
click node_chatpage "https://github.com/sandhyaparashar/chatifyy/blob/main/frontend/src/pages/chatpage.jsx"
click node_chatlist "https://github.com/sandhyaparashar/chatifyy/blob/main/frontend/src/components/ChatList.jsx"
click node_contacts "https://github.com/sandhyaparashar/chatifyy/blob/main/frontend/src/components/ContactList.jsx"
click node_profile "https://github.com/sandhyaparashar/chatifyy/blob/main/frontend/src/components/ProfileHeader.jsx"
click node_chatcontainer "https://github.com/sandhyaparashar/chatifyy/blob/main/frontend/src/components/ChatContainer.jsx"
click node_authstore "https://github.com/sandhyaparashar/chatifyy/blob/main/frontend/src/store/useAuthStore.js"
click node_chatstore "https://github.com/sandhyaparashar/chatifyy/blob/main/frontend/src/store/useChatStore.js"
click node_socketstore "https://github.com/sandhyaparashar/chatifyy/blob/main/frontend/src/store/useSocketStore.js"
click node_http "https://github.com/sandhyaparashar/chatifyy/blob/main/frontend/src/lib/axios.js"
click node_server "https://github.com/sandhyaparashar/chatifyy/blob/main/backened/src/main.js"
click node_authroutes "https://github.com/sandhyaparashar/chatifyy/blob/main/backened/src/routes/auth.route.js"
click node_messageroutes "https://github.com/sandhyaparashar/chatifyy/blob/main/backened/src/routes/message.route.js"
click node_authcontroller "https://github.com/sandhyaparashar/chatifyy/blob/main/backened/src/controllers/auth.controller.js"
click node_messagecontroller "https://github.com/sandhyaparashar/chatifyy/blob/main/backened/src/controllers/message.controller.js"
click node_authmiddleware "https://github.com/sandhyaparashar/chatifyy/blob/main/backened/src/middleware/auth.middleware.js"
click node_arcmiddleware "https://github.com/sandhyaparashar/chatifyy/blob/main/backened/src/middleware/arc.middleware.js"
click node_userdb "https://github.com/sandhyaparashar/chatifyy/blob/main/backened/src/models/User.js"
click node_messagedb "https://github.com/sandhyaparashar/chatifyy/blob/main/backened/src/models/message.js"
click node_dbconnect "https://github.com/sandhyaparashar/chatifyy/blob/main/backened/src/lib/db.js"
click node_env "https://github.com/sandhyaparashar/chatifyy/blob/main/backened/src/lib/env.js"
click node_arcjet "https://github.com/sandhyaparashar/chatifyy/blob/main/backened/src/lib/arcjet.js"
click node_cloudinary "https://github.com/sandhyaparashar/chatifyy/blob/main/backened/src/lib/cloudinary.js"
click node_welcome "https://github.com/sandhyaparashar/chatifyy/blob/main/backened/src/email/emailHandler.js"
click node_emailtemplate "https://github.com/sandhyaparashar/chatifyy/blob/main/backened/src/email/emailTemplate.js"
click node_resend "https://github.com/sandhyaparashar/chatifyy/blob/main/backened/src/lib/resend.js"
click node_socketserver "https://github.com/sandhyaparashar/chatifyy/blob/main/backened/socket/socket.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_login,node_signup,node_chatpage,node_chatlist,node_contacts,node_profile,node_chatcontainer,node_authstore,node_chatstore,node_socketstore,node_http,node_user toneBlue
class node_server,node_authroutes,node_messageroutes,node_authcontroller,node_messagecontroller,node_socketserver toneAmber
class node_authmiddleware,node_arcmiddleware,node_userdb,node_messagedb,node_dbconnect,node_env toneMint
class node_arcjet,node_cloudinary,node_welcome,node_emailtemplate,node_resend toneRose
```

## Components

### Frontend experience

- [App routing](https://github.com/sandhyaparashar/chatifyy/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Login page](https://github.com/sandhyaparashar/chatifyy/blob/main/frontend/src/pages/Login.jsx): `frontend/src/pages/Login.jsx`
- [Signup page](https://github.com/sandhyaparashar/chatifyy/blob/main/frontend/src/pages/Sign.jsx): `frontend/src/pages/Sign.jsx`
- [Chat workspace](https://github.com/sandhyaparashar/chatifyy/blob/main/frontend/src/pages/chatpage.jsx): `frontend/src/pages/chatpage.jsx`
- [Chat list](https://github.com/sandhyaparashar/chatifyy/blob/main/frontend/src/components/ChatList.jsx): `frontend/src/components/ChatList.jsx`
- [Contact list](https://github.com/sandhyaparashar/chatifyy/blob/main/frontend/src/components/ContactList.jsx): `frontend/src/components/ContactList.jsx`
- [Profile header](https://github.com/sandhyaparashar/chatifyy/blob/main/frontend/src/components/ProfileHeader.jsx): `frontend/src/components/ProfileHeader.jsx`
- [Conversation view](https://github.com/sandhyaparashar/chatifyy/blob/main/frontend/src/components/ChatContainer.jsx): `frontend/src/components/ChatContainer.jsx`
- [Auth state](https://github.com/sandhyaparashar/chatifyy/blob/main/frontend/src/store/useAuthStore.js): `frontend/src/store/useAuthStore.js`
- [Chat state](https://github.com/sandhyaparashar/chatifyy/blob/main/frontend/src/store/useChatStore.js): `frontend/src/store/useChatStore.js`
- [Socket state](https://github.com/sandhyaparashar/chatifyy/blob/main/frontend/src/store/useSocketStore.js): `frontend/src/store/useSocketStore.js`
- [HTTP client](https://github.com/sandhyaparashar/chatifyy/blob/main/frontend/src/lib/axios.js): `frontend/src/lib/axios.js`

### Backend API

- [API server](https://github.com/sandhyaparashar/chatifyy/blob/main/backened/src/main.js): `backened/src/main.js`
- [Auth routes](https://github.com/sandhyaparashar/chatifyy/blob/main/backened/src/routes/auth.route.js): `backened/src/routes/auth.route.js`
- [Message routes](https://github.com/sandhyaparashar/chatifyy/blob/main/backened/src/routes/message.route.js): `backened/src/routes/message.route.js`
- [Auth operations](https://github.com/sandhyaparashar/chatifyy/blob/main/backened/src/controllers/auth.controller.js): `backened/src/controllers/auth.controller.js`
- [Message operations](https://github.com/sandhyaparashar/chatifyy/blob/main/backened/src/controllers/message.controller.js): `backened/src/controllers/message.controller.js`
- [Socket server](https://github.com/sandhyaparashar/chatifyy/blob/main/backened/socket/socket.js): `backened/socket/socket.js`

### Identity and data

- [Session guard](https://github.com/sandhyaparashar/chatifyy/blob/main/backened/src/middleware/auth.middleware.js): `backened/src/middleware/auth.middleware.js`
- [Request protection](https://github.com/sandhyaparashar/chatifyy/blob/main/backened/src/middleware/arc.middleware.js): `backened/src/middleware/arc.middleware.js`
- [User records](https://github.com/sandhyaparashar/chatifyy/blob/main/backened/src/models/User.js): `backened/src/models/User.js`
- [Message records](https://github.com/sandhyaparashar/chatifyy/blob/main/backened/src/models/message.js): `backened/src/models/message.js`
- [Database connection](https://github.com/sandhyaparashar/chatifyy/blob/main/backened/src/lib/db.js): `backened/src/lib/db.js`
- [Environment config](https://github.com/sandhyaparashar/chatifyy/blob/main/backened/src/lib/env.js): `backened/src/lib/env.js`

### External integrations

- [Arcjet client](https://github.com/sandhyaparashar/chatifyy/blob/main/backened/src/lib/arcjet.js): `backened/src/lib/arcjet.js`
- [Image hosting](https://github.com/sandhyaparashar/chatifyy/blob/main/backened/src/lib/cloudinary.js): `backened/src/lib/cloudinary.js`
- [Welcome email](https://github.com/sandhyaparashar/chatifyy/blob/main/backened/src/email/emailHandler.js): `backened/src/email/emailHandler.js`
- [Email template](https://github.com/sandhyaparashar/chatifyy/blob/main/backened/src/email/emailTemplate.js): `backened/src/email/emailTemplate.js`
- [Resend client](https://github.com/sandhyaparashar/chatifyy/blob/main/backened/src/lib/resend.js): `backened/src/lib/resend.js`

### Other components

- **Chat user**

## Connections

- Chat user → App routing: uses
- App routing → Auth state: checks auth (evidence: `frontend/src/App.jsx`)
- App routing → Socket state: connects socket (evidence: `frontend/src/App.jsx`)
- App routing → Login page: routes to (evidence: `frontend/src/App.jsx`)
- App routing → Signup page: routes to (evidence: `frontend/src/App.jsx`)
- App routing → Chat workspace: routes to (evidence: `frontend/src/App.jsx`)
- Login page → Auth state: submits login (evidence: `frontend/src/pages/Login.jsx`)
- Signup page → Auth state: submits signup (evidence: `frontend/src/pages/Sign.jsx`)
- Chat workspace → Chat state: reads state (evidence: `frontend/src/pages/chatpage.jsx`)
- Chat workspace → Profile header: renders (evidence: `frontend/src/pages/chatpage.jsx`)
- Chat workspace → Chat list: renders (evidence: `frontend/src/pages/chatpage.jsx`)
- Chat workspace → Contact list: renders (evidence: `frontend/src/pages/chatpage.jsx`)
- Chat workspace → Conversation view: renders (evidence: `frontend/src/pages/chatpage.jsx`)
- Chat list → Chat state: reads state (evidence: `frontend/src/components/ChatList.jsx`)
- Contact list → Chat state: reads state (evidence: `frontend/src/components/ContactList.jsx`)
- Profile header → Auth state: reads state (evidence: `frontend/src/components/ProfileHeader.jsx`)
- Profile header → Chat state: reads state (evidence: `frontend/src/components/ProfileHeader.jsx`)
- Auth state → HTTP client: sends requests (evidence: `frontend/src/store/useAuthStore.js`)
- Chat state → HTTP client: sends requests (evidence: `frontend/src/store/useChatStore.js`)
- Socket state → Auth state: reads identity (evidence: `frontend/src/store/useSocketStore.js`)
- HTTP client → API server: calls API
- API server → Auth routes: mounts routes (evidence: `backened/src/main.js`)
- API server → Message routes: mounts routes (evidence: `backened/src/main.js`)
- API server → Database connection: connects database (evidence: `backened/src/main.js`)
- Auth routes → Auth operations: dispatches (evidence: `backened/src/routes/auth.route.js`)
- Auth routes → Session guard: guards profile (evidence: `backened/src/routes/auth.route.js`)
- Auth routes → Request protection: applies protection (evidence: `backened/src/routes/auth.route.js`)
- Message routes → Message operations: dispatches (evidence: `backened/src/routes/message.route.js`)
- Message routes → Session guard: guards routes (evidence: `backened/src/routes/message.route.js`)
- Message routes → Request protection: applies protection (evidence: `backened/src/routes/message.route.js`)
- Auth operations → User records: reads and writes (evidence: `backened/src/controllers/auth.controller.js`)
- Auth operations → Image hosting: uploads profile (evidence: `backened/src/controllers/auth.controller.js`)
- Auth operations → Welcome email: sends welcome (evidence: `backened/src/controllers/auth.controller.js`)
- Welcome email → Resend client: sends email (evidence: `backened/src/email/emailHandler.js`)
- Welcome email → Email template: renders (evidence: `backened/src/email/emailHandler.js`)
- Message operations → User records: looks up users (evidence: `backened/src/controllers/message.controller.js`)
- Message operations → Message records: reads and writes (evidence: `backened/src/controllers/message.controller.js`)
- Message operations → Image hosting: uploads images (evidence: `backened/src/controllers/message.controller.js`)
- Session guard → User records: loads session user (evidence: `backened/src/middleware/auth.middleware.js`)
- Request protection → Arcjet client: checks requests (evidence: `backened/src/middleware/arc.middleware.js`)
- Database connection → User records: uses database
- Database connection → Message records: uses database
- API server → Socket server: uses server (evidence: `backened/src/main.js`)
- Socket state → Socket server: opens socket
- Environment config → Arcjet client: configures (evidence: `backened/src/lib/arcjet.js`)
- Environment config → Image hosting: configures (evidence: `backened/src/lib/cloudinary.js`)
- Environment config → Resend client: configures (evidence: `backened/src/lib/resend.js`)
