Skip to content

tolgayayci/stylus-academy

Repository files navigation

Stylus Sorcery Academy

An interactive learning platform for Arbitrum Stylus smart contract development. The curriculum teaches Rust-based contract development through a wizardry theme — 51 lessons across three difficulty tiers, with XP, levels, achievement badges, and public completion certificates.

Live at stylus.academy.


Tech Stack

Layer Technology
Frontend React 19, Vite, Tailwind CSS, shadcn/ui
Editor Monaco Editor with Rust syntax highlighting
State Zustand (global), TanStack Query (server), useState (local)
Backend Node.js, Fastify, TypeScript
Database Supabase — PostgreSQL, Auth, Row Level Security
Code execution Docker container — Rust 1.81, cargo-stylus
Monorepo Turborepo, pnpm workspaces

Prerequisites

  • Node 20+
  • pnpm 9+
  • Docker
  • A Supabase project

Running Locally

1. Install dependencies

pnpm install

2. Configure environment variables

cp apps/web/.env.example apps/web/.env
cp apps/api/.env.example apps/api/.env

apps/web/.env

VITE_API_URL=http://localhost:3001
VITE_SUPABASE_URL=your-project-url
VITE_SUPABASE_ANON_KEY=your-anon-key

apps/api/.env

PORT=3001
SUPABASE_URL=your-project-url
SUPABASE_SERVICE_KEY=your-service-role-key
DOCKER_CONTAINER_NAME=stylus-runner

3. Set up the database

pnpm db:push    # push schema.sql to Supabase
pnpm db:seed    # seed curriculum data

4. Start the Rust compiler container

docker-compose -f docker/docker-compose.yml up -d

5. Start the dev servers

pnpm dev

Frontend runs on http://localhost:3000, API on http://localhost:3001.


Common Commands

pnpm dev           # start all apps
pnpm dev:web       # frontend only
pnpm dev:api       # API only
pnpm build         # build all apps
pnpm lint          # lint all apps
pnpm test          # run all tests

Code Submission Flow

  1. User writes Rust in the Monaco editor
  2. Frontend posts to /api/exercises/:id/submit
  3. API saves the submission with status running
  4. API calls docker exec into stylus-runner to compile and run tests
  5. Results are written back to Supabase and returned to the client

The compiler container runs with no network access and strict resource limits. Each submission gets an isolated directory that is removed after compilation.


Contributing

See CONTRIBUTING.md for the full guide.

The short version:

  • Branch from main — use feature/short-description or fix/short-description
  • Keep PRs small and focused on one change
  • Run pnpm lint and pnpm build before opening a PR
  • For any UI change, include a screenshot in the PR description
  • For curriculum changes, walk through the lesson manually on a fresh account before submitting

License

MIT — Tolga Yaycı

About

An interactive learning platform for Arbitrum Stylus smart contract development.

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Contributors

Languages