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.
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 dev
to run locally andvt deploy
to 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,
.tsx
for JSX modules. - Formatting: accept
deno fmt
defaults; do not handβtweak style.
- Prefer Denoβs builtβin tests; name files
*.test.ts
or*.test.tsx
. - Keep tests deterministic; mock network calls. Example:
deno test --allow-none
for 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 fmt
anddeno lint
clean 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/sqlite
withsessions
andbookmarks
tables. - HTTP: default export handles routes (
/
,/login
,/logout
,/bookmark
,/bookmark/delete
).