# gurovic/booml architecture

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

- Interactive diagram: https://gitdiagram.com/gurovic/booml
- Repository: https://github.com/gurovic/booml

## Overview

#### Purpose and entry points
Booml is an ML-learning and competition platform: users work in notebooks, execute code in managed environments, submit ML-task results, and participate in courses/contests. The main runtime is a Django backend entered through `backend/manage.py`, `backend/core/asgi.py`, and `backend/core/urls.py`; container orchestration starts from `docker-compose.yml` or `docker-compose.server.yml`.

#### Client applications
The primary browser client is a Vue SPA with routing, API clients, notebook editing, course/contest/problem pages, and profile/auth flows. It communicates with Django HTTP APIs and likely streaming/WebSocket execution endpoints.
- `frontend/src/main.js`
- `frontend/src/router/index.js`
- `frontend/src/components/NotebookCodeEditor.vue`

A separate Vue dashboard supplies operational/metrics-facing UI.
- `dashboard/src/main.js`
- `dashboard/src/pages/DashboardPage.vue`
- `dashboard/src/api/dashboard.js`

#### Django application boundary
`runner` is the domain application. URL dispatch separates server-rendered/application views from API endpoints; serializers form the API representation boundary, while forms support browser-oriented mutation flows.
- `backend/runner/urls.py`
- `backend/runner/api/urls.py`
- `backend/runner/api/serializers/submissions.py`

Core persisted entities cover problems and attached datasets, notebook/cell workspaces, submissions/reports, contests/leaderboards, and hierarchical courses/sections.
- `backend/runner/models/problem.py`
- `backend/runner/models/notebook.py`
- `backend/runner/models/submission.py`

#### Notebook execution pipeline
A user edits notebook cells in the SPA or Django notebook pages, then invokes code-run endpoints. Execution requests are routed into streaming/runtime and worker services; output, artifacts, and reports return to views/API and are persisted against notebook/cell/submission records.
- `backend/runner/api/views/run_cell.py`
- `backend/runner/api/views/run_cell_stream.py`
- `backend/runner/services/streaming_runs.py`

Notebook lifecycle operations—create/import/export, device updates, cell ordering, and output persistence—are distinct view-level controls around the same notebook domain.
- `backend/runner/views/create_notebook.py`
- `backend/runner/views/import_notebook.py`
- `backend/runner/views/save_cell_output.py`

#### Isolated compute and async control plane
Untrusted or resource-intensive code is isolated behind VM/container management. Backend services define VM configurations, lifecycle management, agent communication, execution backends, and worker behavior. Celery tasks provide asynchronous dispatch; the exact broker is configuration-dependent.
- `backend/runner/services/vm_manager.py`
- `backend/runner/services/vm_agent.py`
- `backend/runner/services/executor.py`

Supporting container/VM image bootstrap is maintained separately from the web backend.
- `backend/docker/Dockerfile`
- `backend/docker/docker_build.py`
- `backend/docker/vm_bootstrap.py`

#### Evaluation, datasets, and submissions
Problems have on-disk train/test/answer/sample-submission assets under media storage. Submission handling passes results through validation, checking, scoring/custom metrics, and report parsing before exposing submission detail, rankings, and results.
- `backend/media/problem_data/10/train/train.csv`
- `backend/runner/services/checker.py`
- `backend/runner/services/problem_scoring.py`

Prevalidation supports earlier feedback before final evaluation.
- `backend/runner/services/prevalidation_service.py`
- `backend/runner/models/prevalidation.py`
- `backend/runner/views/receive_test_result.py`

#### Learning and competition layer
Courses organize sections and participants; contests attach ordered problems, access/moderation rules, notifications, leaderboards, and submissions. Permission services are the key authorization boundary across student, teacher, and contest actions.
- `backend/runner/models/course.py`
- `backend/runner/models/contest.py`
- `backend/runner/services/permissions.py`

