Developer guide
How the app, the sandbox, the SDK, storage, Firebase and OpenRouter fit together.
Repository
apps/web: the app (Vite + React).src/app/services.tsxis the one place that picks local or Firebase storage.apps/sandbox: the page that runs tool code, served from a separate site with strict security headers.apps/server: the local API for generation with a server key (loopback only, for development).apps/worker: the Cloudflare Worker for free hosted AI (budgets and allowances in D1) and feedback issues.packages/protocol: shared types and zod schemas.packages/sdk: the Practice SDK tools are written against.packages/generator: prompts, validation and repair.templates/: the built-in tools, which double as SDK integration tests and examples for the generator.
Run it
Node 22.12 or newer, then npm install and npm run dev. That starts the app on localhost:5173, the sandbox on 127.0.0.1:5174 and the API on 127.0.0.1:8787. The app and sandbox must stay on different hosts so the browser isolates them.
npm run check runs the type check, unit tests (Vitest) and browser tests (Playwright).
Tools and the sandbox
A tool is one HTML file with a JSON manifest (title, category, permissions, settings). It runs in an opaque-origin iframe with a content security policy that blocks networking, and talks to the app only through a validated message protocol. The SDK gives it a shared clock, instrument sounds, theory, notation, scoring, microphone and MIDI events, settings, results and per-tool storage. See packages/sdk/REFERENCE.md and docs/security/sandbox-security.md.
Storage
Guests use IndexedDB. Signed in, the same repositories are backed by Firestore under users/{uid}, with offline persistence; firestore.rules scopes every private record to its owner. Without Firebase settings the app runs fully local, which is how the automated tests run.
AI
Generation goes through OpenRouter, so any model it lists works. Bring-your-own-key requests go straight from the browser. Free hosted AI goes through the Worker, which verifies the Firebase sign-in, picks the model, reserves budget, streams events and charges what OpenRouter reports. npm run bench compares models on fixed prompts.
Deployment and setup on a new machine are in docs/handoff.md; public pages and indexing in docs/features/search-and-indexing.md.