Skip to content

Data Contract & Storage Schema

The schema maintains structural parity across both Cloudflare D1 (Edge SQLite) and Dexie.js (Client IndexedDB) to guarantee seamless data synchronisation.

1. Entity Definitions

Festivals

  • id (TEXT, PRIMARY KEY): Unique identifier / slug.
  • name (TEXT): Full festival name.
  • url (TEXT): Origin Clashfinder URL.
  • created_at (INTEGER): Epoch timestamp.

Stages

  • id (TEXT, PRIMARY KEY): Generated GUID.
  • festival_id (TEXT, FOREIGN KEY $\rightarrow$ festivals.id): Parent festival.
  • name (TEXT): Stage name.

Bands

  • id (TEXT, PRIMARY KEY): Generated GUID.
  • stage_id (TEXT, FOREIGN KEY $\rightarrow$ stages.id): Assigned stage.
  • name (TEXT): Act / Band name.
  • start_time (INTEGER): Epoch timestamp.
  • end_time (INTEGER): Epoch timestamp.

User Routes (Local First)

  • id (TEXT, PRIMARY KEY): GUID.
  • band_id (TEXT, FOREIGN KEY $\rightarrow$ bands.id): Selected band.
  • priority (INTEGER): Rating / precedence score.
  • sync_status (TEXT): 'synced' | 'pending' | 'failed'.
  • updated_at (INTEGER): Epoch timestamp.

2. API Contract

GET /api/festivals/:id

  • Response: JSON payload containing nested festival, stage, and band entities for single-pass client hydration into Dexie.js.

POST /api/ingest

  • Payload: { "url": "https://clashfinder.com/s/example" }
  • Response: { "success": true, "festival_id": "example" }