PostHog starter module
Session setup
Maps PostHog keys, browser loading, server capture, session context, and privacy choices.
- Files
- 16
- Lines
- 804
- Languages
- Config + Markdown + TypeScript + JSON
Included files
This page lists paths and purposes, not source contents.
.env.example
Configuration required by this starter pack.
Config
20 lines
ADAPT.md
Give these instructions to the coding agent working in the buyer's Next.js project.
Markdown
130 lines
app/api/posthog/demo-conversion/route.ts
Simulates a trusted payment signal and runs the complete conversion flow.
TypeScript
79 lines
app/api/posthog/verify/route.ts
Ready-to-serve verification mount for a Next.js App Router application.
TypeScript
8 lines
app/product-analytics-demo/route.ts
Serves a dependency-free PostHog demo page with consent and conversion retry controls.
TypeScript
71 lines
instrumentation-client.ts
Copy this client initializer to the app root beside package.json in Next.js 15.3+.
TypeScript
30 lines
OPERATIONS.md
The code handles event delivery.
Markdown
50 lines
package.json
Configuration required by this starter pack.
JSON
18 lines
README.md
This starter gives a Next.js App Router application consent-aware product analytics, trusted server conversions, first-party proxy guidance, feature flags, funnels, and a readable verification route.
Markdown
100 lines
src/setup/check-setup.ts
Verifies PostHog settings because project and key creation remain dashboard work.
TypeScript
83 lines
src/setup/consent.ts
Reads consent cookies and wires browser grant or denial into PostHog capture.
TypeScript
34 lines
src/setup/POSTHOG_NEXT.md
`@posthog/next` combines proxy setup, server-rendered flag bootstrapping, and identity synchronization for Next.js applications.
Markdown
15 lines
src/setup/proxy-rewrites.ts
Builds ordered first-party proxy rewrites and documents the matching Next.js settings.
TypeScript
57 lines
starter.json
Configuration required by this starter pack.
JSON
6 lines
TROUBLESHOOTING.md
Find the symptom and apply the fix first.
Markdown
88 lines
tsconfig.json
Configuration required by this starter pack.
JSON
15 lines
Questions about session setup
Is this a PostHog Next.js starter?
Yes. The pack is built for Next.js apps that need safe event capture, useful funnels, feature flags, session context, clear tracking choices, and verification.