# tamoziit/browser-based-ide-poc architecture

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

- Interactive diagram: https://gitdiagram.com/tamoziit/browser-based-ide-poc
- Repository: https://github.com/tamoziit/browser-based-ide-poc

## Overview

Browser-based-IDE-PoC is a browser IDE for starting read-only/execute or read-write labs, editing workspace files, running code in a terminal, and submitting work for evaluation. The principal flow runs from lab selection through session provisioning to file editing and execution; backend services provide access control, evaluation, and session lifecycle management. The graph includes documented-by-source-index snapshot and cleanup branches. Evidence is limited to the README and supplied excerpts/index; unsampled implementation details are not assumed.

Main entry points: [`backend/src/services/k8s.service.ts`](https://github.com/tamoziit/browser-based-ide-poc/blob/main/backend/src/services/k8s.service.ts) (Lab provisioning), [`frontend/src/pages/LabPage.tsx`](https://github.com/tamoziit/browser-based-ide-poc/blob/main/frontend/src/pages/LabPage.tsx) (Lab workspace), [`backend/src/server.ts`](https://github.com/tamoziit/browser-based-ide-poc/blob/main/backend/src/server.ts) (HTTP server), [`frontend/src/App.tsx`](https://github.com/tamoziit/browser-based-ide-poc/blob/main/frontend/src/App.tsx) (App routing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Browser IDE"]
  node_app["App routing<br/>[App.tsx]"]
  node_auth["Auth context<br/>[AuthContext.tsx]"]
  node_socketctx["Socket context<br/>[SocketContext.tsx]"]
  node_selection["Lab selection"]
  node_labpage["Lab workspace<br/>[LabPage.tsx]"]
  node_filetree["File tree<br/>[FileTree.tsx]"]
  node_editor["Code editor<br/>[MonacoEditor.tsx]"]
  node_terminalui["Terminal UI<br/>[Terminal.tsx]"]
  node_results["Result panel<br/>[ResultPanel.tsx]"]
  node_labapi["Lab API client<br/>[lab.api.ts]"]
end

subgraph group_api["API and access"]
  node_server["HTTP server<br/>[server.ts]"]
  node_routes["Lab and file routes<br/>[lab.routes.ts]"]
  node_fileroutes["File routes<br/>[file.routes.ts]"]
  node_authmw["Authentication<br/>[auth.middleware.ts]"]
  node_permissions["Workspace permissions"]
  node_labcontroller["Lab operations<br/>[lab.controller.ts]"]
  node_filecontroller["File operations<br/>[file.controller.ts]"]
  node_terminalcontroller["Terminal operations"]
  node_socketserver["Terminal socket<br/>[terminal.socket.ts]"]
end

subgraph group_runtime["Lab runtime"]
  node_k8sservice["Lab provisioning<br/>[k8s.service.ts]"]
  node_fileutils["Pod file access"]
  node_k8sconfig["Kubernetes client<br/>[k8s.ts]"]
  node_evaluation["Lab evaluation"]
  node_evaluators["Evaluation rules<br/>[evaluators.ts]"]
end

subgraph group_lifecycle["Session lifecycle"]
  node_sessionmodel[("Session records<br/>[session.model.ts]")]
  node_redis[("Session cache<br/>[redis.ts]")]
  node_snapshots["Snapshot service"]
  node_snapshotcron["Snapshot scheduler<br/>[snapshot.cron.ts]"]
  node_cleanup["Session cleanup<br/>[cleanup.worker.ts]"]
  node_cleanuputils["Cleanup operations<br/>[cleanupUtils.ts]"]
end

node_user(("Learner"))
node_mongo[("MongoDB")]
node_kubernetes{{"Kubernetes"}}
node_minio[("MinIO storage")]

node_user -->|"uses"| node_app
node_app -->|"provides"| node_auth
node_app -->|"provides"| node_socketctx
node_app -->|"routes to"| node_selection
node_app -->|"routes to"| node_labpage
node_selection -->|"requests labs"| node_labapi
node_labpage -->|"calls"| node_labapi
node_labpage -->|"renders"| node_filetree
node_labpage -->|"renders"| node_editor
node_labpage -->|"renders"| node_terminalui
node_labpage -->|"renders"| node_results
node_labpage -->|"uses socket"| node_socketctx
node_filetree -->|"loads files"| node_labapi
node_auth -->|"supplies identity"| node_socketctx
node_labapi -.->|"HTTP requests"| node_server
node_server -->|"mounts"| node_routes
node_server -->|"mounts"| node_fileroutes
node_server -->|"initializes"| node_socketserver
node_routes -->|"authenticates"| node_authmw
node_routes -->|"dispatches"| node_labcontroller
node_fileroutes -->|"authenticates"| node_authmw
node_fileroutes -->|"checks access"| node_permissions
node_fileroutes -->|"dispatches"| node_filecontroller
node_labcontroller -->|"manages sessions"| node_k8sservice
node_labcontroller -->|"evaluates submission"| node_evaluation
node_filecontroller -->|"accesses pod files"| node_fileutils
node_filecontroller -->|"refreshes session"| node_k8sservice
node_permissions -->|"checks session"| node_k8sservice
node_socketserver -->|"dispatches events"| node_terminalcontroller
node_terminalcontroller -->|"executes and refreshes"| node_k8sservice
node_terminalcontroller -->|"executes commands"| node_kubernetes
node_k8sservice -->|"uses client"| node_k8sconfig
node_k8sservice -->|"records sessions"| node_sessionmodel
node_k8sservice -->|"caches sessions"| node_redis
node_k8sservice -->|"provisions pods"| node_kubernetes
node_evaluation -->|"runs in lab"| node_k8sservice
node_evaluation -->|"applies rules"| node_evaluators
node_server -->|"connects"| node_mongo
node_server -->|"ensures buckets"| node_minio
node_k8sservice -->|"seeds workspace"| node_minio
node_snapshotcron -->|"schedules"| node_snapshots
node_snapshots -->|"reads session"| node_sessionmodel
node_snapshots -->|"stores snapshot"| node_minio
node_cleanup -->|"starts worker"| node_cleanuputils
node_cleanuputils -->|"stops lab"| node_k8sservice
node_cleanuputils -->|"checks cache"| node_redis
node_cleanuputils -->|"reads session"| node_sessionmodel

click node_app "https://github.com/tamoziit/browser-based-ide-poc/blob/main/frontend/src/App.tsx"
click node_auth "https://github.com/tamoziit/browser-based-ide-poc/blob/main/frontend/src/context/AuthContext.tsx"
click node_socketctx "https://github.com/tamoziit/browser-based-ide-poc/blob/main/frontend/src/context/SocketContext.tsx"
click node_selection "https://github.com/tamoziit/browser-based-ide-poc/blob/main/frontend/src/pages/LabSelectionPage.tsx"
click node_labpage "https://github.com/tamoziit/browser-based-ide-poc/blob/main/frontend/src/pages/LabPage.tsx"
click node_filetree "https://github.com/tamoziit/browser-based-ide-poc/blob/main/frontend/src/components/FileTree.tsx"
click node_editor "https://github.com/tamoziit/browser-based-ide-poc/blob/main/frontend/src/components/MonacoEditor.tsx"
click node_terminalui "https://github.com/tamoziit/browser-based-ide-poc/blob/main/frontend/src/components/Terminal.tsx"
click node_results "https://github.com/tamoziit/browser-based-ide-poc/blob/main/frontend/src/components/ResultPanel.tsx"
click node_labapi "https://github.com/tamoziit/browser-based-ide-poc/blob/main/frontend/src/services/lab.api.ts"
click node_server "https://github.com/tamoziit/browser-based-ide-poc/blob/main/backend/src/server.ts"
click node_routes "https://github.com/tamoziit/browser-based-ide-poc/blob/main/backend/src/routes/lab.routes.ts"
click node_fileroutes "https://github.com/tamoziit/browser-based-ide-poc/blob/main/backend/src/routes/file.routes.ts"
click node_authmw "https://github.com/tamoziit/browser-based-ide-poc/blob/main/backend/src/middlewares/auth.middleware.ts"
click node_permissions "https://github.com/tamoziit/browser-based-ide-poc/blob/main/backend/src/middlewares/permissions.middleware.ts"
click node_labcontroller "https://github.com/tamoziit/browser-based-ide-poc/blob/main/backend/src/controllers/lab.controller.ts"
click node_filecontroller "https://github.com/tamoziit/browser-based-ide-poc/blob/main/backend/src/controllers/file.controller.ts"
click node_terminalcontroller "https://github.com/tamoziit/browser-based-ide-poc/blob/main/backend/src/controllers/terminal.controller.ts"
click node_socketserver "https://github.com/tamoziit/browser-based-ide-poc/blob/main/backend/src/socket/terminal.socket.ts"
click node_k8sservice "https://github.com/tamoziit/browser-based-ide-poc/blob/main/backend/src/services/k8s.service.ts"
click node_fileutils "https://github.com/tamoziit/browser-based-ide-poc/blob/main/backend/src/utils/fileHandlerUtils.ts"
click node_k8sconfig "https://github.com/tamoziit/browser-based-ide-poc/blob/main/backend/src/config/k8s.ts"
click node_evaluation "https://github.com/tamoziit/browser-based-ide-poc/blob/main/backend/src/services/evaluation.service.ts"
click node_evaluators "https://github.com/tamoziit/browser-based-ide-poc/blob/main/backend/src/utils/evaluators.ts"
click node_sessionmodel "https://github.com/tamoziit/browser-based-ide-poc/blob/main/backend/src/models/session.model.ts"
click node_redis "https://github.com/tamoziit/browser-based-ide-poc/blob/main/backend/src/config/redis.ts"
click node_snapshots "https://github.com/tamoziit/browser-based-ide-poc/blob/main/backend/src/services/snapshot.service.ts"
click node_snapshotcron "https://github.com/tamoziit/browser-based-ide-poc/blob/main/backend/src/workers/snapshot.cron.ts"
click node_cleanup "https://github.com/tamoziit/browser-based-ide-poc/blob/main/backend/src/workers/cleanup.worker.ts"
click node_cleanuputils "https://github.com/tamoziit/browser-based-ide-poc/blob/main/backend/src/utils/cleanupUtils.ts"

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,node_socketctx,node_selection,node_labpage,node_filetree,node_editor,node_terminalui,node_results,node_labapi toneBlue
class node_server,node_routes,node_fileroutes,node_authmw,node_permissions,node_labcontroller,node_filecontroller,node_terminalcontroller,node_socketserver,node_mongo,node_minio toneAmber
class node_k8sservice,node_fileutils,node_k8sconfig,node_evaluation,node_evaluators toneMint
class node_sessionmodel,node_redis,node_snapshots,node_snapshotcron,node_cleanup,node_cleanuputils toneRose
class node_user,node_kubernetes toneIndigo
```

## Components

### Browser IDE

- [App routing](https://github.com/tamoziit/browser-based-ide-poc/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Auth context](https://github.com/tamoziit/browser-based-ide-poc/blob/main/frontend/src/context/AuthContext.tsx): `frontend/src/context/AuthContext.tsx`
- [Socket context](https://github.com/tamoziit/browser-based-ide-poc/blob/main/frontend/src/context/SocketContext.tsx): `frontend/src/context/SocketContext.tsx`
- [Lab selection](https://github.com/tamoziit/browser-based-ide-poc/blob/main/frontend/src/pages/LabSelectionPage.tsx): `frontend/src/pages/LabSelectionPage.tsx`
- [Lab workspace](https://github.com/tamoziit/browser-based-ide-poc/blob/main/frontend/src/pages/LabPage.tsx): `frontend/src/pages/LabPage.tsx`
- [File tree](https://github.com/tamoziit/browser-based-ide-poc/blob/main/frontend/src/components/FileTree.tsx): `frontend/src/components/FileTree.tsx`
- [Code editor](https://github.com/tamoziit/browser-based-ide-poc/blob/main/frontend/src/components/MonacoEditor.tsx): `frontend/src/components/MonacoEditor.tsx`
- [Terminal UI](https://github.com/tamoziit/browser-based-ide-poc/blob/main/frontend/src/components/Terminal.tsx): `frontend/src/components/Terminal.tsx`
- [Result panel](https://github.com/tamoziit/browser-based-ide-poc/blob/main/frontend/src/components/ResultPanel.tsx): `frontend/src/components/ResultPanel.tsx`
- [Lab API client](https://github.com/tamoziit/browser-based-ide-poc/blob/main/frontend/src/services/lab.api.ts): `frontend/src/services/lab.api.ts`

### API and access

- [HTTP server](https://github.com/tamoziit/browser-based-ide-poc/blob/main/backend/src/server.ts): `backend/src/server.ts`
- [Lab and file routes](https://github.com/tamoziit/browser-based-ide-poc/blob/main/backend/src/routes/lab.routes.ts): `backend/src/routes/lab.routes.ts`
- [File routes](https://github.com/tamoziit/browser-based-ide-poc/blob/main/backend/src/routes/file.routes.ts): `backend/src/routes/file.routes.ts`
- [Authentication](https://github.com/tamoziit/browser-based-ide-poc/blob/main/backend/src/middlewares/auth.middleware.ts): `backend/src/middlewares/auth.middleware.ts`
- [Workspace permissions](https://github.com/tamoziit/browser-based-ide-poc/blob/main/backend/src/middlewares/permissions.middleware.ts): `backend/src/middlewares/permissions.middleware.ts`
- [Lab operations](https://github.com/tamoziit/browser-based-ide-poc/blob/main/backend/src/controllers/lab.controller.ts): `backend/src/controllers/lab.controller.ts`
- [File operations](https://github.com/tamoziit/browser-based-ide-poc/blob/main/backend/src/controllers/file.controller.ts): `backend/src/controllers/file.controller.ts`
- [Terminal operations](https://github.com/tamoziit/browser-based-ide-poc/blob/main/backend/src/controllers/terminal.controller.ts): `backend/src/controllers/terminal.controller.ts`
- [Terminal socket](https://github.com/tamoziit/browser-based-ide-poc/blob/main/backend/src/socket/terminal.socket.ts): `backend/src/socket/terminal.socket.ts`

### Lab runtime

- [Lab provisioning](https://github.com/tamoziit/browser-based-ide-poc/blob/main/backend/src/services/k8s.service.ts): `backend/src/services/k8s.service.ts`
- [Pod file access](https://github.com/tamoziit/browser-based-ide-poc/blob/main/backend/src/utils/fileHandlerUtils.ts): `backend/src/utils/fileHandlerUtils.ts`
- [Kubernetes client](https://github.com/tamoziit/browser-based-ide-poc/blob/main/backend/src/config/k8s.ts): `backend/src/config/k8s.ts`
- [Lab evaluation](https://github.com/tamoziit/browser-based-ide-poc/blob/main/backend/src/services/evaluation.service.ts): `backend/src/services/evaluation.service.ts`
- [Evaluation rules](https://github.com/tamoziit/browser-based-ide-poc/blob/main/backend/src/utils/evaluators.ts): `backend/src/utils/evaluators.ts`

### Session lifecycle

- [Session records](https://github.com/tamoziit/browser-based-ide-poc/blob/main/backend/src/models/session.model.ts): `backend/src/models/session.model.ts`
- [Session cache](https://github.com/tamoziit/browser-based-ide-poc/blob/main/backend/src/config/redis.ts): `backend/src/config/redis.ts`
- [Snapshot service](https://github.com/tamoziit/browser-based-ide-poc/blob/main/backend/src/services/snapshot.service.ts): `backend/src/services/snapshot.service.ts`
- [Snapshot scheduler](https://github.com/tamoziit/browser-based-ide-poc/blob/main/backend/src/workers/snapshot.cron.ts): `backend/src/workers/snapshot.cron.ts`
- [Session cleanup](https://github.com/tamoziit/browser-based-ide-poc/blob/main/backend/src/workers/cleanup.worker.ts): `backend/src/workers/cleanup.worker.ts`
- [Cleanup operations](https://github.com/tamoziit/browser-based-ide-poc/blob/main/backend/src/utils/cleanupUtils.ts): `backend/src/utils/cleanupUtils.ts`

### Other components

- **Learner**
- **MongoDB**
- **Kubernetes**
- **MinIO storage**

## Connections

- Learner → App routing: uses
- App routing → Auth context: provides (evidence: `frontend/src/App.tsx`)
- App routing → Socket context: provides (evidence: `frontend/src/App.tsx`)
- App routing → Lab selection: routes to (evidence: `frontend/src/App.tsx`)
- App routing → Lab workspace: routes to (evidence: `frontend/src/App.tsx`)
- Lab selection → Lab API client: requests labs (evidence: `frontend/src/pages/LabSelectionPage.tsx`)
- Lab workspace → Lab API client: calls (evidence: `frontend/src/pages/LabPage.tsx`)
- Lab workspace → File tree: renders (evidence: `frontend/src/pages/LabPage.tsx`)
- Lab workspace → Code editor: renders (evidence: `frontend/src/pages/LabPage.tsx`)
- Lab workspace → Terminal UI: renders (evidence: `frontend/src/pages/LabPage.tsx`)
- Lab workspace → Result panel: renders (evidence: `frontend/src/pages/LabPage.tsx`)
- Lab workspace → Socket context: uses socket (evidence: `frontend/src/pages/LabPage.tsx`)
- File tree → Lab API client: loads files (evidence: `frontend/src/components/FileTree.tsx`)
- Auth context → Socket context: supplies identity (evidence: `frontend/src/context/SocketContext.tsx`)
- Lab API client → HTTP server: HTTP requests
- HTTP server → Lab and file routes: mounts (evidence: `backend/src/server.ts`)
- HTTP server → File routes: mounts (evidence: `backend/src/server.ts`)
- HTTP server → Terminal socket: initializes (evidence: `backend/src/server.ts`)
- Lab and file routes → Authentication: authenticates (evidence: `backend/src/routes/lab.routes.ts`)
- Lab and file routes → Lab operations: dispatches (evidence: `backend/src/routes/lab.routes.ts`)
- File routes → Authentication: authenticates (evidence: `backend/src/routes/file.routes.ts`)
- File routes → Workspace permissions: checks access (evidence: `backend/src/routes/file.routes.ts`)
- File routes → File operations: dispatches (evidence: `backend/src/routes/file.routes.ts`)
- Lab operations → Lab provisioning: manages sessions (evidence: `backend/src/controllers/lab.controller.ts`)
- Lab operations → Lab evaluation: evaluates submission (evidence: `backend/src/controllers/lab.controller.ts`)
- File operations → Pod file access: accesses pod files (evidence: `backend/src/controllers/file.controller.ts`)
- File operations → Lab provisioning: refreshes session (evidence: `backend/src/controllers/file.controller.ts`)
- Workspace permissions → Lab provisioning: checks session (evidence: `backend/src/middlewares/permissions.middleware.ts`)
- Terminal socket → Terminal operations: dispatches events (evidence: `backend/src/socket/terminal.socket.ts`)
- Terminal operations → Lab provisioning: executes and refreshes (evidence: `backend/src/controllers/terminal.controller.ts`)
- Terminal operations → Kubernetes: executes commands (evidence: `backend/src/controllers/terminal.controller.ts`)
- Lab provisioning → Kubernetes client: uses client (evidence: `backend/src/services/k8s.service.ts`)
- Lab provisioning → Session records: records sessions (evidence: `backend/src/services/k8s.service.ts`)
- Lab provisioning → Session cache: caches sessions (evidence: `backend/src/services/k8s.service.ts`)
- Lab provisioning → Kubernetes: provisions pods (evidence: `backend/src/services/k8s.service.ts`)
- Lab evaluation → Lab provisioning: runs in lab (evidence: `backend/src/services/evaluation.service.ts`)
- Lab evaluation → Evaluation rules: applies rules (evidence: `backend/src/services/evaluation.service.ts`)
- HTTP server → MongoDB: connects (evidence: `backend/src/server.ts`)
- HTTP server → MinIO storage: ensures buckets (evidence: `backend/src/server.ts`)
- Lab provisioning → MinIO storage: seeds workspace (evidence: `backend/src/services/k8s.service.ts`)
- Snapshot scheduler → Snapshot service: schedules (evidence: `backend/src/workers/snapshot.cron.ts`)
- Snapshot service → Session records: reads session (evidence: `backend/src/services/snapshot.service.ts`)
- Snapshot service → MinIO storage: stores snapshot (evidence: `backend/src/services/snapshot.service.ts`)
- Session cleanup → Cleanup operations: starts worker (evidence: `backend/src/workers/cleanup.worker.ts`)
- Cleanup operations → Lab provisioning: stops lab (evidence: `backend/src/utils/cleanupUtils.ts`)
- Cleanup operations → Session cache: checks cache (evidence: `backend/src/utils/cleanupUtils.ts`)
- Cleanup operations → Session records: reads session (evidence: `backend/src/utils/cleanupUtils.ts`)
