Cloudflare Worker that backs the TechnoVIT CMS: event data (D1) and media storage (R2), served behind one HTTP API.
- Serves uploaded images/videos directly from R2 at
/images/*and/videos/*, with HTTP range support for video streaming. - Events API (
/events): list, get, create, update, delete, backed by a D1eventstable. - Media API (
/media): list uploaded files, upload a new file (auto-sorted intoimages/photos/orvideos/, key-prefixed with a UUID), delete a file.
- Cloudflare Workers (TypeScript)
- D1 (SQLite) for event data
- R2 for image/video storage
bun install
bun run dev # wrangler dev
bun run deploy # wrangler deploywrangler.toml binds the cms_assets R2 bucket and cms_db D1 database.
Run schema.sql against the D1 database to create the events table.
Schema changes after the initial schema.sql live in migrations/,
applied in order and never re-run. Apply a new one against the remote
database with:
npx wrangler d1 execute technovit-cms-db --remote --file=migrations/0001_add_faculty_coordinator.sqlDrop --remote to apply it to your local dev database instead.
bun run dev— local dev viawrangler devbun run deploy— deploy to Cloudflarebun run cf-typegen— regenerate Cloudflare binding types