Live event project | Main developer
Taipei Manhole Cover Charm Festival
This online event turned city manhole covers into digital charms. People could sign in daily to draw a charm, build a collection, keep a check-in streak, and share. I was the main developer for the public site and operations dashboard. Both used the same package for event rules. The whole system ran on Cloudflare.
Open event siteProblems to solve
- People can sign in and draw one digital charm each day. The server must enforce the draw rules, daily limit, and event dates so the frontend cannot bypass them.
- Collections and check-in streaks must carry over time and determine who can enter the prize draw.
- Share pages and preview images need to look good and work on social platforms. Their content must not be guessable from the URL.
- Staff need to change event settings, manage prizes, view reports, and export data. Every action must be logged for audit.
- We need to measure conversions in the charm draw and compare ways of loading images, but only after users consent.
System design
- Public site: ① The event website calls ② the event API. Event data is stored in D1.
- Login: ② Exchanges an authorization code through ⑤ LINE Login, verifies the signature, and creates a session.
- Operations: Staff pass access control first. ③ The dashboard calls ④ the operations API. Operations data, cache, and the audit log copy are stored in D1, KV, and R2, respectively.
- Shared rules: ② and ④ use ⑥ the shared event rules package. For prize reads and writes, ② calls the prize service in ④ with a service key.
- Analytics: ① Loads ⑦ GA4 only after consent. It reports event steps, share sources, and which A/B image loading version users saw. Analytics errors do not interrupt the event.
Parts
Public site
- ① Event website
A single-page app where people draw a daily charm, build their city collection, check in on consecutive days, view prizes, and share. Public file and data IDs cannot be guessed.
React, TypeScript, Vite, TanStack Router / Query
- ② Event API
Handles daily draws, check-ins, collections, prize draw eligibility, and prize claims. It creates share images and share pages with tokens. It uses a human verification check to prevent draw abuse.
Cloudflare Pages Functions, D1
Operations
- ③ Operations dashboard
Staff can draft and publish event settings, run prize draws, manage prizes, view and export reports, set alert rules, handle personal data requests, and look up audit logs.
React, TypeScript, Ant Design Pro, Ant Design Charts, TanStack Query
- ④ Operations API
Verifies identity tokens issued by the access control service before handling requests. Event settings are versioned and use a typed publish request before going live. The API logs changes before writing them and keeps a backup copy of the audit log.
Cloudflare Pages Functions, D1, KV, R2
Shared
- ⑤ LINE Login
It exchanges an authorization code for an identity token, verifies the signature, and sets a session cookie. People do not need a separate username or password.
OAuth authorization code flow, JWKS / JWT signature verification
- ⑥ Shared event rules package
The public API and operations API use the same types and logic for event settings, collections, prize draw eligibility, and the number of prize draw entries.
TypeScript workspace package
Analytics
- ⑦ GA4 event analytics
The Google tag loads only after consent. It tracks steps such as LINE login, charm draws, sharing, and monthly check-ins. Share sources must be on an allowlist. An A/B test compares image loading methods for charm draws. The app reports which version users saw along with image loading metrics. Analytics errors do not interrupt the event.
GA4 (gtag), consent management, A/B exposure logs
Testing, deployment, and operations
- We used Vitest for rules where bugs could affect the event, such as draws, check-ins, and eligibility. The public site and operations dashboard each have hundreds of automated tests.
- We checked charm draws and prize claims with local Pages Functions and synthetic data, without using any production data.
- Production operations have safeguards. The API writes an audit record before changing data. Test time overrides and preview links expire on the server and can be revoked.
- We moved the public site from manual uploads to Cloudflare Pages Git integration. Staging and production are separate. GitHub Actions deploys and runs smoke tests after deployment.
- Exports use a Queue with one consumer Worker, 3 retries, and a dead-letter queue. A separate scheduled Worker runs a check every 5 minutes. A copy of the audit log is stored in R2 with Object Lock set to keep it for 180 days.
- We moved the database from Neon (through Hyperdrive) to D1. Before the move, the staging database kept waking up. We found the cause, put a maintenance gate in place that we could undo, and then removed staging compute resources to control costs.
- Database credential rotation covered Pages, Hyperdrive, and the Queue Worker. Exports once got stuck because a Worker kept its old credentials. After the fix, 21 jobs completed. We added updates for both consumers to the rotation process.
- We checked that the old Pages project and Worker had no runs for 30 days and that their queues were empty before unbinding and deleting them.
- We used AI coding agents with specs and acceptance checks. We used short-lived credentials for releases and revoked them after each release.