# akshay-2007-1/cse_liveness_frontend architecture

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

- Interactive diagram: https://gitdiagram.com/akshay-2007-1/cse_liveness_frontend
- Repository: https://github.com/akshay-2007-1/cse_liveness_frontend

## Overview

1. **Overall shape**
   This is a single-page React frontend for Source Academy, organized around domain features rather than technical layers. The top-level app bootstraps through `src/index.tsx`, sets up Redux, routing, i18n, and cross-cutting providers, then renders one of several major experiences: Playground, Academy, SICP, Game, grading/admin tools, or contributor/login pages.

2. **Application shell and state**
   The global application boundary lives under `src/commons/application`, with `ApplicationWrapper`, root reducers, and action modules. Redux is the main client-side state container; sagas under `src/commons/sagas` orchestrate asynchronous flows such as backend requests, persistence, login, feature flags, workspace evaluation, and side-content updates. This is the core coordination layer for most subsystems.

3. **Routing and page entry points**
   Routing is split between `src/routes` and the newer route files under `src/new_routes`, while page-level screens live in `src/pages`. The route layer selects broad app sections, and each page composes shared commons plus feature-specific modules. Architecturally, `src/pages` is where route-specific orchestration happens, while `src/features` contains reusable domain logic.

4. **Workspace / Playground execution loop**
   The Playground and general programming workspace are centered in `src/commons/workspace`, `src/commons/editor`, `src/commons/repl`, and related reducers. User code flows from the editor into evaluation sagas, which coordinate execution, stepping, debugger state, and display buffers. The workspace also connects to file-system state, tabs, hotkeys, and side panels, making it the main interactive programming surface.

5. **Language tooling and visualizers**
   Code execution and inspection are supported by several specialized features: the CSE machine visualizer in `src/features/cseMachine`, data visualizer in `src/features/dataVisualizer`, and `src/commons/sideContent` views for HTML output, canvases, charts, substitutions, and machine state. These components consume execution results and interpreter state rather than directly owning program execution.

6. **Assessment, missions, and grading**
   Assessment workflows are split across `src/commons/assessment`, `src/commons/assessmentWorkspace`, `src/features/assessments`, and the academy grading pages under `src/pages/academy/grading`. The assessment workspace handles question rendering, grading results, and interaction with backend/autograder state, while the grading pages support instructor review, filtering, commenting, and submission management.

7. **Academy / course management**
   Course-facing tools live under `src/pages/academy` and supporting features like `src/features/academy`, `src/features/dashboard`, `src/features/leaderboard`, `src/features/teamFormation`, and `src/features/groundControl`. This subsystem manages course dashboards, contest leaderboards, team formation, administrative controls, and other instructor/ops workflows. It is separate from the learner workspace and is generally backend-driven.

8. **Game experience**
   The themed game is a substantial subsystem under `src/features/game`, with scenes, managers, parsers, dialogue, audio, assets, state, and task systems. Textual content from `public/assets/*.txt` is parsed into game chapters, room previews, awards, quests, and dialogue. This is a self-contained content-driven runtime that maps structured narrative data into interactive scenes.

9. **SICP site and content**
   The SICP experience is implemented in `src/pages/sicp`, `src/features/sicp`, and `src/new_routes/sicpjs`. It includes table-of-contents navigation, code snippets, LaTeX/text rendering, chat/help surfaces, and error boundaries. This area is content-heavy and uses packaged JSON/data plus route-driven chapter/section rendering rather than general workspace editing.

10. **Integrations and external services**
   External service boundaries are centralized in helpers, sagas, and feature modules for backend APIs, GitHub, Google Drive, ShareDB collaborative editing, remote execution devices, Sentry, and logging. `src/commons/utils/*Helper.ts` and sagas such as persistence, GitHub, login, remote execution, and requests are the primary integration points. Environment variables in `.env` determine which services are active.

11. **Shared UI and cross-cutting components**
   Reusable UI primitives and common flows live in `src/commons` and `src/components/ui`. This includes navigation bars, dropdowns, dialogs, control bars, file-system views, mobile workspace layouts, markdown/content display, and form/page wrappers. These modules are intentionally domain-agnostic and are assembled by higher-level features and pages.

