# debojit-dev0/webcrunner architecture

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

- Interactive diagram: https://gitdiagram.com/debojit-dev0/webcrunner
- Repository: https://github.com/debojit-dev0/webcrunner

## Overview

Web C Shell is a browser-based C editor and terminal backed by a workspace-restricted Node/Express server. Users edit and save C files, browse the workspace, and issue shell commands; `run` compiles a selected C source with gcc, then streams program output and accepts stdin through the terminal. The README documents sidebar navigation, command history, shell utilities, and sandboxed paths. The server and frontend excerpts are partial, so the map shows documented capabilities without inferring finer internal wiring; the root-level files are used as the primary implementation.

Main entry points: [`server.js`](https://github.com/debojit-dev0/webcrunner/blob/main/server.js) (HTTP server and routes), [`public/index.html`](https://github.com/debojit-dev0/webcrunner/blob/main/public/index.html) (Editor and terminal view), [`public/script.js`](https://github.com/debojit-dev0/webcrunner/blob/main/public/script.js) (Editor, sidebar, terminal), [`workspace`](https://github.com/debojit-dev0/webcrunner/tree/main/workspace) (Sandboxed project files)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["Browser interface"]
  node_page["Editor and terminal view<br/>[index.html]"]
  node_client["Editor, sidebar, terminal<br/>[script.js]"]
  node_styles["Interface styling<br/>[style.css]"]
end

subgraph group_api["Workspace API"]
  node_server["HTTP server and routes<br/>[server.js]"]
  node_file_api["Save, open, list files<br/>[server.js]"]
  node_cwd["Sandbox path and cwd<br/>[server.js]"]
end

subgraph group_execution["Command execution"]
  node_command_api["Command dispatch<br/>[server.js]"]
  node_native_cmds["Native shell built-ins<br/>[server.js]"]
  node_os_shell["Host shell utilities"]
  node_run_api["C run handler<br/>[server.js]"]
  node_compiler["gcc compiler"]
  node_program["Compiled C process"]
  node_process_api["Interactive process control<br/>[server.js]"]
end

subgraph group_state["Workspace state"]
  node_workspace[("Sandboxed project files")]
end

node_user(("Developer"))

node_user -->|"uses"| node_page
node_page -->|"loads"| node_client
node_page -->|"styles with"| node_styles
node_client -->|"calls API"| node_server
node_server -->|"serves UI"| node_page
node_server -->|"routes files"| node_file_api
node_file_api -->|"reads and writes"| node_workspace
node_file_api -->|"resolves paths"| node_cwd
node_server -->|"routes commands"| node_command_api
node_command_api -->|"dispatches built-ins"| node_native_cmds
node_command_api -->|"checks sandbox"| node_cwd
node_command_api -->|"runs other commands"| node_os_shell
node_native_cmds -->|"operates on files"| node_workspace
node_server -->|"routes run requests"| node_run_api
node_run_api -->|"resolves source"| node_cwd
node_run_api -->|"reads C source"| node_workspace
node_run_api -->|"compiles source"| node_compiler
node_run_api -->|"starts executable"| node_program
node_client -->|"polls, inputs, stops"| node_process_api
node_process_api -->|"controls stdin and process"| node_program

click node_page "https://github.com/debojit-dev0/webcrunner/blob/main/public/index.html"
click node_client "https://github.com/debojit-dev0/webcrunner/blob/main/public/script.js"
click node_styles "https://github.com/debojit-dev0/webcrunner/blob/main/public/style.css"
click node_server "https://github.com/debojit-dev0/webcrunner/blob/main/server.js"
click node_file_api "https://github.com/debojit-dev0/webcrunner/blob/main/server.js"
click node_cwd "https://github.com/debojit-dev0/webcrunner/blob/main/server.js"
click node_command_api "https://github.com/debojit-dev0/webcrunner/blob/main/server.js"
click node_native_cmds "https://github.com/debojit-dev0/webcrunner/blob/main/server.js"
click node_run_api "https://github.com/debojit-dev0/webcrunner/blob/main/server.js"
click node_process_api "https://github.com/debojit-dev0/webcrunner/blob/main/server.js"
click node_workspace "https://github.com/debojit-dev0/webcrunner/tree/main/workspace"

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_page,node_client,node_styles toneBlue
class node_server,node_file_api,node_cwd toneAmber
class node_command_api,node_native_cmds,node_os_shell,node_run_api,node_compiler,node_program,node_process_api toneMint
class node_workspace toneRose
class node_user toneIndigo
```

## Components

### Browser interface

- [Editor and terminal view](https://github.com/debojit-dev0/webcrunner/blob/main/public/index.html): `public/index.html`
- [Editor, sidebar, terminal](https://github.com/debojit-dev0/webcrunner/blob/main/public/script.js): `public/script.js`
- [Interface styling](https://github.com/debojit-dev0/webcrunner/blob/main/public/style.css): `public/style.css`

### Workspace API

- [HTTP server and routes](https://github.com/debojit-dev0/webcrunner/blob/main/server.js): `server.js`
- [Save, open, list files](https://github.com/debojit-dev0/webcrunner/blob/main/server.js): `server.js`
- [Sandbox path and cwd](https://github.com/debojit-dev0/webcrunner/blob/main/server.js): `server.js`

### Command execution

- [Command dispatch](https://github.com/debojit-dev0/webcrunner/blob/main/server.js): `server.js`
- [Native shell built-ins](https://github.com/debojit-dev0/webcrunner/blob/main/server.js): `server.js`
- **Host shell utilities**
- [C run handler](https://github.com/debojit-dev0/webcrunner/blob/main/server.js): `server.js`
- **gcc compiler**
- **Compiled C process**
- [Interactive process control](https://github.com/debojit-dev0/webcrunner/blob/main/server.js): `server.js`

### Workspace state

- [Sandboxed project files](https://github.com/debojit-dev0/webcrunner/tree/main/workspace): `workspace`

### Other components

- **Developer**

## Connections

- Developer → Editor and terminal view: uses
- Editor and terminal view → Editor, sidebar, terminal: loads
- Editor and terminal view → Interface styling: styles with
- Editor, sidebar, terminal → HTTP server and routes: calls API
- HTTP server and routes → Editor and terminal view: serves UI
- HTTP server and routes → Save, open, list files: routes files
- Save, open, list files → Sandboxed project files: reads and writes
- Save, open, list files → Sandbox path and cwd: resolves paths
- HTTP server and routes → Command dispatch: routes commands
- Command dispatch → Native shell built-ins: dispatches built-ins
- Command dispatch → Sandbox path and cwd: checks sandbox
- Command dispatch → Host shell utilities: runs other commands
- Native shell built-ins → Sandboxed project files: operates on files
- HTTP server and routes → C run handler: routes run requests
- C run handler → Sandbox path and cwd: resolves source
- C run handler → Sandboxed project files: reads C source
- C run handler → gcc compiler: compiles source
- C run handler → Compiled C process: starts executable
- Editor, sidebar, terminal → Interactive process control: polls, inputs, stops
- Interactive process control → Compiled C process: controls stdin and process
