An interactive, gamified platform for learning Rust programming. RustGym features a quest-based curriculum with 500+ coding challenges, Docker-isolated code execution, gamification mechanics (XP, levels, streaks, achievements, leaderboards), community features, and a CLI tool for local development.
🚧 Development Status : This project is actively in development and not yet hosted . The backend requires local setup (see below). Contributions, feedback, and discussions are welcome!
🌐 Frontend Preview : The UI is deployed at https://rustgym.vercel.app/ (frontend only — requires a local backend to be fully functional).
💬 Open for Contribution : If you're interested in contributing, please open an issue or discussion. All skill levels welcome.
Service
Technology
Port
Status
Frontend
React 19 + TypeScript + Vite
5173
✅
Backend API
Rust / Axum 0.7
3000
✅
Runner Service
Rust / Axum + Docker
3001
✅
CLI Tool
Rust / Ratatui TUI
—
✅
Database
PostgreSQL 16
5432
✅
Cache
Redis 7
6379
✅
Object Storage
MinIO (S3-compatible)
9000
✅
Reverse Proxy
Nginx
80/443
✅
✅ Phase 0: Monorepo Bootstrap
Vite + React 19 + TypeScript frontend with Tailwind CSS, shadcn/ui, Zustand, TanStack Query, React Router
Rust/Axum backend with SeaORM, JWT auth, Argon2 password hashing
Runner microservice with Docker executor
Docker Compose for local infrastructure (Postgres, Redis, MinIO)
GitHub Actions CI pipeline (lint, build, test for all services)
✅ Phase 1: Authentication & User System
User registration with email/password (Argon2 hashing)
JWT access tokens (15min) + refresh tokens (30-day, rotated)
Login, logout, token refresh, email verification (stub), password reset
Protected user profile routes (GET/PUT /users/me, GET /users/:username)
JWT auth middleware with CurrentUser extractor
Redis-backed rate limiting (20/min auth, 200/min global) with graceful degradation
CORS configured for frontend origin
Database entities & migrations for quests, levels, tasks, progress tables
Curriculum seeder binary with manifest.json (8 quests, 65 levels)
API routes for browsing quests/levels/tasks with progress tracking
✅ Phase 3: Code Execution Engine
Docker-sandboxed code execution with resource limits
cargo test runner with output parsing
Submission API with async execution and result storage
XP system with level progression
Daily streaks with freeze mechanics
Achievement system (20+ achievements with unlock conditions)
Global and quest-specific leaderboards
✅ Phase 5: Community
Forum with posts and replies
Article publishing system
Peer code reviews
Content management (quests, levels, tasks)
User management and moderation
✅ Phase 7: CLI Tool & Deployment
CLI tool for login, browsing, downloading, and submitting challenges
Production Docker Compose with resource limits
Nginx reverse proxy with TLS termination
OpenAPI documentation at /api/docs
rustgym/
├── frontend/ # React SPA (Vite + TypeScript + Tailwind)
│ ├── src/
│ │ ├── pages/ # Route-level components
│ │ ├── components/ # Reusable UI (layout, editor, quest, gamification)
│ │ ├── stores/ # Zustand state (auth, editor, ui)
│ │ ├── services/ # API client with interceptors
│ │ ├── hooks/ # Custom React hooks
│ │ ├── types/ # Shared TypeScript interfaces
│ │ └── lib/ # Utilities (cn, constants)
│ └── tailwind.config.js # Design tokens
├── backend/ # Rust API server (Axum + SeaORM)
│ ├── src/
│ │ ├── routes/ # HTTP handlers
│ │ ├── services/ # Business logic
│ │ ├── middleware/ # Auth, rate limiting, CORS
│ │ ├── dto/ # Request/response types
│ │ ├── config.rs # Environment config
│ │ └── error.rs # AppError with IntoResponse
│ ├── entity/ # SeaORM entities
│ └── migration/ # Database migrations
├── runner/ # Code execution microservice
│ ├── src/main.rs # Axum server with /run/test and /run/playground
│ ├── Dockerfile # Multi-stage build with Docker CLI
│ └── sandbox.Dockerfile # Isolated sandbox image
├── cli/ # Interactive TUI (Ratatui + crossterm)
│ ├── src/
│ │ ├── main.rs # Entry point, terminal setup, event loop
│ │ ├── app.rs # App state machine, screen dispatch
│ │ ├── action.rs # Action enum (navigation, API, editor)
│ │ ├── event.rs # Event stream (keyboard, tick, API responses)
│ │ ├── editor.rs # Editor resolution and launch
│ │ ├── config.rs # Config file (~/.rustgym/config.toml)
│ │ ├── api/ # HTTP client (auth, quests, tasks, submit)
│ │ ├── screens/ # Screen handlers (login, quest list, detail, submit)
│ │ └── widgets/ # Reusable TUI widgets (status bar, spinner, list)
│ └── tests/ # Property-based tests (proptest)
├── challenges/ # Curriculum content
│ └── manifest.json # 8 quests, 65 levels definition
├── nginx/ # Reverse proxy configuration
│ └── nginx.conf # TLS termination, gzip, rate limiting
├── .github/workflows/ # CI/CD pipelines
├── docker-compose.yml # Local dev infrastructure
├── docker-compose.prod.yml # Production deployment
└── .env.example # Environment variable template
Quick Start (recommended)
The dev.sh script handles everything — infrastructure, backend, runner, and frontend:
git clone < repository-url>
cd rustgym
cp .env.example .env
# Start all services with one command
bash dev.sh
This will:
Start Docker infrastructure (PostgreSQL, Redis, MinIO)
Wait for databases to be ready
Start the backend API (port 3000, auto-runs migrations)
Start the runner service (port 3001, code execution sandbox)
Start the frontend dev server (port 5173)
Once running, open http://localhost:5173 to see the app.
bash dev.sh # Start everything
bash dev.sh stop # Stop all services
bash dev.sh seed # Seed curriculum data (quests, levels, tasks)
bash dev.sh logs # Tail backend logs
After first startup, seed the database with quests and challenges:
Once the backend is running locally:
cd cli
cargo run -- --api-url http://localhost:3000
Manual Setup (alternative)
If you prefer to start services individually:
# 1. Start infrastructure
docker compose up -d postgres redis minio
# 2. Run the backend (auto-runs migrations)
cargo run --manifest-path backend/Cargo.toml
# 3. Seed curriculum data
cargo run --manifest-path backend/Cargo.toml --bin seed
# 4. Start the frontend
cd frontend && pnpm install && pnpm dev
Open http://localhost:5173 — you'll see the landing page.
Method
Path
Description
GET
/api/v1/health
Service status
Method
Path
Description
POST
/register
Create account
POST
/login
Sign in
POST
/refresh
Rotate tokens
POST
/logout
Revoke refresh token
POST
/verify-email
Verify email (stub)
POST
/forgot-password
Request reset (stub)
POST
/reset-password
Reset password
Method
Path
Description
GET
/me
Get own profile (auth)
PUT
/me
Update profile (auth)
GET
/:username
Get public profile
GET
/me/achievements
User achievements
Leaderboard (/api/v1/users/leaderboard)
Method
Path
Description
GET
/
Global XP leaderboard
Method
Path
Description
GET
/
List all quests
GET
/:slug
Get quest details
Method
Path
Description
GET
/
List tasks (filterable)
GET
/:slug
Get task details
Submissions (/api/v1/submissions)
Method
Path
Description
POST
/
Submit code
GET
/
List user submissions
GET
/:id
Get submission result
Method
Path
Description
GET
/posts
List forum posts
POST
/posts
Create post
GET
/posts/:id
Get post
POST
/posts/:id/replies
Reply to post
Articles (/api/v1/articles)
Method
Path
Description
GET
/
List articles
POST
/
Create article
GET
/:id
Get article
Reviews (/api/v1/reviews)
Method
Path
Description
GET
/
List reviews
POST
/
Create review
Method
Path
Description
GET
/users
List all users
PUT
/users/:id
Update user role
GET
/stats
Platform statistics
Path
Description
/api/docs
Swagger UI (interactive)
The RustGym CLI is a full-screen interactive TUI for solving challenges from your terminal. See the CLI README for full documentation.
cd cli
cargo install --path .
rustgym
Vim-style navigation (j/k/Enter/b)
Persistent login sessions
Opens challenges in your editor (nvim/vim/vi/$EDITOR)
Submit solutions and see results inline
Progress tracking with XP display
Configuration is stored in ~/.rustgym/config.toml.
Docker and Docker Compose v2
Domain with DNS pointing to your server
TLS certificates (e.g., from Let's Encrypt)
Clone the repository and configure environment:
git clone < repository-url>
cd rustgym
cp .env.example .env
# Edit .env with production values (strong JWT_SECRET, real POSTGRES_PASSWORD, etc.)
Place TLS certificates:
mkdir -p nginx/certs
cp /path/to/fullchain.pem nginx/certs/
cp /path/to/privkey.pem nginx/certs/
Build and start all services:
docker compose -f docker-compose.prod.yml up -d --build
Seed curriculum data:
docker compose -f docker-compose.prod.yml exec backend /app/seed
Verify deployment:
curl https://your-domain.com/api/v1/health
# {"status":"ok","service":"rustgym-backend"}
Service
Memory Limit
CPU Limit
Backend
512 MB
1.0
Frontend
128 MB
0.5
Runner
1 GB
2.0
Nginx
128 MB
0.5
Postgres
512 MB
1.0
Redis
256 MB
0.5
Global: 200 requests/minute per IP (Redis-backed sliding window)
Auth routes: 20 requests/minute per IP
Nginx layer: 200 req/min with burst of 50
# Frontend lint + build
cd frontend && pnpm lint && pnpm build
# Backend check + test
cd backend && cargo clippy -- -D warnings && cargo test
# Runner check
cd runner && cargo clippy -- -D warnings
# CLI check
cd cli && cargo clippy -- -D warnings
Primary : #CE422B (Rust orange-red)
Dark theme : #0B0B0A → #242320 (4-level depth)
Fonts : JetBrains Mono (code), Barlow Condensed (display), Barlow (body)
UI : shadcn/ui primitives, Framer Motion animations, Lucide icons
Layer
Technologies
Frontend
React 19, TypeScript, Vite, Tailwind CSS 3, shadcn/ui, Zustand, TanStack Query v5, React Router, Framer Motion, Monaco Editor
Backend
Rust, Axum 0.7, SeaORM, Tokio, jsonwebtoken, Argon2, tower-http
Runner
Rust, Axum, Bollard (Docker API), syn (AST parsing)
CLI
Rust, Ratatui, crossterm, Tokio, reqwest
Database
PostgreSQL 16, Redis 7, MinIO
DevOps
Docker Compose, GitHub Actions
All rights reserved.