# balavignesh-j/bolt architecture

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

- Interactive diagram: https://gitdiagram.com/balavignesh-j/bolt
- Repository: https://github.com/balavignesh-j/bolt

## Overview

Bolt Social is a MERN social network: users enter through Clerk-backed client sessions, browse feeds/profiles and connections, share posts and stories, and exchange messages or chat with the AI assistant. The React app routes these journeys and uses Redux/Axios for API state; Express routes requests to domain controllers, which persist MongoDB data and call media, AI, and background services. The graph preserves the documented major branches. Some UI and server modules were not sampled, so their internal links are included only where the README or SOURCE INDEX supports them.

Main entry points: [`Client/src/App.jsx`](https://github.com/balavignesh-j/bolt/blob/main/Client/src/App.jsx) (App routing), [`Client/src/api/axios.js`](https://github.com/balavignesh-j/bolt/blob/main/Client/src/api/axios.js) (Axios API client), [`server/server.js`](https://github.com/balavignesh-j/bolt/blob/main/server/server.js) (Express application), [`Client/src/app/store.js`](https://github.com/balavignesh-j/bolt/blob/main/Client/src/app/store.js) (Redux store)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Client experience"]
  node_app["App routing<br/>[App.jsx]"]
  node_api["Axios API client<br/>[axios.js]"]
  node_store["Redux store<br/>[store.js]"]
  node_userstate["User state<br/>[userSlice.js]"]
  node_connectionstate["Connection state"]
  node_messagestate["Message state<br/>[messagesSlice.js]"]
  node_aistate["AI chat state<br/>[aiChatSlice.js]"]
end

subgraph group_social["Social content"]
  node_feed["Feed and stories<br/>[Feed.jsx]"]
  node_discover["Discover users<br/>[Discover.jsx]"]
  node_connectionsui["Connections UI<br/>[Connections.jsx]"]
  node_profile["Profiles<br/>[Profile.jsx]"]
  node_createpost["Create post<br/>[CreatePost.jsx]"]
  node_posts["Post controller<br/>[postController.js]"]
  node_stories["Story controller<br/>[storyController.js]"]
end

subgraph group_communication["Communication"]
  node_messageui["Messages and chat<br/>[Messages.jsx]"]
  node_chatbox["Direct chat<br/>[ChatBox.jsx]"]
  node_aichat["AI assistant UI<br/>[AiChatBox.jsx]"]
  node_messagecontroller["Message controller"]
  node_chatroute["AI chat endpoint<br/>[chatRoutes.js]"]
end

subgraph group_server["API and identity"]
  node_server["Express application<br/>[server.js]"]
  node_userroutes["User routes<br/>[userRoutes.js]"]
  node_postroutes["Post routes<br/>[postRoutes.js]"]
  node_storyroutes["Story routes<br/>[storyRoutes.js]"]
  node_messageroutes["Message routes<br/>[messageRoutes.js]"]
  node_users["User controller<br/>[userController.js]"]
  node_auth["Auth middleware<br/>[auth.js]"]
end

subgraph group_platform["Data and services"]
  node_postmodel[("Post records<br/>[Post.js]")]
  node_storymodel[("Story records<br/>[Story.js]")]
  node_messagemodel[("Message records<br/>[Message.js]")]
  node_groq{{"Groq AI"}}
  node_userrecords[("User records<br/>[User.js]")]
  node_connectionsrecords[("Connection records<br/>[Connections.js]")]
  node_imagekit{{"ImageKit media<br/>[imageKit.js]"}}
end

node_user(("Social user"))

node_user -->|"uses"| node_app
node_app -->|"routes to"| node_feed
node_app -->|"routes to"| node_messageui
node_app -->|"routes to"| node_chatbox
node_app -->|"routes to"| node_aichat
node_app -->|"routes to"| node_connectionsui
node_app -->|"routes to"| node_discover
node_app -->|"routes to"| node_profile
node_app -->|"routes to"| node_createpost
node_app -->|"dispatches"| node_userstate
node_app -->|"dispatches"| node_connectionstate
node_app -->|"dispatches"| node_messagestate
node_store -->|"registers"| node_userstate
node_store -->|"registers"| node_connectionstate
node_store -->|"registers"| node_messagestate
node_store -->|"registers"| node_aistate
node_userstate -->|"requests"| node_api
node_connectionstate -->|"requests"| node_api
node_messagestate -->|"requests"| node_api
node_feed -->|"fetches feed"| node_api
node_discover -->|"searches users"| node_api
node_connectionsui -->|"requests connections"| node_api
node_profile -->|"fetches profile"| node_api
node_createpost -->|"submits post"| node_api
node_chatbox -->|"loads conversation"| node_api
node_aichat -->|"sends history"| node_api
node_aichat -->|"updates chat"| node_aistate
node_api -->|"REST requests"| node_server
node_server -->|"mounts routes"| node_userroutes
node_server -->|"mounts routes"| node_postroutes
node_server -->|"mounts routes"| node_storyroutes
node_server -->|"mounts routes"| node_messageroutes
node_server -->|"mounts routes"| node_chatroute
node_userroutes -->|"dispatches"| node_users
node_postroutes -->|"dispatches"| node_posts
node_storyroutes -->|"dispatches"| node_stories
node_messageroutes -->|"dispatches"| node_messagecontroller
node_userroutes -->|"protects"| node_auth
node_postroutes -->|"protects"| node_auth
node_storyroutes -->|"protects"| node_auth
node_users -->|"reads and writes"| node_userrecords
node_users -->|"reads and writes"| node_connectionsrecords
node_users -->|"reads posts"| node_postmodel
node_posts -->|"reads and writes"| node_postmodel
node_posts -->|"reads users"| node_userrecords
node_stories -->|"reads and writes"| node_storymodel
node_messagecontroller -->|"reads and writes"| node_messagemodel
node_posts -->|"uploads media"| node_imagekit

click node_app "https://github.com/balavignesh-j/bolt/blob/main/Client/src/App.jsx"
click node_api "https://github.com/balavignesh-j/bolt/blob/main/Client/src/api/axios.js"
click node_store "https://github.com/balavignesh-j/bolt/blob/main/Client/src/app/store.js"
click node_userstate "https://github.com/balavignesh-j/bolt/blob/main/Client/src/features/user/userSlice.js"
click node_connectionstate "https://github.com/balavignesh-j/bolt/blob/main/Client/src/features/connections/connectionsSlice.js"
click node_messagestate "https://github.com/balavignesh-j/bolt/blob/main/Client/src/features/messages/messagesSlice.js"
click node_aistate "https://github.com/balavignesh-j/bolt/blob/main/Client/src/features/aiChat/aiChatSlice.js"
click node_feed "https://github.com/balavignesh-j/bolt/blob/main/Client/src/pages/Feed.jsx"
click node_discover "https://github.com/balavignesh-j/bolt/blob/main/Client/src/pages/Discover.jsx"
click node_connectionsui "https://github.com/balavignesh-j/bolt/blob/main/Client/src/pages/Connections.jsx"
click node_profile "https://github.com/balavignesh-j/bolt/blob/main/Client/src/pages/Profile.jsx"
click node_createpost "https://github.com/balavignesh-j/bolt/blob/main/Client/src/pages/CreatePost.jsx"
click node_posts "https://github.com/balavignesh-j/bolt/blob/main/server/controllers/postController.js"
click node_stories "https://github.com/balavignesh-j/bolt/blob/main/server/controllers/storyController.js"
click node_postmodel "https://github.com/balavignesh-j/bolt/blob/main/server/models/Post.js"
click node_storymodel "https://github.com/balavignesh-j/bolt/blob/main/server/models/Story.js"
click node_messageui "https://github.com/balavignesh-j/bolt/blob/main/Client/src/pages/Messages.jsx"
click node_chatbox "https://github.com/balavignesh-j/bolt/blob/main/Client/src/pages/ChatBox.jsx"
click node_aichat "https://github.com/balavignesh-j/bolt/blob/main/Client/src/pages/AiChatBox.jsx"
click node_messagecontroller "https://github.com/balavignesh-j/bolt/blob/main/server/controllers/messageController.js"
click node_messagemodel "https://github.com/balavignesh-j/bolt/blob/main/server/models/Message.js"
click node_chatroute "https://github.com/balavignesh-j/bolt/blob/main/server/routes/chatRoutes.js"
click node_server "https://github.com/balavignesh-j/bolt/blob/main/server/server.js"
click node_userroutes "https://github.com/balavignesh-j/bolt/blob/main/server/routes/userRoutes.js"
click node_postroutes "https://github.com/balavignesh-j/bolt/blob/main/server/routes/postRoutes.js"
click node_storyroutes "https://github.com/balavignesh-j/bolt/blob/main/server/routes/storyRoutes.js"
click node_messageroutes "https://github.com/balavignesh-j/bolt/blob/main/server/routes/messageRoutes.js"
click node_users "https://github.com/balavignesh-j/bolt/blob/main/server/controllers/userController.js"
click node_auth "https://github.com/balavignesh-j/bolt/blob/main/server/middlewares/auth.js"
click node_userrecords "https://github.com/balavignesh-j/bolt/blob/main/server/models/User.js"
click node_connectionsrecords "https://github.com/balavignesh-j/bolt/blob/main/server/models/Connections.js"
click node_imagekit "https://github.com/balavignesh-j/bolt/blob/main/server/Configs/imageKit.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_api,node_store,node_userstate,node_connectionstate,node_messagestate,node_aistate,node_user toneBlue
class node_feed,node_discover,node_connectionsui,node_profile,node_createpost,node_posts,node_stories toneAmber
class node_messageui,node_chatbox,node_aichat,node_messagecontroller,node_chatroute toneMint
class node_server,node_userroutes,node_postroutes,node_storyroutes,node_messageroutes,node_users,node_auth toneRose
class node_postmodel,node_storymodel,node_messagemodel,node_groq,node_userrecords,node_connectionsrecords,node_imagekit toneIndigo
```

## Components

### Client experience

- [App routing](https://github.com/balavignesh-j/bolt/blob/main/Client/src/App.jsx): `Client/src/App.jsx`
- [Axios API client](https://github.com/balavignesh-j/bolt/blob/main/Client/src/api/axios.js): `Client/src/api/axios.js`
- [Redux store](https://github.com/balavignesh-j/bolt/blob/main/Client/src/app/store.js): `Client/src/app/store.js`
- [User state](https://github.com/balavignesh-j/bolt/blob/main/Client/src/features/user/userSlice.js): `Client/src/features/user/userSlice.js`
- [Connection state](https://github.com/balavignesh-j/bolt/blob/main/Client/src/features/connections/connectionsSlice.js): `Client/src/features/connections/connectionsSlice.js`
- [Message state](https://github.com/balavignesh-j/bolt/blob/main/Client/src/features/messages/messagesSlice.js): `Client/src/features/messages/messagesSlice.js`
- [AI chat state](https://github.com/balavignesh-j/bolt/blob/main/Client/src/features/aiChat/aiChatSlice.js): `Client/src/features/aiChat/aiChatSlice.js`

### Social content

- [Feed and stories](https://github.com/balavignesh-j/bolt/blob/main/Client/src/pages/Feed.jsx): `Client/src/pages/Feed.jsx`
- [Discover users](https://github.com/balavignesh-j/bolt/blob/main/Client/src/pages/Discover.jsx): `Client/src/pages/Discover.jsx`
- [Connections UI](https://github.com/balavignesh-j/bolt/blob/main/Client/src/pages/Connections.jsx): `Client/src/pages/Connections.jsx`
- [Profiles](https://github.com/balavignesh-j/bolt/blob/main/Client/src/pages/Profile.jsx): `Client/src/pages/Profile.jsx`
- [Create post](https://github.com/balavignesh-j/bolt/blob/main/Client/src/pages/CreatePost.jsx): `Client/src/pages/CreatePost.jsx`
- [Post controller](https://github.com/balavignesh-j/bolt/blob/main/server/controllers/postController.js): `server/controllers/postController.js`
- [Story controller](https://github.com/balavignesh-j/bolt/blob/main/server/controllers/storyController.js): `server/controllers/storyController.js`

### Communication

- [Messages and chat](https://github.com/balavignesh-j/bolt/blob/main/Client/src/pages/Messages.jsx): `Client/src/pages/Messages.jsx`
- [Direct chat](https://github.com/balavignesh-j/bolt/blob/main/Client/src/pages/ChatBox.jsx): `Client/src/pages/ChatBox.jsx`
- [AI assistant UI](https://github.com/balavignesh-j/bolt/blob/main/Client/src/pages/AiChatBox.jsx): `Client/src/pages/AiChatBox.jsx`
- [Message controller](https://github.com/balavignesh-j/bolt/blob/main/server/controllers/messageController.js): `server/controllers/messageController.js`
- [AI chat endpoint](https://github.com/balavignesh-j/bolt/blob/main/server/routes/chatRoutes.js): `server/routes/chatRoutes.js`

### API and identity

- [Express application](https://github.com/balavignesh-j/bolt/blob/main/server/server.js): `server/server.js`
- [User routes](https://github.com/balavignesh-j/bolt/blob/main/server/routes/userRoutes.js): `server/routes/userRoutes.js`
- [Post routes](https://github.com/balavignesh-j/bolt/blob/main/server/routes/postRoutes.js): `server/routes/postRoutes.js`
- [Story routes](https://github.com/balavignesh-j/bolt/blob/main/server/routes/storyRoutes.js): `server/routes/storyRoutes.js`
- [Message routes](https://github.com/balavignesh-j/bolt/blob/main/server/routes/messageRoutes.js): `server/routes/messageRoutes.js`
- [User controller](https://github.com/balavignesh-j/bolt/blob/main/server/controllers/userController.js): `server/controllers/userController.js`
- [Auth middleware](https://github.com/balavignesh-j/bolt/blob/main/server/middlewares/auth.js): `server/middlewares/auth.js`

### Data and services

- [Post records](https://github.com/balavignesh-j/bolt/blob/main/server/models/Post.js): `server/models/Post.js`
- [Story records](https://github.com/balavignesh-j/bolt/blob/main/server/models/Story.js): `server/models/Story.js`
- [Message records](https://github.com/balavignesh-j/bolt/blob/main/server/models/Message.js): `server/models/Message.js`
- **Groq AI**
- [User records](https://github.com/balavignesh-j/bolt/blob/main/server/models/User.js): `server/models/User.js`
- [Connection records](https://github.com/balavignesh-j/bolt/blob/main/server/models/Connections.js): `server/models/Connections.js`
- [ImageKit media](https://github.com/balavignesh-j/bolt/blob/main/server/Configs/imageKit.js): `server/Configs/imageKit.js`

### Other components

- **Social user**

## Connections

- Social user → App routing: uses (evidence: `README.md`)
- App routing → Feed and stories: routes to (evidence: `Client/src/App.jsx`)
- App routing → Messages and chat: routes to (evidence: `Client/src/App.jsx`)
- App routing → Direct chat: routes to (evidence: `Client/src/App.jsx`)
- App routing → AI assistant UI: routes to (evidence: `Client/src/App.jsx`)
- App routing → Connections UI: routes to (evidence: `Client/src/App.jsx`)
- App routing → Discover users: routes to (evidence: `Client/src/App.jsx`)
- App routing → Profiles: routes to (evidence: `Client/src/App.jsx`)
- App routing → Create post: routes to (evidence: `Client/src/App.jsx`)
- App routing → User state: dispatches (evidence: `Client/src/App.jsx`)
- App routing → Connection state: dispatches (evidence: `Client/src/App.jsx`)
- App routing → Message state: dispatches (evidence: `Client/src/App.jsx`)
- Redux store → User state: registers (evidence: `Client/src/app/store.js`)
- Redux store → Connection state: registers (evidence: `Client/src/app/store.js`)
- Redux store → Message state: registers (evidence: `Client/src/app/store.js`)
- Redux store → AI chat state: registers (evidence: `Client/src/app/store.js`)
- User state → Axios API client: requests (evidence: `Client/src/features/user/userSlice.js`)
- Connection state → Axios API client: requests (evidence: `Client/src/features/connections/connectionsSlice.js`)
- Message state → Axios API client: requests (evidence: `Client/src/features/messages/messagesSlice.js`)
- Feed and stories → Axios API client: fetches feed (evidence: `Client/src/pages/Feed.jsx`)
- Discover users → Axios API client: searches users (evidence: `Client/src/pages/Discover.jsx`)
- Connections UI → Axios API client: requests connections (evidence: `Client/src/pages/Connections.jsx`)
- Profiles → Axios API client: fetches profile (evidence: `Client/src/pages/Profile.jsx`)
- Create post → Axios API client: submits post (evidence: `README.md`)
- Direct chat → Axios API client: loads conversation (evidence: `Client/src/pages/ChatBox.jsx`)
- AI assistant UI → Axios API client: sends history (evidence: `README.md`)
- AI assistant UI → AI chat state: updates chat (evidence: `Client/src/pages/AiChatBox.jsx`)
- Axios API client → Express application: REST requests (evidence: `README.md`)
- Express application → User routes: mounts routes (evidence: `server/server.js`)
- Express application → Post routes: mounts routes (evidence: `server/server.js`)
- Express application → Story routes: mounts routes (evidence: `server/server.js`)
- Express application → Message routes: mounts routes (evidence: `server/server.js`)
- Express application → AI chat endpoint: mounts routes (evidence: `server/server.js`)
- User routes → User controller: dispatches (evidence: `server/routes/userRoutes.js`)
- Post routes → Post controller: dispatches (evidence: `server/routes/postRoutes.js`)
- Story routes → Story controller: dispatches (evidence: `server/routes/storyRoutes.js`)
- Message routes → Message controller: dispatches (evidence: `server/routes/messageRoutes.js`)
- User routes → Auth middleware: protects (evidence: `server/routes/userRoutes.js`)
- Post routes → Auth middleware: protects (evidence: `server/routes/postRoutes.js`)
- Story routes → Auth middleware: protects (evidence: `server/routes/storyRoutes.js`)
- User controller → User records: reads and writes (evidence: `server/controllers/userController.js`)
- User controller → Connection records: reads and writes (evidence: `server/controllers/userController.js`)
- User controller → Post records: reads posts (evidence: `server/controllers/userController.js`)
- Post controller → Post records: reads and writes (evidence: `server/controllers/postController.js`)
- Post controller → User records: reads users (evidence: `server/controllers/postController.js`)
- Story controller → Story records: reads and writes (evidence: `server/controllers/storyController.js`)
- Message controller → Message records: reads and writes (evidence: `server/controllers/messageController.js`)
- Post controller → ImageKit media: uploads media (evidence: `server/controllers/postController.js`)
