[CI] (dbf5526) next-js/15-pages-router-saas - #3187
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 Pages Router SaaS application. It adds both client-side (
Confidence score: 5/5 🧙
File changes
App sanity check ✅
Issues
|
| Criteria | Result | Description |
|---|---|---|
| PostHog SDKs installed | Yes | posthog-js@^1.407.5 and posthog-node@^5.46.1 added to package.json |
| PostHog client initialized | Yes | instrumentation-client.ts uses posthog.init() with env vars, following the documented Next.js pattern |
| capture() | Yes | 11 events captured across client (sign-out) and server (sign-in, sign-up, checkout, team actions, etc.) |
| identify() | Yes | posthog.identify(String(user.id), { email, role }) on login and on page refresh; posthog.reset() on logout |
| Error tracking | Yes | capture_exceptions: true in client init enables browser exception autocapture |
| Reverse proxy | No | No reverse proxy configured — Next.js rewrites or Vercel proxy should be added |
Issues
- No reverse proxy: Browser-side
posthog-jssends requests directly tous.i.posthog.com, which ad blockers will intercept. Configure a Next.js rewrite proxy or Vercel proxy to route through a first-party endpoint. [MEDIUM]
Other completed criteria
- API key loaded from
NEXT_PUBLIC_POSTHOG_PROJECT_TOKENenvironment variable, not hardcoded - API host loaded from
NEXT_PUBLIC_POSTHOG_HOSTenvironment variable - Client initialization is guarded — silently skips in production if env vars are missing, throws in development
- Server-side singleton pattern with
flushAt: 1andflushInterval: 0is correct for short-lived API routes tracing_headers: [window.location.hostname]links client and server sessions- Identify uses stable database user ID (
String(user.id)), not email - Email and role passed as person properties in
identify(), not as event properties posthog.reset()called after successful sign-out, before SWR cache clear- Header component re-identifies on page refresh when user is loaded via SWR
PostHog insights and events ✅
| Filename | PostHog events | Description |
|---|---|---|
components/header.tsx |
user_signed_out |
Captures sign-out before calling posthog.reset(); also handles identify on refresh |
components/login.tsx |
identify |
Identifies user with stable ID and person properties after auth success |
pages/api/auth/sign-in.ts |
user_signed_in |
Server-side capture with team_id on successful authentication |
pages/api/auth/sign-up.ts |
user_signed_up, team_created, team_invitation_accepted |
Captures registration with signup source, plus contextual team events |
pages/api/account/update.ts |
account_updated |
Server-side capture on profile update |
pages/api/team/invite.ts |
team_member_invited |
Captures invitation with role and team_id |
pages/api/team/remove-member.ts |
team_member_removed |
Captures member removal with team_id |
pages/api/stripe/create-checkout.ts |
checkout_started |
Captures checkout initiation with price_id |
pages/api/stripe/checkout.ts |
checkout_completed |
Captures successful checkout with subscription status |
pages/api/stripe/customer-portal.ts |
customer_portal_opened |
Captures portal access with team_id |
instrumentation-client.ts |
captureException (autocapture) |
Browser exceptions captured automatically via capture_exceptions: true |
Issues
No issues.
Other completed criteria
- All events represent real user actions in a SaaS product flow
- Events enable product insights: signup → checkout funnel, retention via sign-ins, team growth via invites
- Events include contextual properties (team_id, signup_source, invited_role, subscription_status, price_id)
- No PII in event properties — email/name only in
identify()person properties - Event names follow consistent snake_case convention and clearly describe the action
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:
dbf5526App:
next-js/15-pages-router-saasApp directory:
apps/next-js/15-pages-router-saasWorkbench branch:
wizard-ci-dbf5526-next-js-15-pages-router-saasWizard branch:
release-please--branches--main--components--wizardContext Mill branch:
mainPostHog (MCP) branch:
masterTimestamp: 2026-07-28T16:58:57.449Z
Duration: 481.9s
YARA Scanner