# saurabh-code88/collab-code architecture

> Architecture diagram of the GitHub repository saurabh-code88/collab-code, 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/saurabh-code88/collab-code
- Repository: https://github.com/saurabh-code88/collab-code

## Overview

CollabCode is a browser-based collaborative editor with Personal and Interview modes. Users authenticate, create or join a room, then edit and collaborate through a shared session; Personal mode adds AI help, while Interview mode adds a timer, private notes, and feedback. The client’s editor coordinates editing and room features; the server handles room events and APIs, with persistent room state in Redis or memory. The excerpts do not show every server handler, so some backend relationships rely on the README’s architecture and API/event descriptions.

Main entry points: [`server/server.js`](https://github.com/saurabh-code88/collab-code/blob/main/server/server.js) (HTTP and socket server), [`client/src/components/EditorPage.jsx`](https://github.com/saurabh-code88/collab-code/blob/main/client/src/components/EditorPage.jsx) (Editor session), [`client/src/api.js`](https://github.com/saurabh-code88/collab-code/blob/main/client/src/api.js) (HTTP API client), [`client/src/components/Sidebar.jsx`](https://github.com/saurabh-code88/collab-code/blob/main/client/src/components/Sidebar.jsx) (Session sidebar)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Browser client"]
  node_app["App routing<br/>[App.jsx]"]
  node_auth_ui["Authentication UI<br/>[AuthPage.jsx]"]
  node_api_client["HTTP API client<br/>[api.js]"]
  node_landing["Room creation and join<br/>[Landing.jsx]"]
  node_ai_panel["AI coding assistant<br/>[AIChatPanel.jsx]"]
end

subgraph group_collaboration["Room collaboration"]
  node_editor["Editor session<br/>[EditorPage.jsx]"]
  node_socket_client["Socket connection<br/>[socket.js]"]
  node_file_tabs["File tabs<br/>[FileTabs.jsx]"]
  node_sidebar["Session sidebar<br/>[Sidebar.jsx]"]
  node_chat["Room chat<br/>[ChatPanel.jsx]"]
  node_users["Participant list<br/>[UserList.jsx]"]
  node_output["Execution output<br/>[OutputPanel.jsx]"]
  node_toolbar["Editor toolbar<br/>[Toolbar.jsx]"]
end

subgraph group_interview["Interview mode"]
  node_interview_panel["Interview controls<br/>[InterviewPanel.jsx]"]
end

subgraph group_backend["Backend services"]
  node_server["HTTP and socket server<br/>[server.js]"]
  node_auth["JWT and passwords<br/>[auth.js]"]
end

subgraph group_storage["Persistence"]
  node_room_store["Room and user store<br/>[store.js]"]
  node_redis[("Redis persistence")]
end

node_user(("Room participant"))
node_groq["Groq AI API"]
node_judge0["Judge0 execution"]

node_user -->|"uses"| node_app
node_app -->|"renders"| node_auth_ui
node_app -->|"renders"| node_landing
node_app -->|"renders"| node_editor
node_auth_ui -->|"requests through"| node_api_client
node_landing -->|"requests through"| node_api_client
node_editor -->|"uses"| node_socket_client
node_editor -->|"renders"| node_file_tabs
node_editor -->|"renders"| node_sidebar
node_editor -->|"renders"| node_output
node_editor -->|"renders"| node_toolbar
node_sidebar -->|"renders"| node_users
node_sidebar -->|"renders"| node_chat
node_sidebar -->|"renders"| node_ai_panel
node_sidebar -->|"renders"| node_interview_panel
node_editor -->|"requests through"| node_api_client
node_ai_panel -->|"requests through"| node_api_client
node_interview_panel -->|"requests through"| node_api_client
node_api_client -->|"sends HTTP requests"| node_server
node_socket_client -->|"connects by WebSocket"| node_server
node_server -->|"uses"| node_auth
node_server -->|"uses"| node_room_store
node_server -->|"requests AI completion"| node_groq
node_server -->|"submits code"| node_judge0
node_room_store -->|"persists room state"| node_redis
node_server -->|"stores chat and session data"| node_room_store
node_interview_panel -->|"emits notes and timer events"| node_socket_client
node_user -->|"creates or joins room"| node_landing
node_editor -->|"runs code"| node_server
node_ai_panel -->|"sends prompt and code"| node_server
node_interview_panel -->|"saves feedback"| node_server

click node_app "https://github.com/saurabh-code88/collab-code/blob/main/client/src/App.jsx"
click node_auth_ui "https://github.com/saurabh-code88/collab-code/blob/main/client/src/components/AuthPage.jsx"
click node_api_client "https://github.com/saurabh-code88/collab-code/blob/main/client/src/api.js"
click node_landing "https://github.com/saurabh-code88/collab-code/blob/main/client/src/components/Landing.jsx"
click node_editor "https://github.com/saurabh-code88/collab-code/blob/main/client/src/components/EditorPage.jsx"
click node_socket_client "https://github.com/saurabh-code88/collab-code/blob/main/client/src/socket.js"
click node_file_tabs "https://github.com/saurabh-code88/collab-code/blob/main/client/src/components/FileTabs.jsx"
click node_sidebar "https://github.com/saurabh-code88/collab-code/blob/main/client/src/components/Sidebar.jsx"
click node_chat "https://github.com/saurabh-code88/collab-code/blob/main/client/src/components/ChatPanel.jsx"
click node_users "https://github.com/saurabh-code88/collab-code/blob/main/client/src/components/UserList.jsx"
click node_output "https://github.com/saurabh-code88/collab-code/blob/main/client/src/components/OutputPanel.jsx"
click node_toolbar "https://github.com/saurabh-code88/collab-code/blob/main/client/src/components/Toolbar.jsx"
click node_ai_panel "https://github.com/saurabh-code88/collab-code/blob/main/client/src/components/AIChatPanel.jsx"
click node_interview_panel "https://github.com/saurabh-code88/collab-code/blob/main/client/src/components/InterviewPanel.jsx"
click node_server "https://github.com/saurabh-code88/collab-code/blob/main/server/server.js"
click node_auth "https://github.com/saurabh-code88/collab-code/blob/main/server/auth.js"
click node_room_store "https://github.com/saurabh-code88/collab-code/blob/main/server/store.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_auth_ui,node_api_client,node_landing,node_ai_panel toneBlue
class node_editor,node_socket_client,node_file_tabs,node_sidebar,node_chat,node_users,node_output,node_toolbar toneAmber
class node_interview_panel,node_groq toneMint
class node_server,node_auth toneRose
class node_room_store,node_redis,node_user,node_judge0 toneIndigo
```

## Components

### Browser client

- [App routing](https://github.com/saurabh-code88/collab-code/blob/main/client/src/App.jsx): `client/src/App.jsx`
- [Authentication UI](https://github.com/saurabh-code88/collab-code/blob/main/client/src/components/AuthPage.jsx): `client/src/components/AuthPage.jsx`
- [HTTP API client](https://github.com/saurabh-code88/collab-code/blob/main/client/src/api.js): `client/src/api.js`
- [Room creation and join](https://github.com/saurabh-code88/collab-code/blob/main/client/src/components/Landing.jsx): `client/src/components/Landing.jsx`
- [AI coding assistant](https://github.com/saurabh-code88/collab-code/blob/main/client/src/components/AIChatPanel.jsx): `client/src/components/AIChatPanel.jsx`

### Room collaboration

- [Editor session](https://github.com/saurabh-code88/collab-code/blob/main/client/src/components/EditorPage.jsx): `client/src/components/EditorPage.jsx`
- [Socket connection](https://github.com/saurabh-code88/collab-code/blob/main/client/src/socket.js): `client/src/socket.js`
- [File tabs](https://github.com/saurabh-code88/collab-code/blob/main/client/src/components/FileTabs.jsx): `client/src/components/FileTabs.jsx`
- [Session sidebar](https://github.com/saurabh-code88/collab-code/blob/main/client/src/components/Sidebar.jsx): `client/src/components/Sidebar.jsx`
- [Room chat](https://github.com/saurabh-code88/collab-code/blob/main/client/src/components/ChatPanel.jsx): `client/src/components/ChatPanel.jsx`
- [Participant list](https://github.com/saurabh-code88/collab-code/blob/main/client/src/components/UserList.jsx): `client/src/components/UserList.jsx`
- [Execution output](https://github.com/saurabh-code88/collab-code/blob/main/client/src/components/OutputPanel.jsx): `client/src/components/OutputPanel.jsx`
- [Editor toolbar](https://github.com/saurabh-code88/collab-code/blob/main/client/src/components/Toolbar.jsx): `client/src/components/Toolbar.jsx`

### Interview mode

- [Interview controls](https://github.com/saurabh-code88/collab-code/blob/main/client/src/components/InterviewPanel.jsx): `client/src/components/InterviewPanel.jsx`

### Backend services

- [HTTP and socket server](https://github.com/saurabh-code88/collab-code/blob/main/server/server.js): `server/server.js`
- [JWT and passwords](https://github.com/saurabh-code88/collab-code/blob/main/server/auth.js): `server/auth.js`

### Persistence

- [Room and user store](https://github.com/saurabh-code88/collab-code/blob/main/server/store.js): `server/store.js`
- **Redis persistence**

### Other components

- **Room participant**
- **Groq AI API**
- **Judge0 execution**

## Connections

- Room participant → App routing: uses (evidence: `README.md`)
- App routing → Authentication UI: renders (evidence: `client/src/App.jsx`)
- App routing → Room creation and join: renders (evidence: `client/src/App.jsx`)
- App routing → Editor session: renders (evidence: `client/src/App.jsx`)
- Authentication UI → HTTP API client: requests through (evidence: `client/src/components/AuthPage.jsx`)
- Room creation and join → HTTP API client: requests through (evidence: `client/src/components/Landing.jsx`)
- Editor session → Socket connection: uses (evidence: `client/src/components/EditorPage.jsx`)
- Editor session → File tabs: renders (evidence: `client/src/components/EditorPage.jsx`)
- Editor session → Session sidebar: renders (evidence: `client/src/components/EditorPage.jsx`)
- Editor session → Execution output: renders (evidence: `client/src/components/EditorPage.jsx`)
- Editor session → Editor toolbar: renders (evidence: `client/src/components/EditorPage.jsx`)
- Session sidebar → Participant list: renders (evidence: `client/src/components/Sidebar.jsx`)
- Session sidebar → Room chat: renders (evidence: `client/src/components/Sidebar.jsx`)
- Session sidebar → AI coding assistant: renders (evidence: `client/src/components/Sidebar.jsx`)
- Session sidebar → Interview controls: renders (evidence: `client/src/components/Sidebar.jsx`)
- Editor session → HTTP API client: requests through (evidence: `client/src/components/EditorPage.jsx`)
- AI coding assistant → HTTP API client: requests through (evidence: `client/src/components/AIChatPanel.jsx`)
- Interview controls → HTTP API client: requests through (evidence: `client/src/components/InterviewPanel.jsx`)
- HTTP API client → HTTP and socket server: sends HTTP requests (evidence: `README.md`)
- Socket connection → HTTP and socket server: connects by WebSocket (evidence: `README.md`)
- HTTP and socket server → JWT and passwords: uses (evidence: `server/server.js`)
- HTTP and socket server → Room and user store: uses (evidence: `server/server.js`)
- HTTP and socket server → Groq AI API: requests AI completion (evidence: `server/server.js`)
- HTTP and socket server → Judge0 execution: submits code (evidence: `server/server.js`)
- Room and user store → Redis persistence: persists room state (evidence: `README.md`)
- HTTP and socket server → Room and user store: stores chat and session data (evidence: `README.md`)
- Interview controls → Socket connection: emits notes and timer events (evidence: `client/src/components/InterviewPanel.jsx`)
- Room participant → Room creation and join: creates or joins room (evidence: `client/src/components/Landing.jsx`)
- Editor session → HTTP and socket server: runs code (evidence: `client/src/components/EditorPage.jsx`)
- AI coding assistant → HTTP and socket server: sends prompt and code (evidence: `client/src/components/AIChatPanel.jsx`)
- Interview controls → HTTP and socket server: saves feedback (evidence: `client/src/components/InterviewPanel.jsx`)
