Skip to content

PERSiBER

Event app with signed tickets

The app behind the event series I co-run: staff manage guests, check people in at the door on a phone, and ask an AI copilot about the night.

Role
Frontend, backend, hosting and deployment; I also co-run the event series
Period
Aug 2024 – Present
Category
Own project
Tech stack
Next.js, React, TypeScript, TanStack Query, zustand, AI SDK, Capacitor, WebAuthn, Python, FastAPI, SQLAlchemy, Alembic, PostgreSQL, pgvector, LangGraph, LiteLLM, Gemini, OpenRouter, pytest, Docker, Caddy, Hetzner, GitHub Actions

Results

read-only copilot tools
11
Counted in the server’s tool registry, 24 November 2026
test files
68
47 server and 21 client, counted 24 November 2026; version 1 had 25 tests, 24 of them generated stubs
commits to the rebuild
225
13 February to 8 October 2026, not counting 65 by Dependabot
PERSiBER’s dashboard: attendance rate, events, unique guests and guest records, the most popular event and the biggest promoter; for the current event, registered, attended, QR and coupon counts, a guest funnel, and the guest and coupon mix.

Problem

The first version ran the guest lists, the QR codes and the door from 2024. But a QR code was just a link with the guest’s database ID, so nothing proved that we had issued it. 24 of its 25 tests were the stubs NestJS generates, and nothing checked a change before it went live.

Architecture

A new codebase. Version 2 started in a new repository in February 2026: a Next.js 16 client with TanStack Query and zustand, a FastAPI server with async SQLAlchemy and Alembic on PostgreSQL, and an Android app built with Capacitor. Staff sign in with passkeys.

Signed tickets. Each QR code is a compact token: the guest’s ID, a nonce and a 16-byte HMAC-SHA256 signature. A changed or made-up code fails the check at the door, and the scanner tells a forged code apart from an old but genuine ticket.

A copilot that asks for data. The copilot is a LangGraph loop over 11 read-only tools for guests, members, the door, events, staff and analytics. They replaced a prepared block of context in every prompt: with tools, the model asks for exactly what it needs instead of the app guessing the question. Ticket tokens, IDs and links are redacted from every prompt, and a token budget keeps the context inside the window. Guest names are sent on purpose, so the copilot can tell two guests with the same first name apart.

Three model chains. Through LiteLLM, free tiers first: Gemini Flash Lite leads everyday chat because its free allowance is the most generous, a deep question can ask for a stronger model, and structured insights end on a model that accepts a JSON schema. The chain moves on after rate limits, timeouts and server errors, never after a request our own code got wrong: that is a bug to fix, not a reason to spend another call.

Insights that cite their numbers. Insights are generated from a fact pack of the dashboard’s own metrics. Each metric has a stable key, the answer must cite the keys it rests on, and the result is checked against a schema and stored.

Infrastructure

Docker Compose on a Hetzner server behind Caddy, with scripts to back up and restore PostgreSQL. The server had configs for Render (15 March 2026) and Koyeb (16 March) first; a week later it moved to Hetzner, and scripts carried the data out of Supabase into its own PostgreSQL. Credentials stay on the server: the browser talks only to the app’s own AI endpoints and never learns which provider answered, and one switch turns all AI off before any provider is called.

GitHub Actions builds the Android and iOS releases and runs the security scans. The server is checked with mypy, ruff and pytest, and the client’s lint also blocks browser APIs that the supported browsers lack.

Outcomes

  • Every QR ticket is signed, so the door rejects codes we never issued and tells a forged code from an old one.
  • Staff ask the copilot about the night in plain words; a live eval checks that it picks the right tool, hedges on a fuzzy name match and refuses topics it does not track.
  • Insights name the metrics they rest on, so a finding can be checked against the dashboard.

First version

PERSiBER started in August 2024 as a Next.js and React app with Redux Toolkit and Tailwind, and a NestJS 11 API on Fastify with MongoDB and JWT, both on Vercel. It handled guests and members, QR codes as PDFs, a door scanner that refused a second scan of the same code, discounts, drink coupons and statistics. I worked on it until December 2025, in 57 commits. Its code is public on GitHub.

What version 2 changed

  • Server and database: FastAPI and PostgreSQL instead of NestJS and MongoDB, with migrations in Alembic.
  • Tickets: signed tokens instead of a link with a database ID.
  • The door: a scanner in an Android app that tells forged codes from old ones.
  • Quality: tests on both sides, and GitHub workflows for the releases and security scans.
  • AI: a copilot for the staff, and stored insights that cite their metrics.

What I would do differently

I would sign the QR codes and test the door from the first event. In version 1 a ticket was a plain link with a database ID and almost every test was a generated stub, and putting that right took a new codebase rather than a change. I would also choose the server’s long-term home at the start: version 2 had configs for Render and Koyeb in one week and moved to Docker on Hetzner the next.

Terms used here

HMAC
A signature made with a secret key. Without the key, nobody can produce a valid signature for a changed or invented code.
Nonce
A random value that makes each token unique.
Passkey
A sign-in without a password: the phone or laptop proves who you are with a key stored on the device (WebAuthn).
Capacitor
A tool that packages a web app as a native app for Android or iOS.
LangGraph
A library for building an AI agent as a graph of steps; here, the loop in which the copilot calls tools and then answers.
LiteLLM
A library that calls many model providers through one interface.
Redaction
Removing sensitive values from a text before it is sent on; here, before a prompt goes to a model provider.