On this page9
A self-hosted analytics and session replay platform I designed, built and run, on a server the operator controls.
- Lines of code
- 35,600
- Source modules
- 51
- Server runtime dependencies
- 6
At a glance
- Area
- Analytics, SEO and marketing
- My role
- Sole engineer: design, build, deploy and run
- Built with
- Node.js 22, PostgreSQL, WebSocket, Web Push, Telegram Bot API, JavaScript
- Status
- Live at andazeh.in, platform version 1.5.2
- Earlier name
- Metrika
- Area
- Analytics, SEO and marketing
- My role
- Sole engineer: design, build, deploy and run
- Built with
- Node.js 22, PostgreSQL, WebSocket, Web Push, Telegram Bot API, JavaScript
- Status
- Live at andazeh.in, platform version 1.5.2
- Earlier name
- Metrika
The problem
Hosted analytics send visitor data to a third party. Aggregate dashboards show that a conversion failed, but not how it failed. Pricing tends to grow per seat or per event, the feature set is fixed, and replay is often a premium extra.
What I built
- Browser client lines, no dependencies
- 5,300
- Server lines
- 22,000
- Storage lines, 10 PostgreSQL stores
- 8,700
- Route lines, 16 modules
- 13,200
- Messaging lines
- 2,790
- Telegram webhook lines
- 3,083
The browser client takes one DOM snapshot when the page loads, then streams each change after it. Replay is an ordered walk through that list.
Talking to a visitor
An operator can reply to a visitor from the dashboard or from Telegram. Messages are addressed to the device instead of the session, so a reply can still arrive days later.

Protecting sensitive fields
Password, payment and one-time-code fields are detected automatically, and their characters are replaced in the browser before anything is sent. A site gets this with no setup.
Reaching visitors with pop-ups
Operators build the messages a site shows, with a tagline, body text, image and button, and see them before they go out. Each template is draft, active or archived.

Key decisions
A client with no dependencies
- What it cost
- More work
- Why it was worth it
- This code runs on other people's pages, so its size and supply chain are their risk too.
Sensitive fields masked with no setup
- What it cost
- A pattern list to maintain
- Why it was worth it
- A protection that depends on configuration gets forgotten.
One store per domain
- What it cost
- Repeated boilerplate
- Why it was worth it
- Stores stay uncoupled, and queries are tuned separately.
PostgreSQL only
- What it cost
- No specialised time-series engine
- Why it was worth it
- Relational joins matter here, and one database is simpler to run.
A client with no dependencies
- What it cost
- More work
- Why it was worth it
- This code runs on other people's pages, so its size and supply chain are their risk too.
Sensitive fields masked with no setup
- What it cost
- A pattern list to maintain
- Why it was worth it
- A protection that depends on configuration gets forgotten.
One store per domain
- What it cost
- Repeated boilerplate
- Why it was worth it
- Stores stay uncoupled, and queries are tuned separately.
PostgreSQL only
- What it cost
- No specialised time-series engine
- Why it was worth it
- Relational joins matter here, and one database is simpler to run.
For engineers: how this was built
Result
I make no claim here about conversion gains, because I have not published before-and-after data.
Hiring someone to build the whole product?
Tell me about the role, or see next: eleven years of data turned into forecasts the sales side can act on.
- Section
- Analytics, SEO and marketing
- Reading time
- 3 min read
Hiring for this kind of work?
Tell me about the role and I will reply by email.
Discuss a role with me
