# raunak-dubey1/fluentbridge architecture

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

- Interactive diagram: https://gitdiagram.com/raunak-dubey1/fluentbridge
- Repository: https://github.com/raunak-dubey1/fluentbridge

## Overview

FluentBridge connects language-exchange users through onboarding, friend discovery and requests, then chat and video calling. The frontend provides authentication, profiles, friend and notification views, and chat/call pages; its API client talks to an Express backend that authenticates users, manages friend relationships, and issues Stream credentials. MongoDB stores user and friend-request data, while Stream supplies real-time communications. Several page and route implementations were not sampled, so their internal links are omitted or marked unverified.

Main entry points: [`frontend/src/lib/api.js`](https://github.com/raunak-dubey1/fluentbridge/blob/main/frontend/src/lib/api.js) (Frontend API client), [`backend/src/server.js`](https://github.com/raunak-dubey1/fluentbridge/blob/main/backend/src/server.js) (Express application), [`backend/src/routes/auth.route.js`](https://github.com/raunak-dubey1/fluentbridge/blob/main/backend/src/routes/auth.route.js) (Authentication routes), [`backend/src/controllers/auth.controller.js`](https://github.com/raunak-dubey1/fluentbridge/blob/main/backend/src/controllers/auth.controller.js) (Auth and onboarding)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web client"]
  node_app["Application shell<br/>[App.jsx]"]
  node_authpages["Login and signup<br/>[LoginPage.jsx]"]
  node_onboarding["Profile onboarding<br/>[OnboardingPage.jsx]"]
  node_socialpages["Friend and alerts views<br/>[FriendPage.jsx]"]
  node_home["Home discovery<br/>[HomePage.jsx]"]
  node_chatpage["Chat interface<br/>[ChatPage.jsx]"]
  node_callpage["Video call interface<br/>[CallPage.jsx]"]
end

subgraph group_identity["Identity and profiles"]
  node_authhook["Auth user query<br/>[useAuthUser.js]"]
  node_api["Frontend API client<br/>[api.js]"]
  node_axios["HTTP transport<br/>[axios.js]"]
  node_authroutes["Authentication routes<br/>[auth.route.js]"]
  node_authctrl["Auth and onboarding<br/>[auth.controller.js]"]
  node_authmw["JWT route guard<br/>[auth.middleware.js]"]
  node_userstore[("User records<br/>[User.js]")]
end

subgraph group_social["Friend exchange"]
  node_userctrl["Friend operations<br/>[user.controller.js]"]
  node_useroutes["User routes<br/>[user.route.js]"]
  node_friendstore[("Friend requests<br/>[FriendRequest.js]")]
end

subgraph group_realtime["Real-time services"]
  node_chatctrl["Stream token endpoint<br/>[chat.controller.js]"]
  node_chatroutes["Chat routes<br/>[chat.route.js]"]
  node_streamlib["Stream integration<br/>[stream.js]"]
end

node_visitor(("Language learners"))
node_stream{{"Stream service"}}
node_server["Express application<br/>[server.js]"]
node_db["MongoDB connection<br/>[db.js]"]

node_visitor -.->|"uses"| node_app
node_authhook -->|"queries"| node_api
node_api -->|"sends requests"| node_axios
node_api -->|"calls auth endpoints"| node_authroutes
node_api -->|"calls user endpoints"| node_useroutes
node_api -->|"requests chat token"| node_chatroutes
node_authroutes -->|"routes requests"| node_authctrl
node_authroutes -->|"guards onboarding"| node_authmw
node_authmw -->|"loads user"| node_userstore
node_authctrl -->|"creates and updates"| node_userstore
node_authctrl -->|"upserts profile"| node_streamlib
node_streamlib -->|"manages Stream users"| node_stream
node_useroutes -->|"routes requests"| node_userctrl
node_userctrl -->|"reads and updates"| node_userstore
node_userctrl -->|"creates and queries"| node_friendstore
node_chatroutes -.->|"routes token request"| node_chatctrl
node_chatctrl -->|"generates token"| node_streamlib
node_server -->|"mounts"| node_authroutes
node_server -->|"mounts"| node_useroutes
node_server -->|"mounts"| node_chatroutes
node_server -->|"connects"| node_db
node_authpages -.->|"uses auth calls"| node_api
node_onboarding -.->|"submits profile"| node_api
node_home -.->|"loads recommendations"| node_api
node_socialpages -.->|"manages requests"| node_api
node_chatpage -.->|"requests chat access"| node_api
node_callpage -.->|"communicates by video"| node_stream

click node_app "https://github.com/raunak-dubey1/fluentbridge/blob/main/frontend/src/App.jsx"
click node_authpages "https://github.com/raunak-dubey1/fluentbridge/blob/main/frontend/src/pages/LoginPage.jsx"
click node_onboarding "https://github.com/raunak-dubey1/fluentbridge/blob/main/frontend/src/pages/OnboardingPage.jsx"
click node_socialpages "https://github.com/raunak-dubey1/fluentbridge/blob/main/frontend/src/pages/FriendPage.jsx"
click node_home "https://github.com/raunak-dubey1/fluentbridge/blob/main/frontend/src/pages/HomePage.jsx"
click node_chatpage "https://github.com/raunak-dubey1/fluentbridge/blob/main/frontend/src/pages/ChatPage.jsx"
click node_callpage "https://github.com/raunak-dubey1/fluentbridge/blob/main/frontend/src/pages/CallPage.jsx"
click node_authhook "https://github.com/raunak-dubey1/fluentbridge/blob/main/frontend/src/hooks/useAuthUser.js"
click node_api "https://github.com/raunak-dubey1/fluentbridge/blob/main/frontend/src/lib/api.js"
click node_axios "https://github.com/raunak-dubey1/fluentbridge/blob/main/frontend/src/lib/axios.js"
click node_authroutes "https://github.com/raunak-dubey1/fluentbridge/blob/main/backend/src/routes/auth.route.js"
click node_authctrl "https://github.com/raunak-dubey1/fluentbridge/blob/main/backend/src/controllers/auth.controller.js"
click node_authmw "https://github.com/raunak-dubey1/fluentbridge/blob/main/backend/src/middleware/auth.middleware.js"
click node_userstore "https://github.com/raunak-dubey1/fluentbridge/blob/main/backend/src/models/User.js"
click node_userctrl "https://github.com/raunak-dubey1/fluentbridge/blob/main/backend/src/controllers/user.controller.js"
click node_useroutes "https://github.com/raunak-dubey1/fluentbridge/blob/main/backend/src/routes/user.route.js"
click node_friendstore "https://github.com/raunak-dubey1/fluentbridge/blob/main/backend/src/models/FriendRequest.js"
click node_chatctrl "https://github.com/raunak-dubey1/fluentbridge/blob/main/backend/src/controllers/chat.controller.js"
click node_chatroutes "https://github.com/raunak-dubey1/fluentbridge/blob/main/backend/src/routes/chat.route.js"
click node_streamlib "https://github.com/raunak-dubey1/fluentbridge/blob/main/backend/src/lib/stream.js"
click node_server "https://github.com/raunak-dubey1/fluentbridge/blob/main/backend/src/server.js"
click node_db "https://github.com/raunak-dubey1/fluentbridge/blob/main/backend/src/lib/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_app,node_authpages,node_onboarding,node_socialpages,node_home,node_chatpage,node_callpage toneBlue
class node_authhook,node_api,node_axios,node_authroutes,node_authctrl,node_authmw,node_userstore toneAmber
class node_userctrl,node_useroutes,node_friendstore toneMint
class node_chatctrl,node_chatroutes,node_streamlib toneRose
class node_visitor,node_stream toneIndigo
class node_server,node_db toneTeal
```

## Components

### Web client

- [Application shell](https://github.com/raunak-dubey1/fluentbridge/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Login and signup](https://github.com/raunak-dubey1/fluentbridge/blob/main/frontend/src/pages/LoginPage.jsx): `frontend/src/pages/LoginPage.jsx`
- [Profile onboarding](https://github.com/raunak-dubey1/fluentbridge/blob/main/frontend/src/pages/OnboardingPage.jsx): `frontend/src/pages/OnboardingPage.jsx`
- [Friend and alerts views](https://github.com/raunak-dubey1/fluentbridge/blob/main/frontend/src/pages/FriendPage.jsx): `frontend/src/pages/FriendPage.jsx`
- [Home discovery](https://github.com/raunak-dubey1/fluentbridge/blob/main/frontend/src/pages/HomePage.jsx): `frontend/src/pages/HomePage.jsx`
- [Chat interface](https://github.com/raunak-dubey1/fluentbridge/blob/main/frontend/src/pages/ChatPage.jsx): `frontend/src/pages/ChatPage.jsx`
- [Video call interface](https://github.com/raunak-dubey1/fluentbridge/blob/main/frontend/src/pages/CallPage.jsx): `frontend/src/pages/CallPage.jsx`

### Identity and profiles

- [Auth user query](https://github.com/raunak-dubey1/fluentbridge/blob/main/frontend/src/hooks/useAuthUser.js): `frontend/src/hooks/useAuthUser.js`
- [Frontend API client](https://github.com/raunak-dubey1/fluentbridge/blob/main/frontend/src/lib/api.js): `frontend/src/lib/api.js`
- [HTTP transport](https://github.com/raunak-dubey1/fluentbridge/blob/main/frontend/src/lib/axios.js): `frontend/src/lib/axios.js`
- [Authentication routes](https://github.com/raunak-dubey1/fluentbridge/blob/main/backend/src/routes/auth.route.js): `backend/src/routes/auth.route.js`
- [Auth and onboarding](https://github.com/raunak-dubey1/fluentbridge/blob/main/backend/src/controllers/auth.controller.js): `backend/src/controllers/auth.controller.js`
- [JWT route guard](https://github.com/raunak-dubey1/fluentbridge/blob/main/backend/src/middleware/auth.middleware.js): `backend/src/middleware/auth.middleware.js`
- [User records](https://github.com/raunak-dubey1/fluentbridge/blob/main/backend/src/models/User.js): `backend/src/models/User.js`

### Friend exchange

- [Friend operations](https://github.com/raunak-dubey1/fluentbridge/blob/main/backend/src/controllers/user.controller.js): `backend/src/controllers/user.controller.js`
- [User routes](https://github.com/raunak-dubey1/fluentbridge/blob/main/backend/src/routes/user.route.js): `backend/src/routes/user.route.js`
- [Friend requests](https://github.com/raunak-dubey1/fluentbridge/blob/main/backend/src/models/FriendRequest.js): `backend/src/models/FriendRequest.js`

### Real-time services

- [Stream token endpoint](https://github.com/raunak-dubey1/fluentbridge/blob/main/backend/src/controllers/chat.controller.js): `backend/src/controllers/chat.controller.js`
- [Chat routes](https://github.com/raunak-dubey1/fluentbridge/blob/main/backend/src/routes/chat.route.js): `backend/src/routes/chat.route.js`
- [Stream integration](https://github.com/raunak-dubey1/fluentbridge/blob/main/backend/src/lib/stream.js): `backend/src/lib/stream.js`

### Other components

- **Language learners**
- **Stream service**
- [Express application](https://github.com/raunak-dubey1/fluentbridge/blob/main/backend/src/server.js): `backend/src/server.js`
- [MongoDB connection](https://github.com/raunak-dubey1/fluentbridge/blob/main/backend/src/lib/db.js): `backend/src/lib/db.js`

## Connections

- Language learners → Application shell: uses
- Auth user query → Frontend API client: queries (evidence: `frontend/src/hooks/useAuthUser.js`)
- Frontend API client → HTTP transport: sends requests (evidence: `frontend/src/lib/api.js`)
- Frontend API client → Authentication routes: calls auth endpoints (evidence: `frontend/src/lib/api.js`)
- Frontend API client → User routes: calls user endpoints (evidence: `frontend/src/lib/api.js`)
- Frontend API client → Chat routes: requests chat token (evidence: `frontend/src/lib/api.js`)
- Authentication routes → Auth and onboarding: routes requests (evidence: `backend/src/routes/auth.route.js`)
- Authentication routes → JWT route guard: guards onboarding (evidence: `backend/src/routes/auth.route.js`)
- JWT route guard → User records: loads user (evidence: `backend/src/middleware/auth.middleware.js`)
- Auth and onboarding → User records: creates and updates (evidence: `backend/src/controllers/auth.controller.js`)
- Auth and onboarding → Stream integration: upserts profile (evidence: `backend/src/controllers/auth.controller.js`)
- Stream integration → Stream service: manages Stream users (evidence: `backend/src/lib/stream.js`)
- User routes → Friend operations: routes requests (evidence: `backend/src/routes/user.route.js`)
- Friend operations → User records: reads and updates (evidence: `backend/src/controllers/user.controller.js`)
- Friend operations → Friend requests: creates and queries (evidence: `backend/src/controllers/user.controller.js`)
- Chat routes → Stream token endpoint: routes token request
- Stream token endpoint → Stream integration: generates token (evidence: `backend/src/controllers/chat.controller.js`)
- Express application → Authentication routes: mounts (evidence: `backend/src/server.js`)
- Express application → User routes: mounts (evidence: `backend/src/server.js`)
- Express application → Chat routes: mounts (evidence: `backend/src/server.js`)
- Express application → MongoDB connection: connects (evidence: `backend/src/server.js`)
- Login and signup → Frontend API client: uses auth calls
- Profile onboarding → Frontend API client: submits profile
- Home discovery → Frontend API client: loads recommendations
- Friend and alerts views → Frontend API client: manages requests
- Chat interface → Frontend API client: requests chat access
- Video call interface → Stream service: communicates by video
