A pixel-art daily horse race where each horse is a participant and every length gained is an output token their Claude Code produced. One-shot races, scheduled start/end times, customizable horses, terminal-as-life-support (close the terminal → your horse crashes).
shared/— domain types, API contracts, error codes, constantsapi/— Lambda handlers (createRace,getRace,joinRace,heartbeat,endRace)infra/— AWS CDK stack (eu-west-2, with cross-region ACM in us-east-1)cli/—@mauricode/token-derbynpm package — seecli/README.mdsite/— static race viewer — seesite/README.md. Live at token-derby.mauricode.co.uk.
npm i -g @mauricode/token-derby
token-derby --help# 1. Install
npm install
# 2. Start DynamoDB Local
make dynamodb-up
# 3. Run tests
npm test
# 4. Stop DynamoDB Local
make dynamodb-downRequires AWS credentials for an account where mauricode.co.uk is hosted in Route 53.
cd infra
npx cdk bootstrap aws://<account>/eu-west-2
npx cdk bootstrap aws://<account>/us-east-1
npx cdk deployPOST /races -> create a race
GET /races/{join_code} -> race view (polled by site / CLI)
POST /races/{join_code}/join -> register a horse
POST /races/{join_code}/horses/{horse_id}/heartbeat -> update current_tokens
DELETE /races/admin/{admin_code} -> end the race
Request/response shapes and error envelopes are defined in shared/src/api.ts and shared/src/errors.ts.