# neurothos42/codexa architecture

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

- Interactive diagram: https://gitdiagram.com/neurothos42/codexa
- Repository: https://github.com/neurothos42/codexa

## Overview

This is a collaborative coding-session web app: signed-in users browse coding problems, create or join a session, edit and run code, and collaborate over video and chat. The frontend routes requests through session hooks and an API client to authenticated Express routes; controllers manage session records and provision Stream resources. The dashboard, problem-solving, and live-session interfaces are distinct product stages. The excerpts show the main request paths, but README documentation is absent and several UI and integration modules were not sampled, so uncertain links are omitted.

Main entry points: [`frontend/src/pages/SessionPage.jsx`](https://github.com/neurothos42/codexa/blob/main/frontend/src/pages/SessionPage.jsx) (Live session), [`frontend/src/App.jsx`](https://github.com/neurothos42/codexa/blob/main/frontend/src/App.jsx) (Route entry), [`frontend/src/pages/ProblemPage.jsx`](https://github.com/neurothos42/codexa/blob/main/frontend/src/pages/ProblemPage.jsx) (Problem workspace), [`frontend/src/pages/DashboardPage.jsx`](https://github.com/neurothos42/codexa/blob/main/frontend/src/pages/DashboardPage.jsx) (Session dashboard)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Web application"]
  node_app["Route entry<br/>[App.jsx]"]
  node_home["Landing page<br/>[HomePage.jsx]"]
  node_dashboard["Session dashboard<br/>[DashboardPage.jsx]"]
  node_dashboard_ui["Dashboard panels<br/>[ActiveSessions.jsx]"]
  node_problems["Problem catalog<br/>[ProblemsPage.jsx]"]
  node_problem_data["Problem definitions<br/>[problems.js]"]
  node_problem_page["Problem workspace<br/>[ProblemPage.jsx]"]
  node_session_page["Live session<br/>[SessionPage.jsx]"]
  node_editor["Code editor"]
  node_output["Execution output<br/>[OutputPanel.jsx]"]
  node_video_chat_ui["Video and chat UI<br/>[VideoCallUI.jsx]"]
  node_session_hook["Session queries<br/>[useSessions.js]"]
  node_stream_hook["Stream connection<br/>[useStreamClient.js]"]
  node_sessions_api["Session API client<br/>[sessions.js]"]
  node_piston_client["Code runner client<br/>[piston.js]"]
end

subgraph group_backend["Session API"]
  node_api_server["Express server<br/>[server.js]"]
  node_session_routes["Session routes<br/>[sessionRoute.js]"]
  node_chat_routes["Token route<br/>[chatRoutes.js]"]
  node_session_controller["Session operations"]
  node_chat_controller["Token issuance<br/>[chatController.js]"]
end

subgraph group_storage["Persistence"]
  node_session_model[("Session records<br/>[Session.js]")]
end

subgraph group_collaboration["Collaboration services"]
  node_stream_server["Stream service clients<br/>[stream.js]"]
  node_stream_browser["Stream browser clients<br/>[stream.js]"]
end

node_user(("Signed-in user"))
node_browser(("Browser user"))
node_mongo[("MongoDB")]
node_stream_platform["Stream video and chat"]
node_piston["Piston execution service"]

node_user -->|"uses"| node_browser
node_browser -->|"opens"| node_app
node_app -->|"routes to"| node_home
node_app -->|"routes to"| node_dashboard
node_app -->|"routes to"| node_problems
node_app -->|"routes to"| node_problem_page
node_app -->|"routes to"| node_session_page
node_dashboard -->|"queries sessions"| node_session_hook
node_dashboard -->|"renders panels"| node_dashboard_ui
node_problems -->|"reads catalog"| node_problem_data
node_problem_page -->|"loads problem"| node_problem_data
node_problem_page -->|"renders editor"| node_editor
node_problem_page -->|"renders output"| node_output
node_problem_page -->|"runs code"| node_piston_client
node_session_page -->|"loads and mutates"| node_session_hook
node_session_page -->|"loads problem"| node_problem_data
node_session_page -->|"renders editor"| node_editor
node_session_page -->|"renders output"| node_output
node_session_page -->|"runs code"| node_piston_client
node_session_page -.->|"connects session"| node_stream_hook
node_session_page -->|"renders collaboration"| node_video_chat_ui
node_stream_hook -->|"requests token"| node_sessions_api
node_stream_hook -->|"initializes client"| node_stream_browser
node_session_hook -->|"calls API"| node_sessions_api
node_sessions_api -.->|"sends HTTP requests"| node_browser
node_browser -.->|"sends API requests"| node_api_server
node_api_server -->|"mounts routes"| node_session_routes
node_api_server -->|"mounts routes"| node_chat_routes
node_session_routes -->|"dispatches"| node_session_controller
node_chat_routes -->|"dispatches"| node_chat_controller
node_session_controller -->|"queries and updates"| node_session_model
node_session_model -.->|"persists records"| node_mongo
node_session_controller -->|"provisions resources"| node_stream_server
node_chat_controller -->|"creates token"| node_stream_server
node_stream_server -.->|"manages resources"| node_stream_platform
node_stream_browser -.->|"connects clients"| node_stream_platform
node_piston_client -.->|"executes code"| node_piston

click node_app "https://github.com/neurothos42/codexa/blob/main/frontend/src/App.jsx"
click node_home "https://github.com/neurothos42/codexa/blob/main/frontend/src/pages/HomePage.jsx"
click node_dashboard "https://github.com/neurothos42/codexa/blob/main/frontend/src/pages/DashboardPage.jsx"
click node_dashboard_ui "https://github.com/neurothos42/codexa/blob/main/frontend/src/components/ActiveSessions.jsx"
click node_problems "https://github.com/neurothos42/codexa/blob/main/frontend/src/pages/ProblemsPage.jsx"
click node_problem_data "https://github.com/neurothos42/codexa/blob/main/frontend/src/data/problems.js"
click node_problem_page "https://github.com/neurothos42/codexa/blob/main/frontend/src/pages/ProblemPage.jsx"
click node_session_page "https://github.com/neurothos42/codexa/blob/main/frontend/src/pages/SessionPage.jsx"
click node_editor "https://github.com/neurothos42/codexa/blob/main/frontend/src/components/CodeEditorPanel.jsx"
click node_output "https://github.com/neurothos42/codexa/blob/main/frontend/src/components/OutputPanel.jsx"
click node_video_chat_ui "https://github.com/neurothos42/codexa/blob/main/frontend/src/components/VideoCallUI.jsx"
click node_session_hook "https://github.com/neurothos42/codexa/blob/main/frontend/src/hooks/useSessions.js"
click node_stream_hook "https://github.com/neurothos42/codexa/blob/main/frontend/src/hooks/useStreamClient.js"
click node_sessions_api "https://github.com/neurothos42/codexa/blob/main/frontend/src/api/sessions.js"
click node_piston_client "https://github.com/neurothos42/codexa/blob/main/frontend/src/lib/piston.js"
click node_api_server "https://github.com/neurothos42/codexa/blob/main/backend/src/server.js"
click node_session_routes "https://github.com/neurothos42/codexa/blob/main/backend/src/routes/sessionRoute.js"
click node_chat_routes "https://github.com/neurothos42/codexa/blob/main/backend/src/routes/chatRoutes.js"
click node_session_controller "https://github.com/neurothos42/codexa/blob/main/backend/src/controllers/sessionController.js"
click node_chat_controller "https://github.com/neurothos42/codexa/blob/main/backend/src/controllers/chatController.js"
click node_session_model "https://github.com/neurothos42/codexa/blob/main/backend/src/models/Session.js"
click node_stream_server "https://github.com/neurothos42/codexa/blob/main/backend/src/lib/stream.js"
click node_stream_browser "https://github.com/neurothos42/codexa/blob/main/frontend/src/lib/stream.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_home,node_dashboard,node_dashboard_ui,node_problems,node_problem_data,node_problem_page,node_session_page,node_editor,node_output,node_video_chat_ui,node_session_hook,node_stream_hook,node_sessions_api,node_piston_client,node_user,node_browser toneBlue
class node_api_server,node_session_routes,node_chat_routes,node_session_controller,node_chat_controller,node_mongo toneAmber
class node_session_model toneMint
class node_stream_server,node_stream_browser toneRose
class node_stream_platform,node_piston toneIndigo
```

## Components

### Web application

- [Route entry](https://github.com/neurothos42/codexa/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Landing page](https://github.com/neurothos42/codexa/blob/main/frontend/src/pages/HomePage.jsx): `frontend/src/pages/HomePage.jsx`
- [Session dashboard](https://github.com/neurothos42/codexa/blob/main/frontend/src/pages/DashboardPage.jsx): `frontend/src/pages/DashboardPage.jsx`
- [Dashboard panels](https://github.com/neurothos42/codexa/blob/main/frontend/src/components/ActiveSessions.jsx): `frontend/src/components/ActiveSessions.jsx`
- [Problem catalog](https://github.com/neurothos42/codexa/blob/main/frontend/src/pages/ProblemsPage.jsx): `frontend/src/pages/ProblemsPage.jsx`
- [Problem definitions](https://github.com/neurothos42/codexa/blob/main/frontend/src/data/problems.js): `frontend/src/data/problems.js`
- [Problem workspace](https://github.com/neurothos42/codexa/blob/main/frontend/src/pages/ProblemPage.jsx): `frontend/src/pages/ProblemPage.jsx`
- [Live session](https://github.com/neurothos42/codexa/blob/main/frontend/src/pages/SessionPage.jsx): `frontend/src/pages/SessionPage.jsx`
- [Code editor](https://github.com/neurothos42/codexa/blob/main/frontend/src/components/CodeEditorPanel.jsx): `frontend/src/components/CodeEditorPanel.jsx`
- [Execution output](https://github.com/neurothos42/codexa/blob/main/frontend/src/components/OutputPanel.jsx): `frontend/src/components/OutputPanel.jsx`
- [Video and chat UI](https://github.com/neurothos42/codexa/blob/main/frontend/src/components/VideoCallUI.jsx): `frontend/src/components/VideoCallUI.jsx`
- [Session queries](https://github.com/neurothos42/codexa/blob/main/frontend/src/hooks/useSessions.js): `frontend/src/hooks/useSessions.js`
- [Stream connection](https://github.com/neurothos42/codexa/blob/main/frontend/src/hooks/useStreamClient.js): `frontend/src/hooks/useStreamClient.js`
- [Session API client](https://github.com/neurothos42/codexa/blob/main/frontend/src/api/sessions.js): `frontend/src/api/sessions.js`
- [Code runner client](https://github.com/neurothos42/codexa/blob/main/frontend/src/lib/piston.js): `frontend/src/lib/piston.js`

### Session API

- [Express server](https://github.com/neurothos42/codexa/blob/main/backend/src/server.js): `backend/src/server.js`
- [Session routes](https://github.com/neurothos42/codexa/blob/main/backend/src/routes/sessionRoute.js): `backend/src/routes/sessionRoute.js`
- [Token route](https://github.com/neurothos42/codexa/blob/main/backend/src/routes/chatRoutes.js): `backend/src/routes/chatRoutes.js`
- [Session operations](https://github.com/neurothos42/codexa/blob/main/backend/src/controllers/sessionController.js): `backend/src/controllers/sessionController.js`
- [Token issuance](https://github.com/neurothos42/codexa/blob/main/backend/src/controllers/chatController.js): `backend/src/controllers/chatController.js`

### Persistence

- [Session records](https://github.com/neurothos42/codexa/blob/main/backend/src/models/Session.js): `backend/src/models/Session.js`

### Collaboration services

- [Stream service clients](https://github.com/neurothos42/codexa/blob/main/backend/src/lib/stream.js): `backend/src/lib/stream.js`
- [Stream browser clients](https://github.com/neurothos42/codexa/blob/main/frontend/src/lib/stream.js): `frontend/src/lib/stream.js`

### Other components

- **Signed-in user**
- **Browser user**
- **MongoDB**
- **Stream video and chat**
- **Piston execution service**

## Connections

- Signed-in user → Browser user: uses
- Browser user → Route entry: opens (evidence: `frontend/src/App.jsx`)
- Route entry → Landing page: routes to (evidence: `frontend/src/App.jsx`)
- Route entry → Session dashboard: routes to (evidence: `frontend/src/App.jsx`)
- Route entry → Problem catalog: routes to (evidence: `frontend/src/App.jsx`)
- Route entry → Problem workspace: routes to (evidence: `frontend/src/App.jsx`)
- Route entry → Live session: routes to (evidence: `frontend/src/App.jsx`)
- Session dashboard → Session queries: queries sessions (evidence: `frontend/src/pages/DashboardPage.jsx`)
- Session dashboard → Dashboard panels: renders panels (evidence: `frontend/src/pages/DashboardPage.jsx`)
- Problem catalog → Problem definitions: reads catalog (evidence: `frontend/src/pages/ProblemsPage.jsx`)
- Problem workspace → Problem definitions: loads problem (evidence: `frontend/src/pages/ProblemPage.jsx`)
- Problem workspace → Code editor: renders editor (evidence: `frontend/src/pages/ProblemPage.jsx`)
- Problem workspace → Execution output: renders output (evidence: `frontend/src/pages/ProblemPage.jsx`)
- Problem workspace → Code runner client: runs code (evidence: `frontend/src/pages/ProblemPage.jsx`)
- Live session → Session queries: loads and mutates (evidence: `frontend/src/pages/SessionPage.jsx`)
- Live session → Problem definitions: loads problem (evidence: `frontend/src/pages/SessionPage.jsx`)
- Live session → Code editor: renders editor (evidence: `frontend/src/pages/SessionPage.jsx`)
- Live session → Execution output: renders output (evidence: `frontend/src/pages/SessionPage.jsx`)
- Live session → Code runner client: runs code (evidence: `frontend/src/pages/SessionPage.jsx`)
- Live session → Stream connection: connects session (evidence: `frontend/src/pages/SessionPage.jsx`)
- Live session → Video and chat UI: renders collaboration (evidence: `frontend/src/pages/SessionPage.jsx`)
- Stream connection → Session API client: requests token (evidence: `frontend/src/hooks/useStreamClient.js`)
- Stream connection → Stream browser clients: initializes client (evidence: `frontend/src/hooks/useStreamClient.js`)
- Session queries → Session API client: calls API (evidence: `frontend/src/hooks/useSessions.js`)
- Session API client → Browser user: sends HTTP requests
- Browser user → Express server: sends API requests
- Express server → Session routes: mounts routes (evidence: `backend/src/server.js`)
- Express server → Token route: mounts routes (evidence: `backend/src/server.js`)
- Session routes → Session operations: dispatches (evidence: `backend/src/routes/sessionRoute.js`)
- Token route → Token issuance: dispatches (evidence: `backend/src/routes/chatRoutes.js`)
- Session operations → Session records: queries and updates (evidence: `backend/src/controllers/sessionController.js`)
- Session records → MongoDB: persists records
- Session operations → Stream service clients: provisions resources (evidence: `backend/src/controllers/sessionController.js`)
- Token issuance → Stream service clients: creates token (evidence: `backend/src/controllers/chatController.js`)
- Stream service clients → Stream video and chat: manages resources
- Stream browser clients → Stream video and chat: connects clients
- Code runner client → Piston execution service: executes code
