Can PostHog be vibe coded?
Product analytics with session replay, feature flags, and a data warehouse
First-party collection and a dashboard that answers your top five questions is achievable solo, and PostHog's free tier covers a million events a month before you pay anything. What the bill buys past that is the rest of the platform: session replay, feature flags, SQL over years of events, and ingestion that stays correct while your event schema drifts underneath it.
Jump to the build brief ↓Checked Jul 2026
high editorial confidence
Buildability by layer
Screens, forms, and focused interactions
The repeatable job the product performs
Availability and legality of required data
Uptime, queues, support, and maintenance
Security, compliance, and user confidence
The achievable core
- Collect first-party pageviews and custom events from your own sites, keep the raw rows yourself, and answer a handful of product questions from a local dashboard.
- Ingest a known data source, calculate a focused metric set, and render a useful dashboard.
- A responsive interface with real empty, loading, success, and error states.
The parts a prompt cannot buy
- session replay
- feature flags and experiments
- identity stitching across devices
- SQL over years of events
- Reliability at the vendor's scale is an operations problem, not a prompt.
- Years of history, configuration, and habits make migration costly.
Why people still pay
Teams pay because analytics has to keep collecting and stay trustworthy while the product changes underneath it. The bill buys bot filtering, identity resolution, late-arriving data, retention, query cost, and someone else getting paged when ingestion stops. The charts are the cheap part.
Reliability at the vendor's scale is an operations problem, not a prompt.
Years of history, configuration, and habits make migration costly.
The brief
Context, requirements, acceptance criteria, non-goals, and the full production standard — as Markdown, ready for any coding agent.
Build brief — a focused alternative to PostHog
Context
**PostHog** — Product analytics with session replay, feature flags, and a data warehouse. It currently costs Variable pricing.
First-party collection and a dashboard that answers your top five questions is achievable solo, and PostHog's free tier covers a million events a month before you pay anything. What the bill buys past that is the rest of the platform: session replay, feature flags, SQL over years of events, and ingestion that stays correct while your event schema drifts underneath it.
This brief describes a focused, single-operator replacement for the part of PostHog that is genuinely reproducible. It is deliberately narrower than the product it replaces, and it says so in writing. Build the useful core; do not pretend to have rebuilt the rest.
What you are building
Collect first-party pageviews and custom events from your own sites, keep the raw rows yourself, and answer a handful of product questions from a local dashboard.
Ingest a known data source, calculate a focused metric set, and render a useful dashboard.
A responsive interface with real empty, loading, success, and error states.
Requirements
Functional
Node 22.
A small always-on VPS.
A domain you control, for first-party collection.
Non-functional
Accessibility: semantic markup, labelled controls, visible focus, and reduced-motion support.
Security: server-side secrets, validated input, and no credentials in the client bundle.
Reliability: retries with backoff on external calls, and a clear failure state when a provider is down.
Portability: the operator can export their data and leave without losing it.
Implementation brief
Build me a self-hosted web analytics box to replace PostHog. Requirements:
One Node 22 + Express process with better-sqlite3, serving the collector and the
dashboard on port 8787. No frontend framework, no build step, no Docker.
A tracker.js I paste on my sites: pageviews on load and history change, plus
window.track('signup', { plan: 'pro' }), POSTed to /e on my own domain so
collection stays first-party.
One SQLite events table: site, event, path, referrer, UTM fields, country from the
proxy header, device class, and a JSON properties blob.
Count visitors by a daily-rotating salted hash of IP plus user agent, salt in .env.
No cookie, never the raw IP. That is the whole privacy design, keep it.
Dashboard at / with a date range picker: visitors and pageviews by day, top pages,
referrers, countries, any event split by one property, and a three-step funnel.
Nightly rollup into a daily-summary table, raw events pruned past the retention
window in .env, /export.csv for the raw rows.
Basic auth on the dashboard, collector open. No accounts, no telemetry, my box
holds the only copy.
Out of scope: session replay, feature flags, and stitching one person across
devices. Do not build a plugin system or a warehouse connector.
README: the snippet to paste, where the SQLite file lives, and how to back it up.
Delivery standard
Inspect the repository first, then write a short implementation plan before writing code.
Deliver the smallest complete end-to-end workflow first; every primary control must work against persisted data.
Use real validation and storage; never substitute fake dashboards, decorative controls, hard-coded success states, or mock integrations.
Include responsive layouts plus genuine empty, loading, success, validation, and failure states.
Keep secrets server-side in environment variables, provide .env.example, and never commit credentials or user data.
Add structured logs around every external call and return actionable errors without leaking sensitive details.
Write unit tests for the core logic and one automated test of the main user journey.
Finish with a README covering setup, architecture, data location, backups, tests, deployment, and known limitations.
Acceptance criteria
A clean install starts the app using only the README and .env.example.
The primary journey works from first visit through saved result, reload, edit, export, and deletion where applicable.
Invalid input, missing configuration, provider failure, and an empty database each have a usable state.
The interface works at 390px and 1440px, is keyboard navigable, and shows visible focus on every control.
Tests, type checking, linting, and a production build all pass with no ignored failures.
No part of the interface implies a live integration, security guarantee, or scale capability that was not actually built and verified.
Non-goals
Do not build these, and do not claim to have replaced them:
Session replay.
Feature flags and experiments.
Identity stitching across devices.
SQL over years of events.
Reliability at the vendor's scale is an operations problem, not a prompt.
Years of history, configuration, and habits make migration costly.
What you still own after launch
Run migrations, backups, restores, and dependency updates.
Test the critical journey after every model, API, or hosting change.
Monitor failures and fix the edge cases a first prompt will miss.
Risk
**Operational risk.** The code is achievable; dependable data, integrations, and ongoing operations are the real cost.
Editorial confidence in this assessment: high. No independent one-shot implementation is linked yet.
Prior art
Working open-source software you can read, fork, or borrow from before starting:
[Umami](https://github.com/umami-software/umami) — Popular open-source privacy-focused web analytics platform
Generated by [Can It Be Vibe Coded?](https://www.canitbevibecoded.com) · Full report: https://www.canitbevibecoded.com/posthog
You still own the product
- Run migrations, backups, restores, and dependency updates.
- Test the critical journey after every model, API, or hosting change.
- Monitor failures and fix the edge cases a first prompt will miss.
Open-source prior art
Before you start
Can PostHog be vibe coded?
Not faithfully. First-party collection and a dashboard that answers your top five questions is achievable solo, and PostHog's free tier covers a million events a month before you pay anything. What the bill buys past that is the rest of the platform: session replay, feature flags, SQL over years of events, and ingestion that stays correct while your event schema drifts underneath it.
What can an AI coding agent reproduce from PostHog?
Collect first-party pageviews and custom events from your own sites, keep the raw rows yourself, and answer a handful of product questions from a local dashboard. Ingest a known data source, calculate a focused metric set, and render a useful dashboard. A responsive interface with real empty, loading, success, and error states.
What will a DIY PostHog replacement still be missing?
session replay; feature flags and experiments; identity stitching across devices; SQL over years of events; Reliability at the vendor's scale is an operations problem, not a prompt.; Years of history, configuration, and habits make migration costly.
What do I still own after building a PostHog alternative?
Run migrations, backups, restores, and dependency updates. Test the critical journey after every model, API, or hosting change. Monitor failures and fix the edge cases a first prompt will miss.