# avn2312/langbridge architecture

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

- Interactive diagram: https://gitdiagram.com/avn2312/langbridge
- Repository: https://github.com/avn2312/langbridge
- Video tour (about a minute): https://gitdiagram.com/avn2312/langbridge/video

## Overview

LangBridge is a language-exchange application whose main journey is onboarding a learner, finding practice partners, connecting socially, and practicing through chat and learning tools. The React app routes authenticated users to feature pages and uses a shared API layer; the Express modular monolith exposes REST endpoints and Socket.IO realtime services. MongoDB and Redis support persistence and runtime state, while Kafka workers are optional. The graph follows documented capabilities and visible wiring; some feature internals are represented by their exact module directories because their source was not sampled.

Main entry points: [`backend/src/app.js`](https://github.com/avn2312/langbridge/blob/main/backend/src/app.js) (Express application), [`frontend/src/app/router.jsx`](https://github.com/avn2312/langbridge/blob/main/frontend/src/app/router.jsx) (App routing), [`backend/src/infrastructure/realtime/socket.js`](https://github.com/avn2312/langbridge/blob/main/backend/src/infrastructure/realtime/socket.js) (Socket.IO server), [`backend/src/modules/auth/auth.service.js`](https://github.com/avn2312/langbridge/blob/main/backend/src/modules/auth/auth.service.js) (Authentication)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Web application"]
  node_router["App routing<br/>[router.jsx]"]
  node_authui["Account and onboarding"]
  node_discoveryui["Partner discovery"]
  node_chatui["Chat and calls"]
  node_learningui["Learning tools"]
  node_moderationui["Moderation queue"]
  node_clientapi["API and auth hooks<br/>[api.js]"]
  node_socketclient["Socket client<br/>[useSocket.js]"]
end

subgraph group_product["Exchange features"]
  node_auth["Authentication<br/>[auth.service.js]"]
  node_users["Profiles and users"]
  node_matching["Partner matching"]
  node_friendships["Friendships"]
  node_chat["Messaging"]
  node_calls["Call signaling"]
  node_learning["Learning services"]
  node_media["Media uploads<br/>[media.service.js]"]
  node_moderation["Moderation actions"]
  node_presence["Presence"]
  node_notifications["Notifications"]
end

subgraph group_backend["Backend application"]
  node_app["Express application<br/>[app.js]"]
end

subgraph group_runtime["Runtime services"]
  node_socketserver["Socket.IO server<br/>[socket.js]"]
  node_worker["Event worker<br/>[eventWorker.js]"]
  node_mongo[("MongoDB<br/>[mongoose.js]")]
  node_redis[("Redis state<br/>[redis.clients.js]")]
end

node_learner(("Learner"))
node_kafka["Kafka"]
node_cloud["Cloud media storage"]

node_learner -->|"uses"| node_router
node_router -->|"routes to"| node_authui
node_router -->|"routes to"| node_discoveryui
node_router -->|"routes to"| node_chatui
node_router -->|"routes to"| node_learningui
node_router -->|"routes to"| node_moderationui
node_router -->|"loads auth via"| node_clientapi
node_chatui -.->|"uses realtime"| node_socketclient
node_clientapi -.->|"calls API"| node_app
node_socketclient -.->|"connects realtime"| node_socketserver
node_app -->|"routes auth"| node_auth
node_app -->|"routes users"| node_users
node_app -->|"routes messages"| node_chat
node_app -->|"routes learning"| node_learning
node_app -->|"routes moderation"| node_moderation
node_app -->|"routes recommendations"| node_matching
node_app -->|"routes friendship actions"| node_friendships
node_chat -->|"routes attachment uploads"| node_media
node_auth -.->|"persists account"| node_mongo
node_auth -->|"publishes signup event"| node_kafka
node_worker -.->|"consumes events"| node_kafka
node_chat -.->|"supports realtime chat"| node_socketserver
node_calls -.->|"supports call signaling"| node_socketserver
node_presence -.->|"stores presence"| node_redis
node_socketserver -->|"uses adapter"| node_redis
node_media -.->|"stores uploads"| node_cloud
node_learning -.->|"stores learning activity"| node_mongo
node_notifications -.->|"handles background events"| node_worker

click node_router "https://github.com/avn2312/langbridge/blob/main/frontend/src/app/router.jsx"
click node_authui "https://github.com/avn2312/langbridge/tree/main/frontend/src/features/auth"
click node_discoveryui "https://github.com/avn2312/langbridge/tree/main/frontend/src/features/users"
click node_chatui "https://github.com/avn2312/langbridge/tree/main/frontend/src/features/chat"
click node_learningui "https://github.com/avn2312/langbridge/tree/main/frontend/src/features/learning"
click node_moderationui "https://github.com/avn2312/langbridge/tree/main/frontend/src/features/moderation"
click node_clientapi "https://github.com/avn2312/langbridge/blob/main/frontend/src/lib/api.js"
click node_socketclient "https://github.com/avn2312/langbridge/blob/main/frontend/src/hooks/useSocket.js"
click node_app "https://github.com/avn2312/langbridge/blob/main/backend/src/app.js"
click node_auth "https://github.com/avn2312/langbridge/blob/main/backend/src/modules/auth/auth.service.js"
click node_users "https://github.com/avn2312/langbridge/tree/main/backend/src/modules/users"
click node_matching "https://github.com/avn2312/langbridge/tree/main/backend/src/modules/matching"
click node_friendships "https://github.com/avn2312/langbridge/tree/main/backend/src/modules/friendships"
click node_chat "https://github.com/avn2312/langbridge/tree/main/backend/src/modules/chat"
click node_calls "https://github.com/avn2312/langbridge/tree/main/backend/src/modules/calls"
click node_learning "https://github.com/avn2312/langbridge/blob/main/backend/src/modules/learning/learning.service.js"
click node_media "https://github.com/avn2312/langbridge/blob/main/backend/src/modules/media/media.service.js"
click node_moderation "https://github.com/avn2312/langbridge/tree/main/backend/src/modules/moderation"
click node_presence "https://github.com/avn2312/langbridge/tree/main/backend/src/modules/presence"
click node_notifications "https://github.com/avn2312/langbridge/tree/main/backend/src/modules/notifications"
click node_socketserver "https://github.com/avn2312/langbridge/blob/main/backend/src/infrastructure/realtime/socket.js"
click node_worker "https://github.com/avn2312/langbridge/blob/main/backend/src/workers/eventWorker.js"
click node_mongo "https://github.com/avn2312/langbridge/blob/main/backend/src/infrastructure/database/mongoose.js"
click node_redis "https://github.com/avn2312/langbridge/blob/main/backend/src/infrastructure/redis/redis.clients.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_router,node_authui,node_discoveryui,node_chatui,node_learningui,node_moderationui,node_clientapi,node_socketclient toneBlue
class node_auth,node_users,node_matching,node_friendships,node_chat,node_calls,node_learning,node_media,node_moderation,node_presence,node_notifications,node_cloud toneAmber
class node_app toneMint
class node_socketserver,node_worker,node_mongo,node_redis toneRose
class node_learner,node_kafka toneIndigo
```

## Components

### Web application

- [App routing](https://github.com/avn2312/langbridge/blob/main/frontend/src/app/router.jsx): `frontend/src/app/router.jsx`
- [Account and onboarding](https://github.com/avn2312/langbridge/tree/main/frontend/src/features/auth): `frontend/src/features/auth`
- [Partner discovery](https://github.com/avn2312/langbridge/tree/main/frontend/src/features/users): `frontend/src/features/users`
- [Chat and calls](https://github.com/avn2312/langbridge/tree/main/frontend/src/features/chat): `frontend/src/features/chat`
- [Learning tools](https://github.com/avn2312/langbridge/tree/main/frontend/src/features/learning): `frontend/src/features/learning`
- [Moderation queue](https://github.com/avn2312/langbridge/tree/main/frontend/src/features/moderation): `frontend/src/features/moderation`
- [API and auth hooks](https://github.com/avn2312/langbridge/blob/main/frontend/src/lib/api.js): `frontend/src/lib/api.js`
- [Socket client](https://github.com/avn2312/langbridge/blob/main/frontend/src/hooks/useSocket.js): `frontend/src/hooks/useSocket.js`

### Exchange features

- [Authentication](https://github.com/avn2312/langbridge/blob/main/backend/src/modules/auth/auth.service.js): `backend/src/modules/auth/auth.service.js`
- [Profiles and users](https://github.com/avn2312/langbridge/tree/main/backend/src/modules/users): `backend/src/modules/users`
- [Partner matching](https://github.com/avn2312/langbridge/tree/main/backend/src/modules/matching): `backend/src/modules/matching`
- [Friendships](https://github.com/avn2312/langbridge/tree/main/backend/src/modules/friendships): `backend/src/modules/friendships`
- [Messaging](https://github.com/avn2312/langbridge/tree/main/backend/src/modules/chat): `backend/src/modules/chat`
- [Call signaling](https://github.com/avn2312/langbridge/tree/main/backend/src/modules/calls): `backend/src/modules/calls`
- [Learning services](https://github.com/avn2312/langbridge/blob/main/backend/src/modules/learning/learning.service.js): `backend/src/modules/learning/learning.service.js`
- [Media uploads](https://github.com/avn2312/langbridge/blob/main/backend/src/modules/media/media.service.js): `backend/src/modules/media/media.service.js`
- [Moderation actions](https://github.com/avn2312/langbridge/tree/main/backend/src/modules/moderation): `backend/src/modules/moderation`
- [Presence](https://github.com/avn2312/langbridge/tree/main/backend/src/modules/presence): `backend/src/modules/presence`
- [Notifications](https://github.com/avn2312/langbridge/tree/main/backend/src/modules/notifications): `backend/src/modules/notifications`

### Backend application

- [Express application](https://github.com/avn2312/langbridge/blob/main/backend/src/app.js): `backend/src/app.js`

### Runtime services

- [Socket.IO server](https://github.com/avn2312/langbridge/blob/main/backend/src/infrastructure/realtime/socket.js): `backend/src/infrastructure/realtime/socket.js`
- [Event worker](https://github.com/avn2312/langbridge/blob/main/backend/src/workers/eventWorker.js): `backend/src/workers/eventWorker.js`
- [MongoDB](https://github.com/avn2312/langbridge/blob/main/backend/src/infrastructure/database/mongoose.js): `backend/src/infrastructure/database/mongoose.js`
- [Redis state](https://github.com/avn2312/langbridge/blob/main/backend/src/infrastructure/redis/redis.clients.js): `backend/src/infrastructure/redis/redis.clients.js`

### Other components

- **Learner**
- **Kafka**
- **Cloud media storage**

## Connections

- Learner → App routing: uses
- App routing → Account and onboarding: routes to (evidence: `frontend/src/app/router.jsx`)
- App routing → Partner discovery: routes to (evidence: `frontend/src/app/router.jsx`)
- App routing → Chat and calls: routes to (evidence: `frontend/src/app/router.jsx`)
- App routing → Learning tools: routes to (evidence: `frontend/src/app/router.jsx`)
- App routing → Moderation queue: routes to (evidence: `frontend/src/app/router.jsx`)
- App routing → API and auth hooks: loads auth via
- Chat and calls → Socket client: uses realtime
- API and auth hooks → Express application: calls API
- Socket client → Socket.IO server: connects realtime
- Express application → Authentication: routes auth (evidence: `backend/src/app.js`)
- Express application → Profiles and users: routes users (evidence: `backend/src/app.js`)
- Express application → Messaging: routes messages (evidence: `backend/src/app.js`)
- Express application → Learning services: routes learning (evidence: `backend/src/app.js`)
- Express application → Moderation actions: routes moderation (evidence: `backend/src/app.js`)
- Express application → Partner matching: routes recommendations
- Express application → Friendships: routes friendship actions
- Messaging → Media uploads: routes attachment uploads (evidence: `backend/src/modules/chat/chat.routes.js`)
- Authentication → MongoDB: persists account
- Authentication → Kafka: publishes signup event (evidence: `backend/src/modules/auth/auth.service.js`)
- Event worker → Kafka: consumes events
- Messaging → Socket.IO server: supports realtime chat
- Call signaling → Socket.IO server: supports call signaling
- Presence → Redis state: stores presence
- Socket.IO server → Redis state: uses adapter (evidence: `backend/server.js`)
- Media uploads → Cloud media storage: stores uploads
- Learning services → MongoDB: stores learning activity
- Notifications → Event worker: handles background events
