Objective
Show the beers and send buyers to order through Instagram.
Visitors pass an 18+ age gate, browse the beers, read the blog and take a quiz that assigns them a path. Signed-in players explore, fight and redeem bottle codes in an RPG resolved on the server.
Challenges
- 01A slow Supabase response stalled every navigation for about 25 seconds
- 02Combat results computed in the browser could be tampered with
- 03The Fortress page needed four serial round trips to load
How it was solved
- 01Middleware aborts after 3 seconds and treats the failure as signed out
- 02Combat resolves on the server from pending combat logs
- 03Local JWT verification, cached reads and streaming cut it to one
Results
- Middleware time down from 347 ms to 31 ms after verifying the JWT locally
- Combat balance checked with Monte Carlo probability tests
Overview
The public site and the game share one Next.js app. Beers, posts and the quiz are typed data in the repo; players and their progress live in Supabase.
Technical Implementation
Auth
Supabase Auth with row-level security. The session JWT is verified locally, so most requests never reach the auth server, and a short abort keeps the site usable when Supabase is slow.
Game
Exploration, combat, stamina, allies and a weekly ranking. Combat is settled on the server, and its odds are covered by simulation tests.
Conversion
There is no store: every beer ends in a call to order by Instagram message.
Features
- Beer catalog with a page per beer
- Quiz that assigns each visitor a path
- Blog with category filters
- RPG: fortress dashboard, exploration, inventory, allies and weekly ranking
- Code and QR redemption for codes printed on bottles
- Welcome emails through Resend
Technologies
- Next.js 16
- React 19
- TypeScript
- Supabase (Postgres, Auth, RLS)
- Resend
- Tailwind CSS 4
- Vitest
- Vercel
