For technical readers
How it's built
Magnum Unwrap & Win is a working concept demo, built by Retter on the Spikefrost platform and running live on Cloudflare. This page shows how it is put together, what keeps it safe, and what would come next for a pilot.
Select a layer in the diagram, or read on. Items marked as an option or a next step are not built in this demo. The figures on the admin dashboard come from invented demo data: about 5,000 made-up entrants and 40,000 code entries over six weeks.
From a plain-language brief to a live change, inside Retter's guard rails.
- Brief
- Someone describes the change in plain words. For this demo that was Retter's design brief: the mechanic, the prizes, the pages and the rules.
- Spikefrost agents, with guard rails
- Spikefrost's coding agents write the change, following the platform's written conventions for pages, data and AI calls. The build refuses known unsafe patterns before anything ships (type errors, page scripts outside the safe wrapper, inline event handlers), and automated tests cover the rules that matter here: single-use codes, instant-win stock, the photo read, the draw and the demo data.
- Review and version control
- Every change is reviewed and committed to Spike version control, so the history of the app is kept and a change can be rolled back.
- Preview
- An app can have preview environments, each with its own worker and database, to try a change before it goes live. This demo runs a single environment.
- Production
- One deploy command builds the app, applies new database migrations and publishes it to Cloudflare's network.
One server-rendered web app on Cloudflare's network, with its own database and storage.
- Cloudflare edge
- Visitors reach the app over HTTPS through Cloudflare's global network, which also absorbs denial-of-service traffic. Firewall (WAF) rules and bot challenges are available per app on the platform. Turnstile bot protection is available, not enabled in this demo.
- The web app (a Hono worker)
- One Hono application on Cloudflare Workers renders every page on the server and answers the API: sign-in with an emailed one-time code, code entry, the photo read, the admin and the draws. Pages work on a phone first and need no app install.
- Database (D1)
- Cloudflare D1 holds the entrants, codes, entries, prizes, draws and the audit log. A code is claimed with one conditional update, so it can only ever be used once, even when two people enter it at the same moment, and instant-win stock can never go below zero. The database's primary copy is in Western Europe, with read replicas switched on.
- Key-value store (KV)
- Short-lived data: sign-in sessions, rate-limit counters and the 15-minute pause after repeated wrong codes.
- File storage (R2)
- Only the app's static files, such as its stylesheet. No personal data and no codes are kept there.
- AI:
@spikefrost/ai - "Read it from a photo" sends the photo to a vision model through the
extractcall, which returns the code with a confidence score. Nothing is entered automatically: a clear read fills the box for the person to check, an unclear one asks them to type it. Model calls go through the platform, so the app holds no AI provider keys. Thedecidecall (for judgements such as routing a message) is available but not used here. - Background flows Available, not used
- The platform runs background procedures with retries and waits (for example, sending prize-claim reminders). This demo needs none: each action completes within its request.
- Scale-up path: a per-user Durable Object Next step, not built
- The demo is sized for one database. For national campaign peaks (hundreds of code entries a second), each entrant's entries, tickets and badges would move into their own Durable Object, a small store with a single writer per person, with the database kept for reporting and draws. We would size this from the real campaign forecast at the pilot.
What protects entrants, codes and prizes in this app today.
- Encryption in transit
- HTTPS only. Session cookies are Secure and HttpOnly, and cannot be read by page scripts.
- Secrets outside the code
- The admin password is a platform secret, not in the code or version control. AI access goes through the platform, with no provider keys in the app.
- Per-app isolation
- Each app, and each of its environments, has its own worker, database and key-value store. This promotion shares no data with other apps.
- Rate limits and fraud flags
- Up to 10 code attempts per account and 30 per network address in 10 minutes. Five wrong codes within an hour pause the account for 15 minutes and flag it for review; flagged accounts are left out of the draws until released. Sign-in codes are limited per email and per address too.
- Audit log
- Admin sign-ins, code batches and their exports, prize stock changes, account holds, draw seeds and draw runs, and demo card sets are all recorded. Each draw commits to a seed in advance (its fingerprint is published before the draw), so anyone can re-check the winners afterwards.
- Admin sign-in
- This demo uses one shared password. For a pilot, staff would sign in with Microsoft Entra ID (see Integration).
- Penetration test
- Report in progress.
Collect little, ask clearly, and agree the rest with the promoter.
- Consent
- Joining needs acceptance of the terms and privacy notice. Marketing email is a separate choice, unticked by default.
- Minimal data
- Email address, name, date of birth (to check entrants are 18 or over) and the postcode area only, never the full address. Winners are published as initials and area. See the terms.
- Data location Option to agree
- Keeping all personal data inside the EU or the UK is an option we would agree for a pilot.
- Retention Policy to agree
- How long entrant data is kept after the last draw and prize claims is a policy to agree with the promoter. No retention period is set in this demo.
- Deletion on request
- Not self-service in this demo: the promoter deletes an account on request. A "delete my account" button in My Magnum is a small next step.
Optional later steps. None of them is needed to run a pilot.
The pilot runs standalone. It needs no One Tech data ingestion during hypercare, and nothing from One Tech to run.
- Microsoft Entra ID single sign-on Optional later step
- Promotion staff sign in to the admin with their company accounts, and the audit log names each person.
- Salesforce Optional later step
- Entrants who opted in to marketing are synced to Salesforce as consented contacts. People who did not opt in are never sent.
- SAP Optional later step
- Redemptions per batch and the cost of instant-win vouchers go to SAP for finance.
How long this demo took to build.
Build hours added at hand-over.