Skip to content

[CI] (b6c5097) next-js/15-app-router-saas - #4073

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

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

Conversation

@wizard-ci-bot

@wizard-ci-bot wizard-ci-bot Bot commented Sep 22, 2026

Copy link
Copy Markdown

Automated wizard CI run

Source: wizard-pr
Trigger ID: b6c5097
App: next-js/15-app-router-saas
App directory: apps/next-js/15-app-router-saas
Workbench branch: wizard-ci-b6c5097-next-js-15-app-router-saas
Wizard branch: posthog/functional-a1-min
Context Mill branch: main
PostHog (MCP) branch: master
Timestamp: 2026-09-22T01:21:45.199Z
Duration: 352.8s

YARA Scanner

✓ 148 tool calls scanned, 0 violations detected

No violations: ✓ 148 clean scans

@wizard-ci-bot

wizard-ci-bot Bot commented Sep 22, 2026

Copy link
Copy Markdown
Author

PR Evaluation Report

Summary

This PR integrates PostHog into a Next.js 15 App Router SaaS application. It adds client-side initialization via instrumentation-client.ts, user identification with posthog.identify() and posthog.reset(), custom event captures across login, dashboard, team management, and checkout flows, and error tracking via a global-error.tsx boundary and capture_exceptions: true.

Files changed Lines added Lines removed
12 +119 -8

Confidence score: 5/5 🧙

  • No reverse proxy configured: Next.js full-stack apps benefit from a reverse proxy to avoid ad-blocker interception. No rewrites in next.config.ts or middleware proxy. [MEDIUM]
  • All capture() calls lack event properties: Every posthog.capture() call is bare (e.g., posthog.capture('checkout_started')) with zero contextual properties, limiting analytics value for funnels and breakdowns. [MEDIUM]

File changes

Filename Score Description
instrumentation-client.ts 4/5 PostHog initialization with env var validation and dev-mode error throwing. Uses defaults: '2026-01-30' (older than current '2026-05-30').
app/(dashboard)/layout.tsx 5/5 Excellent identify/reset logic using useRef to track user changes, posthog.reset() on sign-out and user switch.
app/global-error.tsx 4/5 Error boundary with captureException in useEffect. Solid pattern.
package.json 5/5 posthog-js added to dependencies.
.env.example 5/5 Documents NEXT_PUBLIC_POSTHOG_KEY and NEXT_PUBLIC_POSTHOG_HOST.
app/(dashboard)/dashboard/page.tsx 3/5 Three capture calls for subscription/team actions, all missing contextual properties.
app/(dashboard)/dashboard/security/page.tsx 3/5 Password update and account deletion captures, no properties.
app/(dashboard)/dashboard/general/page.tsx 3/5 Account update capture, no properties.
app/(login)/login.tsx 4/5 Sign-in/sign-up captures with mode-based event naming — clean.
app/(dashboard)/pricing/submit-button.tsx 3/5 Checkout started capture, missing price/plan properties.
app/(dashboard)/terminal.tsx 4/5 Setup commands copy capture in event handler — correct pattern.
.gitignore 5/5 Prevents .env from being committed.

App sanity check ✅

Criteria Result Description
App builds and runs Yes No syntax errors, valid TypeScript, correct file conventions
Preserves existing env vars & configs Yes All existing configs and env vars untouched; only PostHog additions
No syntax or type errors Yes All files are syntactically valid; use import was already unused and correctly replaced with useEffect/useRef
Correct imports/exports Yes posthog-js imported only in 'use client' components and instrumentation-client.ts
Minimal, focused changes Yes All changes are PostHog-related with no scope creep
Pre-existing issues None —

Issues

No issues.

Other completed criteria

  • Environment variables documented in .env.example
  • Build configuration valid — posthog-js added correctly to package.json dependencies
  • .gitignore updated to exclude .env

PostHog implementation ⚠️

Criteria Result Description
PostHog SDKs installed Yes posthog-js@^1.434.5 added to package.json
PostHog client initialized Yes instrumentation-client.ts with posthog.init(), env var validation, and capture_exceptions: true
capture() Yes 10 custom event captures across login, dashboard, team, checkout, and terminal flows
identify() Yes posthog.identify(user.id.toString(), { email, name, role }) with useRef guard and reset() on sign-out/user-switch
Error tracking Yes global-error.tsx with posthog.captureException(error) + capture_exceptions: true in init config
Reverse proxy No No rewrites in next.config.ts, no middleware proxy configured

Issues

  • No reverse proxy configured: The next.config.ts has no rewrites to proxy PostHog requests through a first-party domain. For a production SaaS app, this means ad blockers will silently drop events. Add Next.js rewrites or use PostHog's managed reverse proxy. [MEDIUM]
  • Older defaults date: instrumentation-client.ts uses defaults: '2026-01-30' instead of the current '2026-05-30'. This is functional but misses newer default configuration improvements. [LOW]

Other completed criteria

  • API key loaded from NEXT_PUBLIC_POSTHOG_KEY environment variable (not hardcoded)
  • Host loaded from NEXT_PUBLIC_POSTHOG_HOST environment variable
  • Identify uses stable database ID (user.id.toString()), not email as distinct_id
  • PII (email, name) correctly placed in person properties via identify(), not in capture() properties
  • posthog.reset() called on logout and on user switch — excellent handling

PostHog insights and events ✅

Filename PostHog events Description
login.tsx sign_in_submitted, sign_up_submitted Tracks authentication funnel entry points
dashboard/page.tsx subscription_management_opened, team_member_removal_submitted, team_member_invitation_submitted Tracks subscription and team management actions
dashboard/general/page.tsx account_update_submitted Tracks account profile updates
dashboard/security/page.tsx password_update_submitted, account_deletion_submitted Tracks security-sensitive actions
pricing/submit-button.tsx checkout_started Tracks checkout funnel entry
terminal.tsx setup_commands_copied Tracks onboarding engagement
global-error.tsx captureException Captures unhandled React errors
layout.tsx identify, reset User identification and session management

Issues

  • All capture() calls lack event properties: None of the 10 custom events include contextual properties. For example, checkout_started should include plan_name or price_id; team_member_invitation_submitted should include team_id; account_deletion_submitted could include account_age_days. Without properties, funnels and breakdowns lose significant analytical value. [MEDIUM]

Other completed criteria

  • Events represent real user actions across the SaaS product lifecycle (auth → onboarding → team management → billing)
  • Events enable product insights: can build sign-up → checkout funnel, team engagement trends, retention analysis
  • Event names are descriptive, consistently snake_case, and action-oriented
  • No PII in capture() 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