Klickbee Tracking is the cookieless analytics I build for Klickbee. The first commit is dated 25 June 2026, and the repository had 489 commits by 9 November. The architecture has three parts: a Next.js application that receives events and serves the dashboards, a Postgres database, and an SDK published on npm. No queue, no specialised analytics database.
01The real architecture
The repository is a pnpm monorepo with Turborepo. The main parts:
Events are written straight to the database. A single Prisma transaction creates or updates the visitor, then the session, then inserts the batch of events. Duplicates are dropped thanks to a unique id per message. Only server-side conversions go through a jobs table, drained every five minutes by a scheduled job.
The database is managed Postgres at Neon, in Frankfurt. The application runs on Vercel in the fra1 Region, right next to it. Session recordings are compressed and stored in S3.
03Choices revisited along the way
Two decisions changed very early. On the day of the first commit, the whole stack moved to the latest major versions: Next 16, React 19.2, Prisma 7. Better to start up to date than to migrate later with production data.
Five days later, on 30 June, the application left the Singapore Region for Frankfurt. The database was in Frankfurt, and every request paid the round trip between continents. Since each request's time was dominated by the database, moving compute next to it was the obvious call.
04The three production bugs that taught me the most
None came from the architecture. All came from a configuration detail.
The second is the nastiest. When a page closes, the SDK sends its last batch with sendBeacon, which always goes out with browser credentials. The CORS preflight response did not return the Access-Control-Allow-Credentials header, so the browser dropped the request with no visible error. On a short visit, that was often the only batch.
The third comes down to a misplaced file. The Vercel project reads its configuration from apps/web, and the vercel.json file sat at the repository root. Vercel ignored it silently: neither the scheduled jobs nor the security headers were applied. Here is the core of the file, once in the right place:
The common lesson: ignored configuration produces no error. Since then, a test checks that the file sits where Vercel reads it. I cover this more broadly in my article on monitoring.
05What it costs
In October 2026, Klickbee Tracking's share of the team's Vercel bill was $1.00 of usage, on top of the Pro plan shared by all our projects. The Neon database and S3 storage are billed separately. A simple architecture on Vercel stays cheap while traffic remains reasonable, as I explain in why Vercel for a SaaS.
The tool is live at tracking.klickbee.com, with a free plan up to 1,000 sessions a month.
06FAQ
Why Postgres rather than an analytics database like ClickHouse?
Because at this stage, Postgres with good indexes is enough, and a single database is simpler to run. A specialised database will make sense when volumes require it, not before.
Why no queue for events?
One transaction per batch, with deduplication on a unique id, covers today's needs. Only server-side conversions go through a jobs table, because they call external services that can fail.
Is cookieless analytics exempt from consent?
Not automatically. The CNIL exemption for audience measurement depends on specific conditions, including how long identifiers live, which the SDK respects with its 395-day renewal. Each site remains responsible for its own compliance.
07Sources
Klickbee Tracking runs on a deliberately simple architecture: a Next.js app, a Postgres database and an SDK. The real problems came from configuration details, not from the architecture.
Talk about your project ↗