Repository navigation
[CI] (cc5471b) next-js/15-pages-router-saas - #4782
Closed
wizard-ci-bot[bot] wants to merge 1 commit into
Closed
wizard-ci-bot[bot] wants to merge 1 commit into
wizard-ci-bot[bot] wants to merge 1 commit into
Conversation
Author
|
Now I have everything I need. Let me produce the evaluation report. PR Evaluation ReportSummaryThis PR integrates PostHog into a Next.js 15 Pages Router SaaS application. It adds client-side initialization via
Confidence score: 4/5 👍
File changes
App sanity check
|
| Criteria | Result | Description |
|---|---|---|
| App builds and runs | OpenTelemetry package versions (^0.223.0, ^0.300.0, ^3.0.0) are unrealistically high and may not exist on npm, causing install failure. |
|
| Preserves existing env vars & configs | Yes | All existing env vars and configs are preserved. New PostHog vars are additive. |
| No syntax or type errors | Yes | All TypeScript code is syntactically valid with correct type usage. |
| Correct imports/exports | Yes | All imports resolve correctly. @/instrumentation import in API routes will resolve via the tsconfig path alias. |
| Minimal, focused changes | Yes | All changes relate to PostHog integration with no scope creep. |
| Pre-existing issues | None | Base app appears clean. |
Issues
- Potentially invalid OTel package versions:
@opentelemetry/api-logs: ^0.223.0and similar versions appear hallucinated. If these don't exist on npm,npm installwill fail and the app won't build. Verify and pin to actual published versions. [MEDIUM]
Other completed criteria
- Environment variables documented in
.env.example - Build configuration (package.json) has valid structure
.gitignoreproperly excludes.env.localand.env
PostHog implementation ⚠️
| Criteria | Result | Description |
|---|---|---|
| PostHog SDKs installed | Yes | posthog-js: ^1.441.2 added to dependencies |
| PostHog client initialized | Yes | instrumentation-client.ts calls posthog.init() with env-var-based key and host, matching the Next.js docs pattern |
| capture() | Yes | Multiple meaningful captures: checkout_started, user_signed_in, user_signed_up, user_signed_out, account_updated, team_member_removed, team_invitation_sent, subscription_management_opened |
| identify() | Yes | posthog.identify(String(user.id), { email, role, name }) called in both login handler and _app.tsx on app load with stable database ID. posthog.reset() called on user change and logout. |
| Error tracking | Yes | Custom ErrorBoundary with posthog.captureException() plus capture_exceptions: true in init config |
| Reverse proxy | No | next.config.ts has no rewrites or proxy configuration for PostHog |
Issues
- No reverse proxy: The Next.js docs recommend configuring rewrites in
next.config.tsto proxy PostHog requests through a first-party domain. Without this, ad blockers will intercept client-side events. Addrewrites()innext.config.tspointing/ingest/*tous.i.posthog.com(and/ingest/static/*tous-assets.i.posthog.com) and updateapi_hostaccordingly. [MEDIUM] - No
posthog-nodefor server-side: The PR uses OpenTelemetry logs for server-side tracking instead ofposthog-node. These are not PostHog events — they won't show in Activity, can't be used in funnels, and don't carrydistinct_id. For proper server-side event capture, installposthog-nodeand useposthog.capture(). [MEDIUM]
Other completed criteria
- API key loaded from
NEXT_PUBLIC_POSTHOG_KEYenvironment variable (not hardcoded) - API host loaded from
NEXT_PUBLIC_POSTHOG_HOSTenvironment variable - Identify uses stable
user.idfrom database, not email as distinct_id - PII (email, name) correctly placed in person properties via
identify(), not in event properties posthog.reset()called on logout and user switching
PostHog insights and events ✅
| Filename | PostHog events | Description |
|---|---|---|
instrumentation-client.ts |
(init, autocapture) | Initializes PostHog with exception autocapture and default autocapture for pageviews/clicks |
components/login.tsx |
user_signed_in, user_signed_up |
Captures auth events after successful login/signup with user identification |
components/header.tsx |
user_signed_out |
Captures sign-out action |
pages/pricing.tsx |
checkout_started |
Captures checkout initiation with plan_name, billing_interval, trial_days properties |
pages/dashboard/index.tsx |
subscription_management_opened, team_member_removed, team_invitation_sent |
Team management events; invitation includes invited_role property |
pages/dashboard/general.tsx |
account_updated |
Captures profile update |
components/error-boundary.tsx |
captureException |
Catches React errors with component stack |
pages/api/stripe/create-checkout.ts |
(OTel log: checkout_session_created) |
Server-side log emission, not a PostHog event |
pages/api/stripe/customer-portal.ts |
(OTel log: customer_portal_session_created) |
Server-side log emission |
pages/api/team/invite.ts |
(OTel log: team_invitation_created) |
Server-side log emission with invited_role attribute |
Issues
- Server-side logs are not PostHog events: The
emitPostHogLog()calls in API routes send OTel log records, not PostHogcapture()events. These won't appear in PostHog's event stream or be usable for product analytics (funnels, trends, retention). Replace withposthog-nodecapture calls for actionable analytics. [MEDIUM]
Other completed criteria
- Events represent real user actions across the full SaaS lifecycle (auth → dashboard → billing)
- Event names are descriptive and use consistent
snake_caseconvention - Events include relevant properties (plan details on checkout, role on invitation)
- No PII in event properties — email/name set via
identify()person properties only - Events enable product insights: sign-up → checkout funnel, team activity trends, subscription management
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: scheduled
Trigger ID:
cc5471bApp:
next-js/15-pages-router-saasApp directory:
apps/next-js/15-pages-router-saasWorkbench branch:
wizard-ci-cc5471b-next-js-15-pages-router-saasWizard branch:
mainContext Mill branch:
mainPostHog (MCP) branch:
masterTimestamp: 2026-10-28T16:53:14.332Z
Duration: 503.6s
YARA Scanner