How megazordpobeda/datarush works
Purpose and entry points
DataRush is a containerized platform for data-analysis competitions: users authenticate, join competitions, submit task solutions, receive asynchronous checking results, and view reviews, achievements, and standings. Docker Compose is the deployment entry point: compose.yaml. Public routes are served through infrastructure/nginx/nginx.conf; primary interfaces are the React UI, Django API/admin, Grafana, and learning documentation.
Edge and client application
Nginx fronts the stack and routes the browser to the frontend and backend-facing services. The React/Vite/TypeScript SPA owns user-facing competition flows, including session task answering and submission state:
• services/frontend/src/main.tsx
• services/frontend/src/App.tsx
• services/frontend/src/pages/CompetitionSession/index.tsx
Its API boundary is centralized under services/frontend/src/shared/api/, with authentication/session data managed separately from page widgets.
Backend API and domain core
The backend is Django with Django Ninja REST endpoints. Django bootstraps ASGI/WSGI, settings, URL routing, and Celery:
• services/backend/config/settings.py
• services/backend/config/urls.py
• services/backend/api/v1/router.py
API resources map to domain apps rather than placing persistence logic in the frontend: competition, task, team, user, review, and achievement endpoints are under services/backend/api/v1/; corresponding models and lifecycle signals live under services/backend/apps/.
Competition lifecycle and persistence
PostgreSQL is the system of record for users, teams, competitions, tasks, submissions, reviews, and achievement state. Competition state changes and review/user signals express cross-domain lifecycle effects:
• services/backend/apps/competition/models.py
• services/backend/apps/task/models.py
• services/backend/apps/review/models.py
Django admin provides operational management and a competition leaderboard template. Database initialization/data generation is performed through backend scripts and management commands, rather than by the client.
Submission and asynchronous checking
A solution submitted from the competition-session UI reaches backend task APIs, is queued through Celery, then sent to the checker integration. Task worker orchestration and checker health boundary are located at:
• services/backend/apps/task/tasks.py
• services/backend/config/celery.py
• services/backend/integrations/checker/healthcheck.py
Redis is the Celery broker/result-supporting runtime, configured as infrastructure alongside PostgreSQL. This separates request handling from potentially slow or unsafe user-code execution.
Checker isolation boundary
The checker is an independent FastAPI service with an /execute endpoint. It runs user submissions in disposable Docker containers with fixed CPU, memory, dependency, and execution-time limits; it is the security boundary for arbitrary code:
• services/checker/main.py
• services/checker/config.py
• services/checker/Dockerfile.checker
The backend/checker contract is service-to-service and should remain independent of frontend types or UI workflow.
Operations, observability, and supporting services
Compose assembles backend, frontend, checker, PostgreSQL, Redis, and supporting services. MinIO provides object-storage infrastructure; documentation is a separate Docusaurus service. Prometheus gathers metrics, exporters expose Postgres/Redis/Celery metrics, and Grafana provisions dashboards:
• compose.yaml
• infrastructure/prometheus/prometheus.yaml
• infrastructure/grafana/provisioning/dashboards/providers.yaml
Operational ingress, monitoring, and admin tools are infrastructure concerns, not backend domain dependencies.
Main entry points: nginx.conf Nginx ingress · router.py Django Ninja API · compose.yaml Docker Compose · celery.py Celery runtime
Components 18
Edge & clients
- Nginx ingress
infrastructure/nginx/nginx.conf - React competition UI · Owns session answering and submission state.
services/frontend/src/pages/CompetitionSession/index.tsx - Frontend API client
- Learning documentation
Application services
- Django Ninja API · Routes domain resources for competitions, tasks, teams, users, reviews, and achievements.
services/backend/api/v1/router.py - Django domain core · Models and signals implement competition lifecycle effects.
services/backend/apps/competition/models.py - Django admin · Provides operational management and leaderboard views.
services/backend/config/urls.py - Task orchestration · Dispatches submitted solutions for asynchronous checking.
services/backend/apps/task/tasks.py - Isolated checker · Executes untrusted submissions in disposable constrained containers.
services/checker/main.py - Checker sandbox image · Defines execution dependencies and resource limits.
services/checker/Dockerfile.checker
Async & data runtime
- Celery runtime
services/backend/config/celery.py - Redis · Celery broker and result-supporting runtime.
- PostgreSQL · Stores users, teams, competitions, tasks, submissions, reviews, and achievements.
- MinIO
Operations
- Docker Compose · Assembles the platform services.
compose.yaml - Prometheus
infrastructure/prometheus/prometheus.yaml - Runtime exporters · Expose PostgreSQL, Redis, and Celery metrics.
- Grafana dashboards
infrastructure/grafana/provisioning/dashboards/providers.yaml
Connections 23
- Docker Compose → Nginx ingress: deploys
- Docker Compose → Django Ninja API: deploys
- Docker Compose → React competition UI: deploys
- Docker Compose → Isolated checker: deploys
- Nginx ingress → React competition UI: serves
- Nginx ingress → Django Ninja API: routes API/admin
- Nginx ingress → Grafana dashboards: routes
- Nginx ingress → Learning documentation: routes
- React competition UI → Frontend API client: uses
- Frontend API client → Django Ninja API: REST requests
- Django Ninja API → Django domain core: invokes domain logic
- Django Ninja API → Task orchestration: queues submissions
- Django domain core → PostgreSQL: persists lifecycle state
- Django admin → Django domain core: manages
- Task orchestration → Celery runtime: dispatches
- Celery runtime → Redis: uses broker/results
- Celery runtime → Isolated checker: execute contract
- Isolated checker → Checker sandbox image: launches sandbox
- Runtime exporters → PostgreSQL: collects metrics
- Runtime exporters → Redis: collects metrics
- Runtime exporters → Celery runtime: collects metrics
- Prometheus → Runtime exporters: scrapes
- Grafana dashboards → Prometheus: queries metrics