Cloudflare Worker that backs the TechnoVIT registration flow: a D1-backed cache mirroring VTOP event names and each visitor's registrations, served behind one HTTP API.
- Upstream events cache (
/upstream-events):GETlists cached VTOP event id → name pairs;PUTupserts a batch, skipping rows whose name hasn't changed. - Users (
/users/:username):GETreturns the cached display name for a user. - Registrations (
/registrations/:username):GETlists a user's cached registered events (title, meta, amount, paid status, pay URL);PUTupserts a batch of registrations and, optionally, the user's display name — again skipping anything unchanged. - Every route requires an
Authorization: Bearer <API_SECRET>header; requests without a valid token get401.
The Next.js site is the only caller — it syncs a visitor's live VTOP session data here so repeat reads don't have to hit VTOP directly.
- Cloudflare Workers (TypeScript)
- D1 (SQLite) for cached upstream events, registrations, and display names
pnpm install
pnpm dev # wrangler dev
pnpm deploy # wrangler deploy
wrangler.toml binds the technovit-cache D1 database. Create the tables with:
pnpm db:init:local # local dev database
pnpm db:init:remote # remote database
API_SECRET is a Worker secret, not a config value — set it with wrangler secret put API_SECRET rather than adding it to wrangler.toml.
pnpm dev— local dev viawrangler devpnpm deploy— deploy to Cloudflarepnpm db:init:local— applyschema.sqlto the local D1 databasepnpm db:init:remote— applyschema.sqlto the remote D1 database