MusicBox
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
Viewing readonly version of main branch: v37View latest version
main.tsx: React SSR HTTP handler (default exportauthHandler); session + bookmark logic and TIDAL API integration.deno.json: Deno config (TS, JSX, lint rules, Val.town types).test-artist.ts: Ad‑hoc script to inspect TIDAL artist relationships.
- Format:
deno fmt— apply repository formatting. - Lint:
deno lint— run configured lint rules. - Type check:
deno check main.tsx— validate types without running. - Ad‑hoc test:
deno run --allow-net --allow-env test-artist.ts— exercises artist fetching (requires TIDAL env vars). - Val.town (optional):
vt devto run locally andvt deployto publish if you use the Val.town CLI.
- JSX pragma: start React files with
/** @jsxImportSource https://esm.sh/react */. - Imports: prefer ESM (
npm:specifiers and HTTPS URLs). No Noderequire. - Naming: PascalCase for React components, camelCase for functions/variables,
.tsxfor JSX modules. - Formatting: accept
deno fmtdefaults; do not hand‑tweak style.
- Prefer Deno’s built‑in tests; name files
*.test.tsor*.test.tsx. - Keep tests deterministic; mock network calls. Example:
deno test --allow-nonefor pure unit tests. - For coverage (optional):
deno test --coverage=cov && deno coverage cov.
- Commits: use Conventional Commits (e.g.,
feat: add bookmark deletion,fix: handle missing artist rel). - PRs: include summary, rationale, affected routes, and any schema changes. Link related issues. Add screenshots of UI states when applicable.
- Keep PRs small and focused; include
deno fmtanddeno lintclean runs.
- Required env vars:
TIDAL_CLIENT_ID,TIDAL_CLIENT_SECRET,MUSICBOX_PASSWORD. - Do not commit secrets. Use the minimal permissions flags (
--allow-env,--allow-net) when running scripts.
- Runtime: Deno; Platform: Val.town. Server responds by rendering React to HTML
via
renderToString. - Storage: Val.town SQLite via
https://esm.town/v/std/sqlitewithsessionsandbookmarkstables. - HTTP: default export handles routes (
/,/login,/logout,/bookmark,/bookmark/delete).