Skip to content

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TechnoVIT Cache Worker

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.

What it does

  • Upstream events cache (/upstream-events): GET lists cached VTOP event id → name pairs; PUT upserts a batch, skipping rows whose name hasn't changed.
  • Users (/users/:username): GET returns the cached display name for a user.
  • Registrations (/registrations/:username): GET lists a user's cached registered events (title, meta, amount, paid status, pay URL); PUT upserts 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 get 401.

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.

Stack

  • Cloudflare Workers (TypeScript)
  • D1 (SQLite) for cached upstream events, registrations, and display names

Getting started

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.

Scripts

  • pnpm dev — local dev via wrangler dev
  • pnpm deploy — deploy to Cloudflare
  • pnpm db:init:local — apply schema.sql to the local D1 database
  • pnpm db:init:remote — apply schema.sql to the remote D1 database

About

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.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Contributors

Languages