- TypeScript 100%
- CSS <1%
duels.fm #
duels.fm ranks songs through public head-to-head matchups. Matchups and results are published as AT Protocol records, while voters write their own fm.duels.vote records to their Personal Data Servers.
PostgreSQL is the transactional AppView: it indexes public records, serves rankings, schedules bot work, and makes applying a result idempotent. Apple Music remains the catalog authority.
Current foundation #
- TanStack Start and Vite website with matchup, rankings, and protocol pages
- Experimental Lexicons in
lexicons/fm/duels/ - PostgreSQL schema and initial migration for songs, matchups, votes, rating events, and bot jobs
- Storage-independent Elo and matchup selection logic with tests
- Fixture catalog and dry-run bot publisher, safe without credentials
- PDS vote validation boundary; hosted OAuth record writing is intentionally not enabled until credentials and client metadata are deployed
Local setup #
cp .env.example .env.local
deno install
deno task db:generate
deno task db:migrate
deno task db:seed
deno task dev
DATABASE_URL must point to PostgreSQL. Prisma generation can require native engine support for the host platform.
Validation #
deno task test
deno task check
deno task build
deno task bot:dry-run
Data ownership #
fm.duels.song,fm.duels.matchup, andfm.duels.resultlive in the duels.fm bot repository.fm.duels.votelives in the voter’s PDS and may be updated until matchup close.- The indexed PostgreSQL vote is a read model, not the source of user ownership.
- A result is finalized once in a database transaction, recording both rating changes before bot publication.
Deployment #
Cloudflare Workers serves the app and reserves a ten-minute cron trigger for orchestration. Keep BOT_MODE=disabled until PostgreSQL connectivity, bot credentials, Apple Music credentials, OAuth client metadata, and the bot’s live publishing adapter are all configured. For production PostgreSQL, use a pooled connection path such as Cloudflare Hyperdrive.