Custom music-practice tools, built by AI from your lessons and ideas. Each tool is a small web app written against the Practice SDK and run in a locked-down sandbox: it can do anything inside its own page, but it can't reach the network, your account or the rest of the app.
Try the free practice tools at Practice Lab Music.
See the roadmap for the original rewrite, shipped phases, and planned work.
Requires Node 22.12 or newer (.nvmrc pins 26).
npm install
npm run devOpen http://localhost:5173:
| Page | What |
|---|---|
/ Library |
Describe what you want to practice, open your tools, import a tool file, or browse templates |
/t/:id |
One of your tools, full size, with Export and Delete |
/t/:id/edit |
The workshop: change the tool with AI or by hand, switch versions, see its console |
/new |
The workshop for a new tool |
/templates/:file and …/edit |
A template; changing it saves your own copy |
Your tools and every version of them are saved in the browser (IndexedDB), so they survive
reloads. Export a tool as a single .html file to keep or share it; importing a file for a tool
you already have adds it as a new version.
npm run dev starts three servers:
| Server | URL | What |
|---|---|---|
| web | http://localhost:5173 | The app (Vite + React); /api is proxied to the API server |
| sandbox | http://127.0.0.1:5174 | The sandbox page that runs tool code, rebuilt on change and served with production security headers |
| api | http://127.0.0.1:8787 | Tool generation with the server's OpenRouter key (loopback only) |
The app and sandbox must stay on different hosts (localhost vs 127.0.0.1) so the browser
isolates them.
Generation runs on OpenRouter, so any model it lists can be used. The
default is anthropic/claude-opus-5.5. There are two ways to provide a key:
- In the app (bring your own key): click Add API key in the AI bar. The dialog walks through creating an OpenRouter account, adding credits and creating a key with a credit limit. The key is encrypted in your browser and sent only to openrouter.ai; requests go straight from the browser to OpenRouter. This is the only option on the deployed site.
- On the server: copy
.env.exampleto.envand setOPENROUTER_API_KEY. Everyone using this install can then generate without a key of their own. A key saved in the browser takes precedence.
Pick the model (any OpenRouter id; recommended ones are listed first) and the effort in the AI bar; both are remembered. Build new tool writes a tool from your description and, optionally, lesson notes. Change this tool edits the tool you're looking at. If a generated tool throws when it loads, its errors go back to the model for up to two automatic fixes; Fix with AI in the console does the same on demand. Every result is kept as a version you can switch back to.
Calendar (/calendar; it replaced the old Today page, and /today forwards there) is where
practice is planned and tracked:
- Week view: each day shows its planned routines (Start, Move to…, drag to another day, Remove), the sessions finished that day (with their results), a rest-day switch and a note. A day over 75 minutes gets a gentle warning. Month view shows practiced and planned days at a glance.
- Streaks: how many of the last 7 and 30 days had a finished session. No notifications.
- Practice planner: an AI chat beside the calendar ("Plan my week", "I have a recital in three
weeks", "I only have 15 minutes tomorrow"). It reads a summary of your routines, recent sessions
and misses, lessons, settings, the next four weeks and the available tools, and replies with
proposals: schedule, move or remove a routine, rest days, notes, a new routine with drills and
settings, a drill change, or a new tool to build. Nothing changes until you accept a card
(or Accept all). It uses its own, lower-cost model (Settings → AI → Planner model; default
anthropic/claude-haiku-5.5), with your key or the local server's (/api/plan). - The week is stored at
users/{uid}/calendar/{2026-W49}with that week's planner conversation. Whether a planned routine was practiced comes from the sessions, so the two never disagree.
Below the calendar are your routines: drills in order, each a tool opened for a set number of minutes with a goal and, when the tool declares them, preset settings (tempo, level, which intervals…).
- Start walks through the drills with a timer (a chime and a banner when time is up; you decide when to move on), then shows a recap of the time spent and what each tool reported, with a "where to pick up next time" note that the calendar shows next time.
- Make routines from scratch, start from the 10-minute warm-up (intervals, rhythm, chord changes), or press Make a practice routine on a lesson to turn its plan into one.
- Review what you missed: quizzes report what you got wrong, and the next time a routine runs them they bring those items back about half the time ("Bringing back: minor 6th ascending"). The recap says what came back and whether it was still tricky. Each drill can turn this off.
- Tools take part through the SDK (see
packages/sdk/REFERENCE.md): manifestsettings+lab.settingsfor presets,lab.result(...)for the recap, and"review": true+lab.reviewfor bringing misses back. Every built-in tool supports presets and results, the seven quizzes support review, and the AI is taught to do the same in new tools.
Routines and sessions are stored like lessons (users/{uid}/routines, users/{uid}/sessions).
Settings (/settings, also in the header and account menu) are saved to the account when signed
in, otherwise in the browser. Choices save immediately; text fields save as you stop typing.
- Practice: a usual tempo, clef and sound become the starting values for any tool with a
bpm,cleforsoundsetting (only until you change that setting in the tool, and a routine's presets come first). Each defaults to "each tool's own". The routine timer can count up or down. - AI: your instrument and a short "about me" note go with every tool generation and lesson cleanup. Model, effort and the OpenRouter key (the same panel as the key dialog) live here too.
- Appearance: light, dark or follow the device; a compact one-line library.
- Your data: export everything as one JSON file, import an export (tools whose id you already use come in as copies), delete tools, lessons or routines in bulk, clear the browser's guest data, and delete the account with everything in it (including anything published or reviewed).
Community (/community) lists tools people published, with search, a category filter, and
newest or top-rated order. On one of your own tools, Publish to community shares the version you
are looking at under a name you choose; you can publish a newer version or unpublish later. Anyone
can open a published tool and practice with it; others can Add to my library to get their own
copy, or report it.
Every public tool, published or built in, has ratings out of 10 with an optional review: one per person, editable and deletable, with the average shown on cards and pages. Publishers can't rate their own tools.
Stored in Firestore as community/{id} and reviews/{toolKey__uid} (anyone can read; only the
publisher or reviewer can write theirs), averaged with Firestore aggregate queries. Without Firebase
the catalog lives in the browser; e2e tests use that mode by setting
localStorage["practice-lab:community"] = "device".
Lessons (/lessons) keeps notes from music lessons. Paste a transcript (or open a .txt,
.vtt or .srt caption file; timestamps are stripped) or your own notes, then:
- Clean up with AI fixes speech-to-text mistakes ("be flat" → B♭), drops small talk, and writes organized notes plus a practice plan of 2–8 items with minutes, how to practice, and either a built-in template that fits or an idea for a new tool. The original stays with the lesson, and Redo with AI writes the notes again (keeping plan items you checked off or built tools for).
- Build a tool for this on a plan item opens the Workshop and builds a tool from the item, with the lesson's notes as context, and links it back so the item then opens the tool.
- Notes, title, date and plan are editable; plan items can be checked off as practiced.
Lessons are stored like tools: on the device as a guest, in Firestore (users/{uid}/lessons) when
signed in, and moved into the account along with tools. In the Workshop, + Lesson notes can
pull in a saved lesson's notes.
apps/web the app: library, tool page, workshop, lessons, AI bar, ToolFrame + SandboxController, services
apps/sandbox run.html bootstrap, security headers, static server
apps/server generation API (Hono): /api/status, /api/models, /api/generate, /api/lesson
packages/protocol tool manifest, tool file format, host ↔ sandbox and generate API schemas, lint rules
packages/generator OpenRouter client, prompt, validation loop (runs in browser and server)
packages/sdk the Practice SDK, exposed to tools as window.lab
templates/ starter tools, also the AI's examples (see templates/README.md)
tests/e2e Playwright tests, including hostile tools that try to escape
docs/ plan and security model
A tool is one HTML file: a JSON manifest followed by markup, styles and scripts that use
lab. See packages/sdk/REFERENCE.md for the full API, and
templates/ for twelve working tools and the conventions they follow.
<script type="application/lab-manifest">
{ "id": "my-click", "version": 1, "sdkVersion": "0", "title": "My Click", "category": "Metronome" }
</script>
<lab-play-button clock></lab-play-button>
<lab-tempo clock></lab-tempo>
<script>
lab.clock.onBeat(({ time, beat }) => lab.sound.click(time, { accent: beat === 0 }));
</script>npm run typecheck
npm test # unit tests (Vitest)
npm run test:e2e # browser tests (Playwright; reuses running dev servers)First-time e2e setup: npx playwright install chromium --only-shell.
See docs/security/sandbox-security.md for the threat model, what the tests verify, and the known gaps.
Sampled instruments and the drum kit are rendered from MuseScore's MS Basic SoundFont
(MuseScore_General by S. Christian Collins, based on FluidR3; MIT). The rendered MP3s are
committed under apps/sandbox/public/sounds/ms-basic/ together with the SoundFont's license
(LICENSE.md), which must stay with them.
To re-render (after changing packages/sdk/src/sound-catalog.ts), download
MS Basic.sf3 and its
MS Basic_License.md into .cache/soundfonts/, then run npm run sounds. It renders dry and
mono, every third semitone, and prints a pitch check per instrument.
Signed out, the app is fully local: tools live on the device as a guest, and practicing never
needs an account. When apps/web/.env.local holds a Firebase web config, a Sign in button
appears; signing in with Google stores tools, versions, lessons and saved progress in that
account's Firestore, and tools and lessons made as a guest can be moved into the account from the
library.
The dev project is practice-lab-dev-9d0aa3 (.firebaserc), with Firestore in nam5. Security
rules live in firestore.rules; deploy them with:
npx firebase deploy --only firestoreTo use another project, create a web app in it, copy its config into apps/web/.env.local as
VITE_FIREBASE_API_KEY, VITE_FIREBASE_AUTH_DOMAIN, VITE_FIREBASE_PROJECT_ID,
VITE_FIREBASE_APP_ID, VITE_FIREBASE_STORAGE_BUCKET and VITE_FIREBASE_MESSAGING_SENDER_ID,
enable Google sign-in under Authentication, and restart npm run dev.
Live at https://practice-lab-dev-9d0aa3.web.app, with the sandbox at https://practice-lab-sandbox.pages.dev. Everything runs on free plans that stop instead of billing:
| Part | Where | Address (from deploy.json) |
|---|---|---|
| The app, public pages, sign-in, Firestore | Firebase Hosting, Spark plan | siteUrl |
| The sandbox and its sound library | Cloudflare Pages, free plan | sandboxOrigin |
| AI generation | Each person's own OpenRouter key, from the browser | none |
There is no API server on the live site, so the app never calls /api.
deploy.json holds the addresses and the optional extras. Nothing in it is secret, since it all
ends up in the public site.
formspreeForm: the id from a Formspree form's endpoint (https://formspree.io/f/<id>). Turns on the Send feedback link. Feedback is also filed as GitHub issues in the Worker'sFEEDBACK_REPOonce itsGITHUB_TOKENsecret is set (a fine-grained token with Issues: read and write on that repository only).- Google Search Console verification and sitemap: see docs/features/search-and-indexing.md.
cloudflareAnalyticsToken: a Cloudflare Web Analytics site token. Adds its cookie-free page-view counting.firebaseMeasurementId: the Google Analytics measurement ID for the configured Firebase web app. It setsVITE_FIREBASE_MEASUREMENT_IDduring the production build. The SDK starts only on production builds outside localhost. Firestore usage totals still power the admin dashboard.
Build: npm run build:prod builds both parts into apps/web/dist and
apps/sandbox/dist-prod.
- The app build pre-renders one page per built-in tool at
/practice/<slug>, plussitemap.xmlandrobots.txt. Each page has its title, description, canonical link, preview tags and text. The copy lives inapps/web/src/library/seo.ts. - The sandbox build writes a
_headersfile with the same security headers the local sandbox server sends.
Publish:
npm run deploy:sandboxnpm run deploy:appFirst time setup for the sandbox:
- Run
npx wrangler login. - In
apps/sandbox(Wrangler won't run from the workspace root), runnpx wrangler pages project create practice-lab-sandbox --production-branch main --force.--forcecreates a plain Pages project instead of Wrangler's framework detection, which misreads this folder. - If Cloudflare gives the project a different
*.pages.devaddress, put that address insandboxOriginbefore deploying.
To try a production build on your own machine first, point DEPLOY_CONFIG at a copy of
deploy.json that uses local addresses.