12. **Runtime assets, public libraries, and build tooling**
   `public/` contains runtime-loaded assets and evaluator bundles, including font files, mock content, inspector/sound libraries, and pie-slang evaluator code. The project is built with TypeScript/React and configured via `rsbuild.config.ts`, with testing in Vitest and CI via GitHub Actions. A service worker and precache logic support offline/static deployment behavior.

Main entry points: [`src/routes/routerConfig.ts`](https://github.com/akshay-2007-1/cse_liveness_frontend/blob/master/src/routes/routerConfig.ts) (Router), [`src/commons/workspace/Workspace.tsx`](https://github.com/akshay-2007-1/cse_liveness_frontend/blob/master/src/commons/workspace/Workspace.tsx) (Workspace), [`src/index.tsx`](https://github.com/akshay-2007-1/cse_liveness_frontend/blob/master/src/index.tsx) (App entry), [`src/features/academy/AcademyActions.ts`](https://github.com/akshay-2007-1/cse_liveness_frontend/blob/master/src/features/academy/AcademyActions.ts) (Feature modules)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_grp_boot["App shell"]
  node_src_index["App entry<br/>bootstrap entry<br/>[index.tsx]"]
  node_src_create_store["Store setup<br/>redux store<br/>[createStore.ts]"]
  node_src_application["App shell<br/>application wrapper"]
  node_src_router["Router<br/>route config<br/>[routerConfig.ts]"]
  node_src_new_routes_layout["New routes<br/>file-based routes<br/>[_layout.tsx]"]
end

subgraph group_grp_workspace["Workspace runtime"]
  node_src_workspace["Workspace<br/>programming surface<br/>[Workspace.tsx]"]
  node_src_editor["Editor<br/>[Editor.tsx]"]
  node_src_repl["REPL<br/>runtime console<br/>[Repl.tsx]"]
  node_src_side_content["Side content<br/>output panes<br/>[SideContent.tsx]"]
  node_src_control_bar["Control bar<br/>workspace controls<br/>[ControlBar.tsx]"]
  node_src_playground_page["Playground<br/>workspace page<br/>[Playground.tsx]"]
  node_src_assessment_ws["Assessment ws<br/>assessment workspace"]
end

subgraph group_grp_academy["Academy tools"]
  node_src_grading_page["Grading<br/>instructor page<br/>[Grading.tsx]"]
  node_src_academy_tools["Academy tools<br/>course ops<br/>[academyRoutes.ts]"]
end

subgraph group_grp_content["Content experiences"]
  node_src_game["Game<br/>content runtime"]
  node_src_sicp["SICP<br/>content experience<br/>[SicpToc.tsx]"]
end

subgraph group_grp_shared["Shared foundations"]
  node_src_sagas_main["Sagas<br/>async orchestration<br/>[MainSaga.ts]"]
  node_src_shared_ui["Shared UI<br/>ui primitives<br/>[PageWrapper.tsx]"]
  node_src_utils["Helpers<br/>cross-cutting utils<br/>[RequestHelper.tsx]"]
  node_src_i18n["I18n<br/>localization<br/>[i18n.ts]"]
  node_src_features_core["Feature modules<br/>domain features<br/>[AcademyActions.ts]"]
end

node_src_index -->|"creates store"| node_src_create_store
node_src_index -->|"wraps app"| node_src_application
node_src_index -->|"routes to"| node_src_router
node_src_index -->|"initializes"| node_src_i18n
node_src_index -->|"starts effects"| node_src_sagas_main
node_src_application -->|"uses UI"| node_src_shared_ui
node_src_application -->|"uses helpers"| node_src_utils
node_src_router -->|"selects"| node_src_new_routes_layout
node_src_router -->|"opens"| node_src_playground_page
node_src_router -->|"opens"| node_src_grading_page
node_src_router -->|"opens"| node_src_sicp
node_src_router -->|"opens"| node_src_game
node_src_router -->|"opens"| node_src_academy_tools
node_src_playground_page -->|"assembles"| node_src_workspace
node_src_workspace -->|"hosts"| node_src_editor
node_src_workspace -->|"hosts"| node_src_repl
node_src_workspace -->|"shows"| node_src_side_content
node_src_workspace -->|"controls"| node_src_control_bar
node_src_workspace -->|"drives"| node_src_sagas_main
node_src_assessment_ws -->|"shows results"| node_src_side_content
node_src_grading_page -->|"uses"| node_src_assessment_ws
node_src_academy_tools -->|"composes"| node_src_features_core
node_src_game -->|"uses features"| node_src_features_core
node_src_sicp -->|"uses features"| node_src_features_core
node_src_side_content -->|"renders feature panes"| node_src_features_core
node_src_sagas_main -->|"calls"| node_src_utils
node_src_sagas_main -->|"coordinates"| node_src_features_core

click node_src_index "https://github.com/akshay-2007-1/cse_liveness_frontend/blob/master/src/index.tsx"
click node_src_create_store "https://github.com/akshay-2007-1/cse_liveness_frontend/blob/master/src/pages/createStore.ts"
click node_src_application "https://github.com/akshay-2007-1/cse_liveness_frontend/blob/master/src/commons/application/ApplicationWrapper.tsx"
click node_src_router "https://github.com/akshay-2007-1/cse_liveness_frontend/blob/master/src/routes/routerConfig.ts"
click node_src_new_routes_layout "https://github.com/akshay-2007-1/cse_liveness_frontend/blob/master/src/new_routes/_layout.tsx"
click node_src_sagas_main "https://github.com/akshay-2007-1/cse_liveness_frontend/blob/master/src/commons/sagas/MainSaga.ts"
click node_src_shared_ui "https://github.com/akshay-2007-1/cse_liveness_frontend/blob/master/src/components/ui/page/PageWrapper.tsx"
click node_src_utils "https://github.com/akshay-2007-1/cse_liveness_frontend/blob/master/src/commons/utils/RequestHelper.tsx"
click node_src_i18n "https://github.com/akshay-2007-1/cse_liveness_frontend/blob/master/src/i18n/i18n.ts"
click node_src_workspace "https://github.com/akshay-2007-1/cse_liveness_frontend/blob/master/src/commons/workspace/Workspace.tsx"
click node_src_editor "https://github.com/akshay-2007-1/cse_liveness_frontend/blob/master/src/commons/editor/Editor.tsx"
click node_src_repl "https://github.com/akshay-2007-1/cse_liveness_frontend/blob/master/src/commons/repl/Repl.tsx"
click node_src_side_content "https://github.com/akshay-2007-1/cse_liveness_frontend/blob/master/src/commons/sideContent/SideContent.tsx"
click node_src_control_bar "https://github.com/akshay-2007-1/cse_liveness_frontend/blob/master/src/commons/controlBar/ControlBar.tsx"
click node_src_playground_page "https://github.com/akshay-2007-1/cse_liveness_frontend/blob/master/src/pages/playground/Playground.tsx"
click node_src_assessment_ws "https://github.com/akshay-2007-1/cse_liveness_frontend/blob/master/src/commons/assessmentWorkspace/AssessmentWorkspace.tsx"
click node_src_grading_page "https://github.com/akshay-2007-1/cse_liveness_frontend/blob/master/src/pages/academy/grading/Grading.tsx"
click node_src_academy_tools "https://github.com/akshay-2007-1/cse_liveness_frontend/blob/master/src/pages/academy/academyRoutes.ts"
click node_src_game "https://github.com/akshay-2007-1/cse_liveness_frontend/blob/master/src/features/game/SourceAcademyGame.ts"
click node_src_sicp "https://github.com/akshay-2007-1/cse_liveness_frontend/blob/master/src/pages/sicp/subcomponents/SicpToc.tsx"
click node_src_features_core "https://github.com/akshay-2007-1/cse_liveness_frontend/blob/master/src/features/academy/AcademyActions.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_src_index,node_src_create_store,node_src_application,node_src_router,node_src_new_routes_layout toneBlue
class node_src_workspace,node_src_editor,node_src_repl,node_src_side_content,node_src_control_bar,node_src_playground_page,node_src_assessment_ws toneAmber
class node_src_grading_page,node_src_academy_tools toneMint
class node_src_game,node_src_sicp toneRose
class node_src_sagas_main,node_src_shared_ui,node_src_utils,node_src_i18n,node_src_features_core toneIndigo
```

## Components

### App shell

Startup, routing, providers, and global state coordination.

- [App entry](https://github.com/akshay-2007-1/cse_liveness_frontend/blob/master/src/index.tsx): bootstrap entry · Bootstraps the React app and wires providers before rendering routes. · `src/index.tsx`
- [Store setup](https://github.com/akshay-2007-1/cse_liveness_frontend/blob/master/src/pages/createStore.ts): redux store · Creates the client store used by the application shell and routes. · `src/pages/createStore.ts`
- [App shell](https://github.com/akshay-2007-1/cse_liveness_frontend/blob/master/src/commons/application/ApplicationWrapper.tsx): application wrapper · Global application boundary with shared actions, reducers, and wrapper logic. · `src/commons/application/ApplicationWrapper.tsx`
- [Router](https://github.com/akshay-2007-1/cse_liveness_frontend/blob/master/src/routes/routerConfig.ts): route config · Top-level route selection for legacy and new route systems. · `src/routes/routerConfig.ts`
- [New routes](https://github.com/akshay-2007-1/cse_liveness_frontend/blob/master/src/new_routes/_layout.tsx): file-based routes · File-based route layouts and entry points for modern sections. · `src/new_routes/_layout.tsx`

### Workspace runtime

Interactive coding surface, editor, REPL, evaluation, and side content.

- [Workspace](https://github.com/akshay-2007-1/cse_liveness_frontend/blob/master/src/commons/workspace/Workspace.tsx): programming surface · Core editor, REPL, file system, and workspace state management. · `src/commons/workspace/Workspace.tsx`
- [Editor](https://github.com/akshay-2007-1/cse_liveness_frontend/blob/master/src/commons/editor/Editor.tsx): code editor · Ace-based editor container, tabs, hotkeys, and refactor/navigation hooks. · `src/commons/editor/Editor.tsx`
- [REPL](https://github.com/akshay-2007-1/cse_liveness_frontend/blob/master/src/commons/repl/Repl.tsx): runtime console · Interactive read-eval-print loop for code execution feedback. · `src/commons/repl/Repl.tsx`
- [Side content](https://github.com/akshay-2007-1/cse_liveness_frontend/blob/master/src/commons/sideContent/SideContent.tsx): output panes · Displays execution results, inspectors, visualizers, and auxiliary panels. · `src/commons/sideContent/SideContent.tsx`
- [Control bar](https://github.com/akshay-2007-1/cse_liveness_frontend/blob/master/src/commons/controlBar/ControlBar.tsx): workspace controls · Run, step, save, submit, versioning, and navigation actions for workspace flows. · `src/commons/controlBar/ControlBar.tsx`
- [Playground](https://github.com/akshay-2007-1/cse_liveness_frontend/blob/master/src/pages/playground/Playground.tsx): workspace page · Main learner coding page that assembles the workspace experience. · `src/pages/playground/Playground.tsx`
- [Assessment ws](https://github.com/akshay-2007-1/cse_liveness_frontend/blob/master/src/commons/assessmentWorkspace/AssessmentWorkspace.tsx): assessment workspace · Assessment-focused workspace with grading result integration. · `src/commons/assessmentWorkspace/AssessmentWorkspace.tsx`

### Academy tools

Course, grading, admin, and ops workflows.

- [Grading](https://github.com/akshay-2007-1/cse_liveness_frontend/blob/master/src/pages/academy/grading/Grading.tsx): instructor page · Instructor grading and submission review interface. · `src/pages/academy/grading/Grading.tsx`
- [Academy tools](https://github.com/akshay-2007-1/cse_liveness_frontend/blob/master/src/pages/academy/academyRoutes.ts): course ops · Course dashboards, admin panel, ground control, leaderboard, team formation, and related academy features. · `src/pages/academy/academyRoutes.ts`

### Content experiences

Game and SICP route-driven experiences.

- [Game](https://github.com/akshay-2007-1/cse_liveness_frontend/blob/master/src/features/game/SourceAcademyGame.ts): content runtime · Self-contained narrative/gameplay runtime driven by parsers, scenes, state, and assets. · `src/features/game/SourceAcademyGame.ts`
- [SICP](https://github.com/akshay-2007-1/cse_liveness_frontend/blob/master/src/pages/sicp/subcomponents/SicpToc.tsx): content experience · SICP chapter and section rendering with content helpers and route-driven navigation. · `src/pages/sicp/subcomponents/SicpToc.tsx`

### Shared foundations

Reusable UI, utilities, integrations, and feature scaffolding.

- [Sagas](https://github.com/akshay-2007-1/cse_liveness_frontend/blob/master/src/commons/sagas/MainSaga.ts): async orchestration · Coordinates backend, persistence, login, feature flags, workspace, and side content flows. · `src/commons/sagas/MainSaga.ts`
- [Shared UI](https://github.com/akshay-2007-1/cse_liveness_frontend/blob/master/src/components/ui/page/PageWrapper.tsx): ui primitives · Reusable controls, dialogs, navigation, page wrappers, and form primitives. · `src/components/ui/page/PageWrapper.tsx`
- [Helpers](https://github.com/akshay-2007-1/cse_liveness_frontend/blob/master/src/commons/utils/RequestHelper.tsx): cross-cutting utils · Shared helpers for auth, requests, storage, service worker, and formatting. · `src/commons/utils/RequestHelper.tsx`
- [I18n](https://github.com/akshay-2007-1/cse_liveness_frontend/blob/master/src/i18n/i18n.ts): localization · Language packs and runtime translation setup. · `src/i18n/i18n.ts`
- [Feature modules](https://github.com/akshay-2007-1/cse_liveness_frontend/blob/master/src/features/academy/AcademyActions.ts): domain features · Reusable domain logic for academy, playground, dashboard, leaderboard, contributors, and more. · `src/features/academy/AcademyActions.ts`

## Connections

- App entry → Store setup: creates store · Initial app startup configures the Redux store.
- App entry → App shell: wraps app · Application shell is mounted from the entrypoint.
- App entry → Router: routes to · Entry point hands control to the router.
- App entry → I18n: initializes · Localization is initialized during startup.
- App entry → Sagas: starts effects · Saga middleware is started as part of application boot.
- App shell → Shared UI: uses UI · Global shell composes shared page and navigation primitives.
- App shell → Helpers: uses helpers · Shell relies on shared utilities and integrations.
- Router → New routes: selects · Modern route tree handles several major experiences.
- Router → Playground: opens · Playground is one of the main routed experiences.
- Router → Grading: opens · Academy grading is exposed as a routed page.
- Router → SICP: opens · SICP content is exposed through routed pages.
- Router → Game: opens · Game experience is exposed via routing.
- Router → Academy tools: opens · Academy/admin tools are routed as a course subsystem.
- Playground → Workspace: assembles · Playground is built from the workspace runtime.
- Workspace → Editor: hosts · Workspace includes the code editor surface.
- Workspace → REPL: hosts · Workspace includes the REPL output/input loop.
- Workspace → Side content: shows · Workspace renders visualizers and result panels.
- Workspace → Control bar: controls · Workspace uses the control bar for execution and persistence actions.
- Workspace → Sagas: drives · Workspace actions are orchestrated through sagas.
- Assessment ws → Side content: shows results · Assessment workspace surfaces grading and feedback panels.
- Grading → Assessment ws: uses · Grading page relies on assessment workspace patterns.
- Academy tools → Feature modules: composes · Academy tools depend on reusable domain feature modules.
- Game → Feature modules: uses features · Game runtime shares feature scaffolding and cross-cutting modules.
- SICP → Feature modules: uses features · SICP routes and content use shared feature logic.
- Side content → Feature modules: renders feature panes · Side content surfaces visualizers and tool-specific views.
- Sagas → Helpers: calls · Async flows depend on shared request, auth, and storage helpers.
- Sagas → Feature modules: coordinates · Sagas coordinate feature-level state and backend flows.