#### Infrastructure and external services
The deployment stack uses Docker, Nginx, Django ASGI/WSGI, SQLite in the checked-in local setup, and Prometheus configuration for monitoring. CAPTCHA integration is explicitly encapsulated, and WebSocket notifications/routing support live updates.
- `nginx.server.conf`
- `monitoring/prometheus.yml`
- `backend/runner/services/captcha.py`

Main entry points: [`backend/runner/api/urls.py`](https://github.com/gurovic/booml/blob/main/backend/runner/api/urls.py) (Runner API), [`backend/runner/models/submission.py`](https://github.com/gurovic/booml/blob/main/backend/runner/models/submission.py) (Submission domain), [`backend/core/asgi.py`](https://github.com/gurovic/booml/blob/main/backend/core/asgi.py) (Django ASGI entry), [`backend/runner/services/streaming_runs.py`](https://github.com/gurovic/booml/blob/main/backend/runner/services/streaming_runs.py) (Streaming runs)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_clients["Client apps"]
  node_spa["Learning SPA<br/>Vue application<br/>[main.js]"]
  node_editor["Notebook editor<br/>Vue component"]
  node_dashboard["Operations dashboard<br/>Vue application<br/>[main.js]"]
end

subgraph group_backend["Django platform"]
  node_asgi["Django ASGI entry<br/>ASGI application<br/>[asgi.py]"]
  node_routing["Application routing<br/>Django URL dispatch<br/>[urls.py]"]
  node_api["Runner API<br/>Django REST API<br/>[urls.py]"]
  node_notebook[("Notebook domain<br/>Django models<br/>[notebook.py]")]
  node_learning[("Courses and contests<br/>Django models<br/>[contest.py]")]
  node_permissions["Permission service<br/>authorization service<br/>[permissions.py]"]
  node_run_api["Run-cell endpoints<br/>streaming API views<br/>[run_cell_stream.py]"]
  node_streaming["Streaming runs<br/>execution service<br/>[streaming_runs.py]"]
end

subgraph group_compute["Execution control plane"]
  node_executor{{"Execution backend<br/>runtime service<br/>[executor.py]"}}
  node_vm_manager{{"VM lifecycle manager<br/>compute service<br/>[vm_manager.py]"}}
  node_vm_agent["VM agent<br/>runtime agent protocol<br/>[vm_agent.py]"]
  node_bootstrap["Runtime image bootstrap<br/>container build<br/>[vm_bootstrap.py]"]
end

subgraph group_evaluation["Evaluation"]
  node_submission[("Submission domain<br/>Django models<br/>[submission.py]")]
  node_checker["Result checker<br/>evaluation service<br/>[checker.py]"]
  node_scoring["Problem scoring<br/>scoring service<br/>[problem_scoring.py]"]
  node_problem_data["Problem datasets<br/>media assets<br/>[train.csv]"]
end

subgraph group_ops["Deployment and operations"]
  node_compose["Container stack<br/>Docker Compose<br/>[docker-compose.yml]"]
  node_prometheus["Prometheus monitoring<br/>monitoring configuration<br/>[prometheus.yml]"]
end

node_spa -->|"hosts"| node_editor
node_spa -->|"HTTP APIs"| node_asgi
node_editor -->|"run code"| node_run_api
node_dashboard -->|"operational APIs"| node_asgi
node_asgi -->|"dispatches"| node_routing
node_routing -->|"API routes"| node_api
node_api -->|"reads and writes"| node_notebook
node_api -->|"serves"| node_learning
node_api -->|"authorizes through"| node_permissions
node_run_api -->|"starts streamed run"| node_streaming
node_streaming -->|"dispatches execution"| node_executor
node_executor -->|"acquires runtime"| node_vm_manager
node_vm_manager -->|"controls"| node_vm_agent
node_bootstrap -->|"provides runtime image"| node_vm_manager
node_streaming -->|"persists output"| node_notebook
node_executor -->|"produces result"| node_submission
node_submission -->|"evaluates"| node_checker
node_checker -->|"computes score"| node_scoring
node_checker -->|"uses expected data"| node_problem_data
node_scoring -->|"stores report"| node_submission
node_submission -->|"updates rankings"| node_learning
node_compose -->|"runs"| node_asgi
node_compose -->|"includes monitoring"| node_prometheus

click node_spa "https://github.com/gurovic/booml/blob/main/frontend/src/main.js"
click node_editor "https://github.com/gurovic/booml/blob/main/frontend/src/components/NotebookCodeEditor.vue"
click node_dashboard "https://github.com/gurovic/booml/blob/main/dashboard/src/main.js"
click node_asgi "https://github.com/gurovic/booml/blob/main/backend/core/asgi.py"
click node_routing "https://github.com/gurovic/booml/blob/main/backend/runner/urls.py"
click node_api "https://github.com/gurovic/booml/blob/main/backend/runner/api/urls.py"
click node_notebook "https://github.com/gurovic/booml/blob/main/backend/runner/models/notebook.py"
click node_learning "https://github.com/gurovic/booml/blob/main/backend/runner/models/contest.py"
click node_permissions "https://github.com/gurovic/booml/blob/main/backend/runner/services/permissions.py"
click node_run_api "https://github.com/gurovic/booml/blob/main/backend/runner/api/views/run_cell_stream.py"
click node_streaming "https://github.com/gurovic/booml/blob/main/backend/runner/services/streaming_runs.py"
click node_executor "https://github.com/gurovic/booml/blob/main/backend/runner/services/executor.py"
click node_vm_manager "https://github.com/gurovic/booml/blob/main/backend/runner/services/vm_manager.py"
click node_vm_agent "https://github.com/gurovic/booml/blob/main/backend/runner/services/vm_agent.py"
click node_bootstrap "https://github.com/gurovic/booml/blob/main/backend/docker/vm_bootstrap.py"
click node_submission "https://github.com/gurovic/booml/blob/main/backend/runner/models/submission.py"
click node_checker "https://github.com/gurovic/booml/blob/main/backend/runner/services/checker.py"
click node_scoring "https://github.com/gurovic/booml/blob/main/backend/runner/services/problem_scoring.py"
click node_problem_data "https://github.com/gurovic/booml/blob/main/backend/media/problem_data/10/train/train.csv"
click node_compose "https://github.com/gurovic/booml/blob/main/docker-compose.yml"
click node_prometheus "https://github.com/gurovic/booml/blob/main/monitoring/prometheus.yml"

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_spa,node_editor,node_dashboard toneBlue
class node_asgi,node_routing,node_api,node_notebook,node_learning,node_permissions,node_run_api,node_streaming toneAmber
class node_executor,node_vm_manager,node_vm_agent,node_bootstrap toneMint
class node_submission,node_checker,node_scoring,node_problem_data toneRose
class node_compose,node_prometheus toneIndigo
```

## Components

### Client apps

- [Learning SPA](https://github.com/gurovic/booml/blob/main/frontend/src/main.js): Vue application · Notebook, course, contest, and account UI. · `frontend/src/main.js`
- [Notebook editor](https://github.com/gurovic/booml/blob/main/frontend/src/components/NotebookCodeEditor.vue): Vue component · `frontend/src/components/NotebookCodeEditor.vue`
- [Operations dashboard](https://github.com/gurovic/booml/blob/main/dashboard/src/main.js): Vue application · Metrics-facing operational UI. · `dashboard/src/main.js`

### Django platform

- [Django ASGI entry](https://github.com/gurovic/booml/blob/main/backend/core/asgi.py): ASGI application · Serves HTTP and live execution connections. · `backend/core/asgi.py`
- [Application routing](https://github.com/gurovic/booml/blob/main/backend/runner/urls.py): Django URL dispatch · Separates browser views from API routes. · `backend/runner/urls.py`
- [Runner API](https://github.com/gurovic/booml/blob/main/backend/runner/api/urls.py): Django REST API · API representation and mutation boundary. · `backend/runner/api/urls.py`
- [Notebook domain](https://github.com/gurovic/booml/blob/main/backend/runner/models/notebook.py): Django models · Persists notebooks, cells, outputs, and submissions. · `backend/runner/models/notebook.py`
- [Courses and contests](https://github.com/gurovic/booml/blob/main/backend/runner/models/contest.py): Django models · Organizes participants, sections, problems, and leaderboards. · `backend/runner/models/contest.py`
- [Permission service](https://github.com/gurovic/booml/blob/main/backend/runner/services/permissions.py): authorization service · Authorizes student, teacher, and contest actions. · `backend/runner/services/permissions.py`
- [Run-cell endpoints](https://github.com/gurovic/booml/blob/main/backend/runner/api/views/run_cell_stream.py): streaming API views · Accepts execution requests and streams output. · `backend/runner/api/views/run_cell_stream.py`
- [Streaming runs](https://github.com/gurovic/booml/blob/main/backend/runner/services/streaming_runs.py): execution service · Coordinates live runtime output with request handlers. · `backend/runner/services/streaming_runs.py`

### Execution control plane

- [Execution backend](https://github.com/gurovic/booml/blob/main/backend/runner/services/executor.py): runtime service · Dispatches code to isolated execution environments. · `backend/runner/services/executor.py`
- [VM lifecycle manager](https://github.com/gurovic/booml/blob/main/backend/runner/services/vm_manager.py): compute service · Provisions and manages isolated VM/container runtimes. · `backend/runner/services/vm_manager.py`
- [VM agent](https://github.com/gurovic/booml/blob/main/backend/runner/services/vm_agent.py): runtime agent protocol · Communicates execution commands to managed runtimes. · `backend/runner/services/vm_agent.py`
- [Runtime image bootstrap](https://github.com/gurovic/booml/blob/main/backend/docker/vm_bootstrap.py): container build · Builds and initializes execution images. · `backend/docker/vm_bootstrap.py`

### Evaluation

- [Submission domain](https://github.com/gurovic/booml/blob/main/backend/runner/models/submission.py): Django models · Persists results and evaluation reports. · `backend/runner/models/submission.py`
- [Result checker](https://github.com/gurovic/booml/blob/main/backend/runner/services/checker.py): evaluation service · Validates outputs and evaluates submitted results. · `backend/runner/services/checker.py`
- [Problem scoring](https://github.com/gurovic/booml/blob/main/backend/runner/services/problem_scoring.py): scoring service · Applies scoring and custom metrics. · `backend/runner/services/problem_scoring.py`
- [Problem datasets](https://github.com/gurovic/booml/blob/main/backend/media/problem_data/10/train/train.csv): media assets · Train, test, answer, and sample-submission files. · `backend/media/problem_data/10/train/train.csv`

### Deployment and operations

- [Container stack](https://github.com/gurovic/booml/blob/main/docker-compose.yml): Docker Compose · Starts the platform service topology. · `docker-compose.yml`
- [Prometheus monitoring](https://github.com/gurovic/booml/blob/main/monitoring/prometheus.yml): monitoring configuration · `monitoring/prometheus.yml`

## Connections

- Learning SPA → Notebook editor: hosts
- Learning SPA → Django ASGI entry: HTTP APIs
- Notebook editor → Run-cell endpoints: run code
- Operations dashboard → Django ASGI entry: operational APIs
- Django ASGI entry → Application routing: dispatches
- Application routing → Runner API: API routes
- Runner API → Notebook domain: reads and writes
- Runner API → Courses and contests: serves
- Runner API → Permission service: authorizes through
- Run-cell endpoints → Streaming runs: starts streamed run
- Streaming runs → Execution backend: dispatches execution
- Execution backend → VM lifecycle manager: acquires runtime
- VM lifecycle manager → VM agent: controls
- Runtime image bootstrap → VM lifecycle manager: provides runtime image
- Streaming runs → Notebook domain: persists output
- Execution backend → Submission domain: produces result
- Submission domain → Result checker: evaluates
- Result checker → Problem scoring: computes score
- Result checker → Problem datasets: uses expected data
- Problem scoring → Submission domain: stores report
- Submission domain → Courses and contests: updates rankings
- Container stack → Django ASGI entry: runs
- Container stack → Prometheus monitoring: includes monitoring
