How akshay-2007-1/cse_liveness_frontend works
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: routerConfig.ts Router · Workspace.tsx Workspace · index.tsx App entry · AcademyActions.ts Feature modules
Components 21
App shell
Startup, routing, providers, and global state coordination.
- App entry · Bootstraps the React app and wires providers before rendering routes.
src/index.tsx - Store setup · Creates the client store used by the application shell and routes.
src/pages/createStore.ts - App shell · Global application boundary with shared actions, reducers, and wrapper logic.
src/commons/application/ApplicationWrapper.tsx - Router · Top-level route selection for legacy and new route systems.
src/routes/routerConfig.ts - New 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 · Core editor, REPL, file system, and workspace state management.
src/commons/workspace/Workspace.tsx - Editor · Ace-based editor container, tabs, hotkeys, and refactor/navigation hooks.
src/commons/editor/Editor.tsx - REPL · Interactive read-eval-print loop for code execution feedback.
src/commons/repl/Repl.tsx - Side content · Displays execution results, inspectors, visualizers, and auxiliary panels.
src/commons/sideContent/SideContent.tsx - Control bar · Run, step, save, submit, versioning, and navigation actions for workspace flows.
src/commons/controlBar/ControlBar.tsx - Playground · Main learner coding page that assembles the workspace experience.
src/pages/playground/Playground.tsx - Assessment ws · Assessment-focused workspace with grading result integration.
src/commons/assessmentWorkspace/AssessmentWorkspace.tsx
Academy tools
Course, grading, admin, and ops workflows.
- Grading · Instructor grading and submission review interface.
src/pages/academy/grading/Grading.tsx - Academy tools · 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.
Shared foundations
Reusable UI, utilities, integrations, and feature scaffolding.
- Sagas · Coordinates backend, persistence, login, feature flags, workspace, and side content flows.
src/commons/sagas/MainSaga.ts - Shared UI · Reusable controls, dialogs, navigation, page wrappers, and form primitives.
src/components/ui/page/PageWrapper.tsx - Helpers · Shared helpers for auth, requests, storage, service worker, and formatting.
src/commons/utils/RequestHelper.tsx - I18n · Language packs and runtime translation setup.
src/i18n/i18n.ts - Feature modules · Reusable domain logic for academy, playground, dashboard, leaderboard, contributors, and more.
src/features/academy/AcademyActions.ts
Connections 27
- 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.