Repository navigation
[CI] (9f92c68) next-js/15-app-router-saas - #2540
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
PR Evaluation ReportSummaryThis PR integrates PostHog into a Next.js 15 App Router SaaS starter application. It adds client-side initialization via
Confidence score: 4/5 👍
File changes
App sanity check
|
| Criteria | Result | Description |
|---|---|---|
| App builds and runs | Yes | No syntax errors or missing dependencies; all imports resolve correctly |
| Preserves existing env vars & configs | Yes | Existing next.config.ts, package.json, and app code preserved; PostHog additions are additive |
| No syntax or type errors | Yes | TypeScript types are correct; posthog-node and posthog-js APIs used correctly |
| Correct imports/exports | Yes | posthog-js only on client ('use client' components + instrumentation-client.ts), posthog-node only on server |
| Minimal, focused changes | Yes | All changes are PostHog-related; existing logic patterns maintained |
| Pre-existing issues | None | Base app appears functional |
Issues
- Missing
.env.exampleupdate:NEXT_PUBLIC_POSTHOG_PROJECT_TOKENandNEXT_PUBLIC_POSTHOG_HOSTare required for the integration to work, but no.env.examplefile is created or updated. Collaborators won't know what environment variables to set. [MEDIUM]
Other completed criteria
- Build configuration is valid —
package.jsonhas correct dependency entries andnext.config.tsexports valid config - All file modifications follow existing codebase patterns (indentation, naming conventions, import ordering)
.gitignorecorrectly excludes.env.localto prevent secret leakage
PostHog implementation ✅
| Criteria | Result | Description |
|---|---|---|
| PostHog SDKs installed | Yes | posthog-js (^1.398.6) and posthog-node (^5.40.0) added to package.json |
| PostHog client initialized | Yes | Client via instrumentation-client.ts (recommended Next.js 15.3+ pattern); server via getPostHogClient() factory with flushAt: 1, flushInterval: 0 |
| capture() | Yes | 12 distinct events captured across client and server |
| identify() | Yes | Client-side posthog.identify(String(user.id)) in UserMenu useEffect on user load; server-side identify in sign-in/sign-up actions; posthog.reset() on logout |
| Error tracking | Yes | capture_exceptions: true in posthog.init() config enables automatic exception capture |
| 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
distinct_idis fabricated: Inapp/api/stripe/webhook/route.ts, thedistinctIdis set tostripe_customer_which is a Stripe customer ID, not a real PostHog user identifier. These events will create orphaned profiles unlinked to actual users. Fix by looking up the user from the Stripe customer ID in the database, or by extracting metadata attached during checkout session creation. [MEDIUM] - Older
defaultsdate:instrumentation-client.tsusesdefaults: '2026-01-30'while the current recommended value is'2026-05-30'. This means the client won't pick up newer default configuration improvements. [LOW]
Other completed criteria
- API key loaded from
process.env.NEXT_PUBLIC_POSTHOG_PROJECT_TOKEN— not hardcoded - Host correctly configured: client uses
/ingest(reverse proxy), server usesNEXT_PUBLIC_POSTHOG_HOSTenv var ui_hostcorrectly set tohttps://us.posthog.comfor toolbar/feature flag UIposthog.shutdown()called after every server-side capture to ensure events are flushedskipTrailingSlashRedirect: trueadded tonext.config.tsto prevent redirect loops with the proxy
PostHog insights and events ✅
| Filename | PostHog events | Description |
|---|---|---|
instrumentation-client.ts |
captureException (auto) |
Automatic exception capture enabled via capture_exceptions: true |
app/(dashboard)/layout.tsx |
identify, reset |
User identification on session load, reset on logout |
app/(dashboard)/pricing/submit-button.tsx |
checkout_started |
Tracks when user initiates checkout from pricing page |
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 |
Comprehensive server-side event tracking for all auth and team management actions |
app/api/stripe/checkout/route.ts |
checkout_completed |
Tracks successful Stripe checkout with plan name and subscription status |
app/api/stripe/webhook/route.ts |
subscription_updated, subscription_cancelled |
Tracks subscription lifecycle changes from Stripe webhooks |
Issues
- No critical or medium issues with event quality.
Other completed criteria
- Events represent real user actions mapping to actual SaaS product flows (auth, billing, team management)
- Events enable clear product insights: signup→checkout→completed funnel, sign-in vs sign-up trends, team collaboration metrics
- Events enriched with contextual properties:
team_id,plan_name,subscription_status,via_invitation,invited_role,removed_member_id - No PII in capture properties —
nameandroleare set viaidentify()person properties, not incapture()calls - Event naming is consistent snake_case and descriptive of 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:
9f92c68App:
next-js/15-app-router-saasApp directory:
apps/next-js/15-app-router-saasWorkbench branch:
wizard-ci-9f92c68-next-js-15-app-router-saasWizard branch:
release-please--branches--main--components--wizardContext Mill branch:
mainPostHog (MCP) branch:
masterTimestamp: 2026-07-08T17:01:33.540Z
Duration: 497.1s
YARA Scanner