Skip to content

[CI] (22322bc) next-js/15-app-router-saas - #3644

Closed
wizard-ci-bot[bot] wants to merge 1 commit into
mainfrom
wizard-ci-22322bc-next-js-15-app-router-saas
Closed

wizard-ci-bot[bot] wants to merge 1 commit into
mainfrom
wizard-ci-22322bc-next-js-15-app-router-saas

Conversation

@wizard-ci-bot

@wizard-ci-bot wizard-ci-bot Bot commented Aug 28, 2026

Copy link
Copy Markdown

Automated wizard CI run

Source: wizard-pr
Trigger ID: 22322bc
App: next-js/15-app-router-saas
App directory: apps/next-js/15-app-router-saas
Workbench branch: wizard-ci-22322bc-next-js-15-app-router-saas
Wizard branch: release-please--branches--main--components--wizard
Context Mill branch: main
PostHog (MCP) branch: master
Timestamp: 2026-08-28T19:21:00.889Z
Duration: 353.9s

YARA Scanner

✓ 148 tool calls scanned, 0 violations detected

No violations: ✓ 148 clean scans

@wizard-ci-bot

wizard-ci-bot Bot commented Aug 28, 2026

Copy link
Copy Markdown
Author

PR Evaluation Report

Summary

This PR integrates PostHog into a Next.js 15 App Router SaaS application using posthog-js. It initializes PostHog via instrumentation-client.ts, adds user identification with posthog.identify() and posthog.reset() on logout, captures seven meaningful custom events across dashboard pages, and implements error tracking via a global-error.tsx boundary and capture_exceptions: true.

Files changed Lines added Lines removed
9 +141 -37

Confidence score: 5/5 🧙

  • No reverse proxy configured — browser-side posthog-js requests are vulnerable to ad blockers [MEDIUM]
  • All capture() calls are bare with zero event properties — limits ability to build enriched funnels or breakdowns [MEDIUM]

File changes

Filename Score Description
instrumentation-client.ts 5/5 New file: initializes PostHog with env vars, capture_exceptions, and debug mode — correct Next.js pattern
app/global-error.tsx 5/5 New file: global error boundary calling posthog.captureException(error)
app/(dashboard)/layout.tsx 4/5 Adds PostHogIdentifier component with useEffect for identify, and posthog.reset() on sign-out
app/(dashboard)/dashboard/page.tsx 4/5 Adds 3 capture calls for subscription, team member, and invite actions — no properties
app/(dashboard)/dashboard/general/page.tsx 4/5 Adds capture for account update — no properties
app/(dashboard)/dashboard/security/page.tsx 4/5 Adds capture for password update and account deletion — no properties
app/(dashboard)/pricing/submit-button.tsx 4/5 Adds capture for checkout start — no properties
package.json 5/5 Adds posthog-js dependency
.env.example 5/5 Documents NEXT_PUBLIC_POSTHOG_PROJECT_TOKEN and NEXT_PUBLIC_POSTHOG_HOST

App sanity check ✅

Criteria Result Description
App builds and runs Yes No syntax errors, valid TypeScript, correct Next.js file conventions
Preserves existing env vars & configs Yes Existing .env.example entries preserved, only PostHog vars appended
No syntax or type errors Yes All JSX/TSX is valid, imports resolve correctly
Correct imports/exports Yes posthog-js imported correctly in all client components
Minimal, focused changes Yes All changes relate to PostHog integration; layout re-indentation is necessary for Fragment wrapper
Pre-existing issues None —

Other completed criteria

  • Environment variables use NEXT_PUBLIC_ prefix for client-side access
  • package.json dependency addition is properly placed alphabetically
  • instrumentation-client.ts includes guard for missing env vars in non-production

PostHog implementation ⚠️

Criteria Result Description
PostHog SDKs installed Yes posthog-js: ^1.422.5 added to package.json
PostHog client initialized Yes instrumentation-client.ts calls posthog.init() with token and host from env — correct Next.js pattern
capture() Yes 7 custom events across dashboard, security, pricing pages
identify() Yes posthog.identify(user.id.toString(), { email, name, role }) using stable DB ID; posthog.reset() on sign-out
Error tracking Yes capture_exceptions: true in init config + global-error.tsx with posthog.captureException(error)
Reverse proxy No No reverse proxy or Next.js rewrites configured

Issues

  • No reverse proxy: No Next.js rewrites or middleware proxy configured. PostHog requests go directly to the PostHog host, making them susceptible to ad blockers. Configure a reverse proxy via Next.js rewrites or the managed reverse proxy. [MEDIUM]

Other completed criteria

  • API key correctly loaded from NEXT_PUBLIC_POSTHOG_PROJECT_TOKEN environment variable
  • Host correctly loaded from NEXT_PUBLIC_POSTHOG_HOST environment variable
  • identify() uses user.id.toString() — a stable database ID, not email
  • Person properties (email, name, role) correctly passed as the second argument to identify()
  • posthog.reset() called before sign-out navigation
  • defaults: '2026-01-30' is a valid defaults snapshot (though '2026-05-30' is the latest)

PostHog insights and events ✅

Filename PostHog events Description
instrumentation-client.ts Autocapture (pageviews, clicks) SDK initialization enables autocapture by default
app/(dashboard)/layout.tsx identify, reset User identification on load, reset on sign-out
app/(dashboard)/dashboard/general/page.tsx account_update_submitted Tracks account info form submissions
app/(dashboard)/dashboard/page.tsx subscription_portal_opened, team_member_removed, team_member_invited Tracks subscription management and team operations
app/(dashboard)/dashboard/security/page.tsx password_update_submitted, account_deletion_submitted Tracks security-related actions
app/(dashboard)/pricing/submit-button.tsx checkout_started Tracks checkout flow initiation
app/global-error.tsx captureException Captures unhandled React errors via global error boundary

Issues

  • No event properties on any capture call: All 7 custom events are bare posthog.capture('event_name') with no properties. Adding contextual properties (e.g., team_member_invited with { role }, checkout_started with { plan_name }, team_member_removed with { member_role }) would enable richer breakdowns and funnel analysis. [MEDIUM]

Other completed criteria

  • Events represent real user actions in the SaaS workflow (account management, team management, billing, security)
  • Events enable product insights: checkout → subscription portal → team management forms a usable funnel
  • Event names use consistent snake_case convention with descriptive action verbs
  • No PII in event properties (email, name only in identify() person properties)

Reviewed by wizard workbench PR evaluator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants