next-story
v0.1.1·MIT & open source·Edge-safe

The shape of a visit,
captured — not recorded.

next-story is a lite, self-hosted journey recorder for Next.js. It reads navigation paths, rage-clicks, dead-clicks and conversions — no DOM snapshots, no video, no session replay. Five minutes to install, private by construction.

★ Star on GitHub

Requires Next.js ≥15.1.0 (App Router)

page_viewrage_click / dead_clickconversion

For agent & control-plane builders

Not a dashboard. A structured signal an agent can read.

Every session collapses into four typed events — page_view, rage_click, dead_click, and conversion — no free text, no screenshots. apps/agent-api exposes exactly three fixed, scoped endpoints on top of that data. No ad-hoc SQL, no arbitrary filters — a bounded surface a control-plane agent can query without guessing what it's allowed to ask.

page_viewrage_clickdead_clickconversion
agent-api — fixed query surface
  • GET /sites/:site_id/sessionsLLM-shaped session summaries
  • GET /sites/:site_id/rollupDaily rollups with baseline columns
  • GET /sites/:site_id/comparePeriod-over-period deltas by route

What it actually does

Six things, done deliberately. Nothing else.

01

Rage & dead-click detection

A MutationObserver answers one boolean question — did anything happen? — plus a latency number. It never records what changed, and disconnects after every window.

02

Conversion tracking

Exactly two mechanisms: an explicit track('conversion', { name }) call, or one declarative conversion_route_pattern per site. No rule engine, no funnel builder.

03

Multi-tenant by design

Every event, token, and query is scoped to a site. Built to sit behind many properties from day one, not bolted on later.

04

Privacy invariants

URLs store as route_pattern only — never a query string or hash. Raw IP is never stored, only a daily-rotating-salt hash for bot detection.

05

Offline queue & batching

Client-side events queue through drops in connectivity and flush in batches, so a flaky network never means silent data loss.

06

Edge-safe collector

The server entrypoint is Web-Crypto-only — no Buffer, no node:crypto — so the collect handler can run on the Edge runtime.