Tech stack for a product analytics platform (2026)
Event analytics for websites, designed by StackPrism from one sentence: 14 components, a reason for each, and the live checks that watch them.
The stack
- Next.js
- Google Cloud Pub/Sub
Clerk
Stripe
Redis
- Google Cloud Storage
PostgreSQL
ClickHouse
Sentry
“A product analytics tool: a JavaScript snippet sends page views and custom events from our customers’ websites, and they explore funnels, retention and live visitors in a dashboard. Expect billions of events a month.”
Their answers on the constraints step
- Expected scale
- 10k+ users
Make it yours. Open this stack in the editor to check its health, harden it and hand it to your coding agent. No sign-up, nothing to generate.
Start from this stackSelect a component to see what it does and what it connects to, or pick one above to see what breaks if it goes down. Pinch or use the buttons to zoom.
Why this stack
The JavaScript snippet is served from a CDN and sends events to an ingestion API on Google Cloud Run, which does as little as possible: it puts each event on Google Cloud Pub/Sub and returns. Event workers read from Pub/Sub, write the events to ClickHouse, a column store built for counting billions of rows, keep live visitor counts in Redis and store exports in Google Cloud Storage. The dashboard calls a separate Dashboard API that runs funnel and retention queries on ClickHouse and reads account data from PostgreSQL. Clerk handles sign-in, Stripe bills customers and Sentry reports errors.
Why each piece
All 14 components on the diagram: what each one does, what it talks to, and what stops if it goes down.
Frontend Dashboard
Next.js analytics UI. Calls Dashboard API, Clerk (auth) and Sentry (errors). Called by Tracking CDN (loads).
If it goes down, 1 of 13 components stops working.
Tracking CDN
In Google Cloud Run
Snippet hosting. Calls Frontend Dashboard (loads) and Ingestion API (sends).
Nothing else on the diagram depends on it.
Ingestion API
In Core Services
Event ingestion. Calls Google Cloud Pub/Sub (publishes) and Sentry (errors). Called by Tracking CDN (sends).
If it goes down, 1 of 13 components stops working.
Dashboard API
In Core Services
Analytics queries. Calls ClickHouse (queries), PostgreSQL (reads), Redis (reads), Clerk (auth) and Stripe (billing). Called by Frontend Dashboard.
If it goes down, 2 of 13 components stop working.
Event Workers
In Google Cloud Run
Async processing. Calls Google Cloud Pub/Sub (consumes), ClickHouse (writes), PostgreSQL (writes), Redis (updates), Google Cloud Storage (stores) and Sentry (errors).
Nothing else on the diagram depends on it.
Google Cloud Pub/Sub
Event bus. Called by Ingestion API (publishes) and Event Workers (consumes).
If it goes down, 2 of 13 components degrade.
Clerk
In External Services
Authentication. Called by Frontend Dashboard (auth) and Dashboard API (auth).
If it goes down, 3 of 13 components stop working.
Stripe
In External Services
Billing. Called by Dashboard API (billing).
If it goes down, 1 of 13 components degrades.
Metrics
In Logging
Structured metrics.
Nothing else on the diagram depends on it.
Redis
In Data & Storage
Live state. Called by Dashboard API (reads) and Event Workers (updates).
If it goes down, 2 of 13 components degrade.
Google Cloud Storage
In Data & Storage
Files and exports. Called by Event Workers (stores).
If it goes down, 1 of 13 components degrades.
PostgreSQL
In Databases
App metadata. Called by Dashboard API (reads) and Event Workers (writes).
If it goes down, 4 of 13 components stop working.
ClickHouse
In Databases
Analytics store. Called by Dashboard API (queries) and Event Workers (writes).
If it goes down, 4 of 13 components stop working.
Sentry
In Logging
Error tracking. Called by Event Workers (errors), Frontend Dashboard (errors) and Ingestion API (errors).
If it goes down, 3 of 13 components degrade.
When this stack fits
- Event volume is huge, and collecting events must never slow down your customers’ websites.
- Queries are counts, funnels and retention over months of events.
- Ingestion and dashboards have to scale separately.
When to pick something else
- You only need analytics for your own product: an existing analytics tool is far less work than building one.
- Volumes are modest, in the millions a month: PostgreSQL alone can store and query them.
What you need to build this
14 components across 9 areas of the stack.
Build it with your AI agent
Hand the stack to Claude Code, Codex, Cursor or any coding agent as a brief: how it connects, install steps and a build plan.
Frontend1
- Docs
Frontend Dashboard · Next.js
Next.js analytics UI
npm install next
Backend & APIs3
Ingestion API
Event ingestion
Dashboard API
Analytics queries
Event Workers
Async processing
Auth1
- Docs
Clerk
Authentication
npm install @clerk/nextjs
Payments1
- Docs
Stripe
Billing
npm install stripe
Storage & CDN2
Tracking CDN
Snippet hosting
- Docs
Google Cloud Storage
Files and exports
Observability1
- Docs
Sentry
Error tracking
npm install @sentry/nextjs
Other1
Metrics
Structured metrics
Install
npm install next @clerk/nextjs stripe @sentry/nextjs
SDKs only. Pick your own database driver or ORM.