# nafisa-tabassum-mim/codesync architecture

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

- Interactive diagram: https://gitdiagram.com/nafisa-tabassum-mim/codesync
- Repository: https://github.com/nafisa-tabassum-mim/codesync

## Overview

CodeSync is a browser code editor with account-based workspaces, shared rooms, live collaboration, and execution of supported languages in isolated Docker containers. The main user journey is to authenticate, create or join a room, edit code, and submit it for execution; collaboration relays room changes and execution output to peers. The graph preserves the landing/auth, room, collaboration, and execution branches. Several frontend editor and backend service implementations were not excerpted, so links that rely on README-level behavior cite the README rather than implying those files were inspected.

Main entry points: [`frontend/src/main.jsx`](https://github.com/nafisa-tabassum-mim/codesync/blob/main/frontend/src/main.jsx) (React app routes), [`backend/main.py`](https://github.com/nafisa-tabassum-mim/codesync/blob/main/backend/main.py) (FastAPI app), [`backend/app/controllers/collab_controller.py`](https://github.com/nafisa-tabassum-mim/codesync/blob/main/backend/app/controllers/collab_controller.py) (WebSocket routes), [`backend/app/services/auth_service.py`](https://github.com/nafisa-tabassum-mim/codesync/blob/main/backend/app/services/auth_service.py) (Auth service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Browser application"]
  node_app["React app routes<br/>[main.jsx]"]
  node_public["Public pages<br/>[Features.jsx]"]
  node_authui["Auth context<br/>[AuthContext.jsx]"]
  node_authclient["Auth service<br/>[authService.js]"]
  node_roomui["Workspace dashboard<br/>[Dashboard.jsx]"]
  node_roomview["Room workspace<br/>[Myroom.jsx]"]
  node_editor["Code editor<br/>[CodeEditor.jsx]"]
  node_roomclient["Room service<br/>[roomService.js]"]
  node_api["HTTP client<br/>[apiClient.js]"]
end

subgraph group_identity["Identity and access"]
  node_authapi["Auth routes<br/>[auth_controller.py]"]
  node_access["Session access<br/>[dependencies.py]"]
  node_authlogic["Auth service<br/>[auth_service.py]"]
  node_accounts[("User records<br/>[user.py]")]
end

subgraph group_rooms["Room management"]
  node_roomapi["Room routes<br/>[room_controller.py]"]
  node_roomlogic["Room service<br/>[room_service.py]"]
  node_roomrecords[("Room records<br/>[room.py]")]
end

subgraph group_collaboration["Live collaboration"]
  node_collabapi["WebSocket routes"]
  node_collablogic["Collaboration hub<br/>[collab_service.py]"]
  node_roomdoc["Room document<br/>[room_doc.py]"]
end

subgraph group_execution["Code execution"]
  node_execapi["Execution routes"]
  node_execlogic["Execution service"]
  node_docker["Docker runner"]
end

node_user(("User"))
node_server["FastAPI app<br/>[main.py]"]

node_user -->|"uses"| node_app
node_app -->|"routes to"| node_public
node_app -->|"provides"| node_authui
node_app -->|"routes to"| node_roomui
node_app -->|"routes to"| node_roomview
node_authui -->|"calls"| node_authclient
node_authclient -->|"requests through"| node_api
node_roomui -->|"calls"| node_roomclient
node_roomview -->|"renders"| node_editor
node_roomview -->|"calls"| node_roomclient
node_roomclient -->|"requests through"| node_api
node_api -->|"sends API requests"| node_server
node_server -->|"registers"| node_authapi
node_server -->|"registers"| node_roomapi
node_server -->|"registers"| node_collabapi
node_server -->|"registers"| node_execapi
node_authapi -->|"calls"| node_authlogic
node_authapi -->|"requires"| node_access
node_access -->|"looks up user"| node_authlogic
node_authlogic -->|"reads and writes"| node_accounts
node_roomapi -->|"calls"| node_roomlogic
node_collabapi -->|"authenticates"| node_authlogic
node_collabapi -->|"dispatches room events"| node_collablogic
node_collabapi -->|"updates document"| node_roomdoc
node_collablogic -->|"uses"| node_roomdoc
node_execapi -->|"calls"| node_execlogic
node_execlogic -->|"runs code in"| node_docker

click node_app "https://github.com/nafisa-tabassum-mim/codesync/blob/main/frontend/src/main.jsx"
click node_public "https://github.com/nafisa-tabassum-mim/codesync/blob/main/frontend/src/components/pages/Features.jsx"
click node_authui "https://github.com/nafisa-tabassum-mim/codesync/blob/main/frontend/src/components/context/AuthContext.jsx"
click node_authclient "https://github.com/nafisa-tabassum-mim/codesync/blob/main/frontend/src/components/services/authService.js"
click node_roomui "https://github.com/nafisa-tabassum-mim/codesync/blob/main/frontend/src/components/Workspace/Dashboard.jsx"
click node_roomview "https://github.com/nafisa-tabassum-mim/codesync/blob/main/frontend/src/components/Workspace/Myroom.jsx"
click node_editor "https://github.com/nafisa-tabassum-mim/codesync/blob/main/frontend/src/components/editor/CodeEditor.jsx"
click node_roomclient "https://github.com/nafisa-tabassum-mim/codesync/blob/main/frontend/src/components/services/roomService.js"
click node_api "https://github.com/nafisa-tabassum-mim/codesync/blob/main/frontend/src/components/services/apiClient.js"
click node_authapi "https://github.com/nafisa-tabassum-mim/codesync/blob/main/backend/app/controllers/auth_controller.py"
click node_access "https://github.com/nafisa-tabassum-mim/codesync/blob/main/backend/app/dependencies.py"
click node_authlogic "https://github.com/nafisa-tabassum-mim/codesync/blob/main/backend/app/services/auth_service.py"
click node_accounts "https://github.com/nafisa-tabassum-mim/codesync/blob/main/backend/app/models/user.py"
click node_roomapi "https://github.com/nafisa-tabassum-mim/codesync/blob/main/backend/app/controllers/room_controller.py"
click node_roomlogic "https://github.com/nafisa-tabassum-mim/codesync/blob/main/backend/app/services/room_service.py"
click node_roomrecords "https://github.com/nafisa-tabassum-mim/codesync/blob/main/backend/app/models/room.py"
click node_collabapi "https://github.com/nafisa-tabassum-mim/codesync/blob/main/backend/app/controllers/collab_controller.py"
click node_collablogic "https://github.com/nafisa-tabassum-mim/codesync/blob/main/backend/app/services/collab_service.py"
click node_roomdoc "https://github.com/nafisa-tabassum-mim/codesync/blob/main/backend/app/services/room_doc.py"
click node_execapi "https://github.com/nafisa-tabassum-mim/codesync/blob/main/backend/app/controllers/execution_controller.py"
click node_execlogic "https://github.com/nafisa-tabassum-mim/codesync/blob/main/backend/app/services/execution_service.py"
click node_server "https://github.com/nafisa-tabassum-mim/codesync/blob/main/backend/main.py"

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_public,node_authui,node_authclient,node_roomui,node_roomview,node_editor,node_roomclient,node_api,node_user toneBlue
class node_authapi,node_access,node_authlogic,node_accounts toneAmber
class node_roomapi,node_roomlogic,node_roomrecords,node_server toneMint
class node_collabapi,node_collablogic,node_roomdoc toneRose
class node_execapi,node_execlogic,node_docker toneIndigo
```

## Components

### Browser application

- [React app routes](https://github.com/nafisa-tabassum-mim/codesync/blob/main/frontend/src/main.jsx): `frontend/src/main.jsx`
- [Public pages](https://github.com/nafisa-tabassum-mim/codesync/blob/main/frontend/src/components/pages/Features.jsx): `frontend/src/components/pages/Features.jsx`
- [Auth context](https://github.com/nafisa-tabassum-mim/codesync/blob/main/frontend/src/components/context/AuthContext.jsx): `frontend/src/components/context/AuthContext.jsx`
- [Auth service](https://github.com/nafisa-tabassum-mim/codesync/blob/main/frontend/src/components/services/authService.js): `frontend/src/components/services/authService.js`
- [Workspace dashboard](https://github.com/nafisa-tabassum-mim/codesync/blob/main/frontend/src/components/Workspace/Dashboard.jsx): `frontend/src/components/Workspace/Dashboard.jsx`
- [Room workspace](https://github.com/nafisa-tabassum-mim/codesync/blob/main/frontend/src/components/Workspace/Myroom.jsx): `frontend/src/components/Workspace/Myroom.jsx`
- [Code editor](https://github.com/nafisa-tabassum-mim/codesync/blob/main/frontend/src/components/editor/CodeEditor.jsx): `frontend/src/components/editor/CodeEditor.jsx`
- [Room service](https://github.com/nafisa-tabassum-mim/codesync/blob/main/frontend/src/components/services/roomService.js): `frontend/src/components/services/roomService.js`
- [HTTP client](https://github.com/nafisa-tabassum-mim/codesync/blob/main/frontend/src/components/services/apiClient.js): `frontend/src/components/services/apiClient.js`

### Identity and access

- [Auth routes](https://github.com/nafisa-tabassum-mim/codesync/blob/main/backend/app/controllers/auth_controller.py): `backend/app/controllers/auth_controller.py`
- [Session access](https://github.com/nafisa-tabassum-mim/codesync/blob/main/backend/app/dependencies.py): `backend/app/dependencies.py`
- [Auth service](https://github.com/nafisa-tabassum-mim/codesync/blob/main/backend/app/services/auth_service.py): `backend/app/services/auth_service.py`
- [User records](https://github.com/nafisa-tabassum-mim/codesync/blob/main/backend/app/models/user.py): `backend/app/models/user.py`

### Room management

- [Room routes](https://github.com/nafisa-tabassum-mim/codesync/blob/main/backend/app/controllers/room_controller.py): `backend/app/controllers/room_controller.py`
- [Room service](https://github.com/nafisa-tabassum-mim/codesync/blob/main/backend/app/services/room_service.py): `backend/app/services/room_service.py`
- [Room records](https://github.com/nafisa-tabassum-mim/codesync/blob/main/backend/app/models/room.py): `backend/app/models/room.py`

### Live collaboration

- [WebSocket routes](https://github.com/nafisa-tabassum-mim/codesync/blob/main/backend/app/controllers/collab_controller.py): `backend/app/controllers/collab_controller.py`
- [Collaboration hub](https://github.com/nafisa-tabassum-mim/codesync/blob/main/backend/app/services/collab_service.py): `backend/app/services/collab_service.py`
- [Room document](https://github.com/nafisa-tabassum-mim/codesync/blob/main/backend/app/services/room_doc.py): `backend/app/services/room_doc.py`

### Code execution

- [Execution routes](https://github.com/nafisa-tabassum-mim/codesync/blob/main/backend/app/controllers/execution_controller.py): `backend/app/controllers/execution_controller.py`
- [Execution service](https://github.com/nafisa-tabassum-mim/codesync/blob/main/backend/app/services/execution_service.py): `backend/app/services/execution_service.py`
- **Docker runner**

### Other components

- **User**
- [FastAPI app](https://github.com/nafisa-tabassum-mim/codesync/blob/main/backend/main.py): `backend/main.py`

## Connections

- User → React app routes: uses (evidence: `frontend/src/main.jsx`)
- React app routes → Public pages: routes to (evidence: `frontend/src/main.jsx`)
- React app routes → Auth context: provides (evidence: `frontend/src/main.jsx`)
- React app routes → Workspace dashboard: routes to (evidence: `frontend/src/main.jsx`)
- React app routes → Room workspace: routes to (evidence: `frontend/src/main.jsx`)
- Auth context → Auth service: calls (evidence: `frontend/src/components/context/AuthContext.jsx`)
- Auth service → HTTP client: requests through (evidence: `frontend/src/components/services/authService.js`)
- Workspace dashboard → Room service: calls (evidence: `frontend/src/components/Workspace/Dashboard.jsx`)
- Room workspace → Code editor: renders (evidence: `frontend/src/components/Workspace/Myroom.jsx`)
- Room workspace → Room service: calls (evidence: `frontend/src/components/Workspace/Myroom.jsx`)
- Room service → HTTP client: requests through (evidence: `frontend/src/components/services/roomService.js`)
- HTTP client → FastAPI app: sends API requests (evidence: `README.md`)
- FastAPI app → Auth routes: registers (evidence: `backend/main.py`)
- FastAPI app → Room routes: registers (evidence: `backend/main.py`)
- FastAPI app → WebSocket routes: registers (evidence: `backend/main.py`)
- FastAPI app → Execution routes: registers (evidence: `backend/main.py`)
- Auth routes → Auth service: calls (evidence: `backend/app/controllers/auth_controller.py`)
- Auth routes → Session access: requires (evidence: `backend/app/controllers/auth_controller.py`)
- Session access → Auth service: looks up user (evidence: `backend/app/dependencies.py`)
- Auth service → User records: reads and writes (evidence: `backend/app/services/auth_service.py`)
- Room routes → Room service: calls (evidence: `backend/app/controllers/room_controller.py`)
- WebSocket routes → Auth service: authenticates (evidence: `backend/app/controllers/collab_controller.py`)
- WebSocket routes → Collaboration hub: dispatches room events (evidence: `backend/app/controllers/collab_controller.py`)
- WebSocket routes → Room document: updates document (evidence: `backend/app/controllers/collab_controller.py`)
- Collaboration hub → Room document: uses (evidence: `backend/app/services/collab_service.py`)
- Execution routes → Execution service: calls (evidence: `backend/app/controllers/execution_controller.py`)
- Execution service → Docker runner: runs code in (evidence: `README.md`)
