[CI] (e2f7ab0) next-js/15-app-router-saas#2427
Closed
wizard-ci-bot[bot] wants to merge 1 commit into
Closed
Conversation
Author
PR Evaluation ReportSummaryThis PR integrates PostHog into a Next.js 15 App Router SaaS application with both client-side (
Confidence score: 4/5 👍
File changes
App sanity check
|
| Criteria | Result | Description |
|---|---|---|
| App builds and runs | Yes | No syntax or type errors; all imports resolve correctly |
| Preserves existing env vars & configs | Yes | Existing next.config.ts structure preserved; rewrites added cleanly |
| No syntax or type errors | Yes | All TypeScript is valid; non-null assertions on env vars are standard for Next.js |
| Correct imports/exports | Yes | posthog-js imported client-side only, posthog-node server-side only |
| Minimal, focused changes | Yes | All changes directly related to PostHog integration |
| Pre-existing issues | None | No pre-existing issues observed |
Issues
- Missing
.env.example:NEXT_PUBLIC_POSTHOG_PROJECT_TOKENandNEXT_PUBLIC_POSTHOG_HOSTare used but not documented in any env example file. Collaborators won't know what variables to set. [MEDIUM]
Other completed criteria
- Build configuration is valid —
package.jsondependencies are correct,next.config.tsrewrites are properly structured - All existing app functionality preserved — no code removed or broken
PostHog implementation ⚠️
| Criteria | Result | Description |
|---|---|---|
| PostHog SDKs installed | Yes | posthog-js@^1.398.0 and posthog-node@^5.39.4 added to package.json |
| PostHog client initialized | Yes | Client init in instrumentation-client.ts (recommended for Next.js 15.3+); server client factory in lib/posthog-server.ts with flushAt: 1, flushInterval: 0 |
| capture() | Yes | 13 distinct events captured across client and server |
| identify() | Yes | PostHogIdentify component identifies users with String(user.id) + person properties; server-side identify on signup |
| Error tracking | Yes | capture_exceptions: true in posthog.init() config |
| Reverse proxy | Yes | Next.js rewrites route /ingest/* through proxy; /ingest/static/* and /ingest/array/* correctly routed to us-assets.i.posthog.com |
Issues
- Webhook fabricated distinct_id: The Stripe webhook handler captures
subscription_updatedandsubscription_canceledwithdistinctId: \stripe_customer_`. This doesn't match theString(user.id)` used everywhere else, so these events won't associate with actual user profiles. Look up the user by Stripe customer ID from your database before capturing. [MEDIUM]
Other completed criteria
- API key loaded from
process.env.NEXT_PUBLIC_POSTHOG_PROJECT_TOKEN— not hardcoded - Host correctly configured via env var for server, reverse proxy
/ingestfor client posthog.reset()called on sign-out to unlink sessionsui_hostcorrectly set tohttps://us.posthog.comwhen using reverse proxy- Server-side client properly calls
await posthog.shutdown()after every capture
PostHog insights and events ✅
| Filename | PostHog events | Description |
|---|---|---|
app/(login)/actions.ts |
user_signed_in, user_signed_up, user_signed_out, password_updated, account_deleted, account_updated, team_member_removed, team_member_invited |
Server-side auth & team management events with team_id, role, and invitation context |
app/api/stripe/checkout/route.ts |
checkout_completed |
Captures successful Stripe checkout with plan name, product ID, and subscription ID |
app/api/stripe/webhook/route.ts |
subscription_updated, subscription_canceled |
Stripe webhook events with subscription status and plan info |
app/(dashboard)/pricing/submit-button.tsx |
checkout_started |
Client-side click on checkout button |
app/(dashboard)/dashboard/page.tsx |
manage_subscription_clicked |
Client-side click with plan name and subscription status properties |
instrumentation-client.ts |
captureException (via capture_exceptions: true) |
Automatic exception capture enabled |
Issues
checkout_startedlacks properties: The event is captured bare with no properties (e.g., plan name, price). Adding plan context would enable richer funnel analysis. [LOW]
Other completed criteria
- Events represent real user actions mapping to actual product flows (signup → checkout → subscription lifecycle)
- Events enable product insights — clear funnel from
checkout_started→checkout_completed, retention viauser_signed_in, churn viasubscription_canceled - Most events include contextual properties (
team_id,plan_name,subscription_status,role) - No PII in event properties — email and name only passed via
identify()person properties - Consistent snake_case naming convention across all events
Reviewed by wizard workbench PR evaluator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Automated wizard CI run
Source: wizard-pr
Trigger ID:
e2f7ab0App:
next-js/15-app-router-saasApp directory:
apps/next-js/15-app-router-saasWorkbench branch:
wizard-ci-e2f7ab0-next-js-15-app-router-saasWizard branch:
release-please--branches--main--components--wizardContext Mill branch:
mainPostHog (MCP) branch:
masterTimestamp: 2026-07-06T22:10:10.232Z
Duration: 534.8s
YARA Scanner