Skip to content

[CI] (624abe2) next-js/15-app-router-saas - #4461

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

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

Conversation

@wizard-ci-bot

@wizard-ci-bot wizard-ci-bot Bot commented Oct 8, 2026

Copy link
Copy Markdown

Automated wizard CI run

Source: wizard-pr
Trigger ID: 624abe2
App: next-js/15-app-router-saas
App directory: apps/next-js/15-app-router-saas
Workbench branch: wizard-ci-624abe2-next-js-15-app-router-saas
Wizard branch: release-please--branches--main--components--wizard
Context Mill branch: main
PostHog (MCP) branch: master
Timestamp: 2026-10-08T09:17:14.103Z
Duration: 423.3s

YARA Scanner

✓ 184 tool calls scanned, 0 violations detected

No violations: ✓ 184 clean scans

@wizard-ci-bot

wizard-ci-bot Bot commented Oct 8, 2026

Copy link
Copy Markdown
Author

Now I have all the context I need. Let me produce the evaluation report.


PR Evaluation Report

Summary

This PR integrates PostHog into a Next.js 15 App Router SaaS application. Client-side setup uses posthog-js via instrumentation-client.ts with event captures across dashboard, auth, and pricing components. Server-side uses an unconventional OpenTelemetry OTLP log exporter instead of the documented posthog-node SDK. Error tracking and user identification are implemented.

Files changed Lines added Lines removed
13 +189 -10

Confidence score: 5/5 🧙

  • No reverse proxy configured: Full-stack Next.js apps should configure a reverse proxy (e.g., via Next.js rewrites) to prevent ad blockers from intercepting client-side events. [MEDIUM]
  • Server-side uses OTLP logs instead of posthog-node: The documented pattern for Next.js server-side analytics is posthog-node. The OpenTelemetry OTLP log setup sends log records, not PostHog events — these won't appear in PostHog's event analytics (funnels, trends, retention). It also adds 4 heavy OpenTelemetry dependencies unnecessarily. [MEDIUM]
  • Most capture calls lack enriched properties: 8 of 9 client-side events are bare captures with no contextual properties (e.g., checkout_started has no plan/price, team_invitation_submitted has no role). [MEDIUM]

File changes

Filename Score Description
instrumentation-client.ts 4/5 Correct client-side PostHog initialization via posthog.init() with env vars; uses older defaults: "2026-01-30" instead of latest "2026-05-30"
instrumentation.ts 2/5 Non-standard OTLP log exporter setup instead of documented posthog-node; adds 4 heavy dependencies for what could be a simple SDK call
app/global-error.tsx 5/5 Proper error boundary with posthog.captureException()
app/(dashboard)/layout.tsx 4/5 Good identify/reset pattern using stable user.id; useEffect dependency [user?.id] misses updates to email/name/role
app/(login)/login.tsx 4/5 Auth event capture with mode property — one of few events with properties
app/(dashboard)/dashboard/page.tsx 3/5 Three capture calls all without contextual properties
app/(dashboard)/dashboard/general/page.tsx 3/5 Form submit capture without properties
app/(dashboard)/dashboard/security/page.tsx 3/5 Password/delete captures without properties
app/(dashboard)/pricing/submit-button.tsx 3/5 Checkout capture without price/plan properties
app/api/stripe/checkout/route.ts 2/5 Uses OTLP logs instead of PostHog events; no distinct_id attached to server-side captures
.env.example 5/5 Both env vars documented
.gitignore 5/5 Prevents .env from being committed
package.json 3/5 posthog-js added correctly; 4 OpenTelemetry packages added unnecessarily

App sanity check ⚠️

Criteria Result Description
App builds and runs Yes Syntax is valid, imports resolve, Next.js 15 after() API used correctly
Preserves existing env vars & configs Yes Existing .env.example entries and next.config.ts preserved
No syntax or type errors Yes All files have valid TypeScript/TSX syntax
Correct imports/exports Yes posthog-js imported correctly in client components; @/instrumentation exports used in route
Minimal, focused changes Yes All changes are PostHog-related, though the OTLP approach is more complex than needed
Pre-existing issues None Base app appears functional

Issues

  • OpenTelemetry package versions may be invalid: Versions ^0.223.0 for @opentelemetry/api-logs and related packages appear unusually high and may not exist, which would cause npm install to fail. [LOW]

Other completed criteria

  • Environment variables documented in .env.example
  • .gitignore added to prevent .env leaks
  • Build configuration (package.json) is syntactically valid

PostHog implementation ⚠️

Criteria Result Description
PostHog SDKs installed Yes posthog-js: ^1.438.2 added to package.json
PostHog client initialized Yes posthog.init() in instrumentation-client.ts with env vars and capture_exceptions: true
capture() Yes 9 meaningful posthog.capture() calls across auth, dashboard, pricing, and security pages
identify() Yes posthog.identify(String(user.id), { email, name, role }) in dashboard layout using stable DB user ID; posthog.reset() on sign-out
Error tracking Yes global-error.tsx calls posthog.captureException(error) + capture_exceptions: true in init config
Reverse proxy No No reverse proxy configured; Next.js rewrites or Vercel proxy not set up

Issues

  • No reverse proxy: The Next.js docs recommend configuring a reverse proxy via Next.js rewrites, middleware, or Vercel rewrites. Without this, ad blockers will silently drop client-side events. Add rewrites in next.config.ts to proxy /ingest to the PostHog host. [MEDIUM]
  • Server-side uses OTLP logs instead of posthog-node: The instrumentation.ts file sets up an OpenTelemetry log exporter that sends log records to /i/v1/logs. This is not the documented Next.js server-side pattern. The standard approach is posthog-node with PostHog client, capture() calls, and await posthog.shutdown(). OTLP log records are not PostHog events — they won't appear in funnels, trends, or retention charts. Install posthog-node and use the documented PostHogClient pattern. [MEDIUM]
  • Older defaults date: defaults: "2026-01-30" is used instead of the current "2026-05-30". This means the SDK uses older default configuration values. [LOW]

Other completed criteria

  • API key loaded from NEXT_PUBLIC_POSTHOG_PROJECT_TOKEN environment variable (not hardcoded)
  • API host loaded from NEXT_PUBLIC_POSTHOG_HOST environment variable
  • posthog.reset() correctly called on sign-out before navigation
  • Identify uses stable user.id from the database, not email as distinct ID
  • Person properties (email, name, role) set via identify, not in capture properties

PostHog insights and events ⚠️

Filename PostHog events Description
login.tsx authentication_submitted Captures sign-in/sign-up form submission with { mode } property
layout.tsx user_signed_out Captures sign-out action, followed by posthog.reset()
dashboard/page.tsx subscription_portal_opened, team_member_removal_submitted, team_invitation_submitted Dashboard management events — no contextual properties
dashboard/general/page.tsx account_update_submitted Account info form submission — no properties
dashboard/security/page.tsx password_update_submitted, account_deletion_submitted Security-related actions — no properties
pricing/submit-button.tsx checkout_started Pricing checkout click — no price/plan properties
global-error.tsx captureException Global error boundary for uncaught React errors
api/stripe/checkout/route.ts OTLP logs: stripe_checkout_completion_started, _succeeded, _failed Server-side checkout lifecycle via OTLP logs (not PostHog events)

Issues

  • Events lack enriched properties: Only authentication_submitted includes a property (mode). Critical events like checkout_started should include plan, price_id, or currency. team_invitation_submitted should include role. team_member_removal_submitted should include member_id. Without properties, these events provide limited analytical value beyond counts. [MEDIUM]
  • Server-side OTLP logs lack distinct_id: The logCheckoutLifecycle calls in the Stripe checkout route emit OTLP logs without any user identifier. Even as logs, they cannot be attributed to specific users. [MEDIUM]

Other completed criteria

  • Events represent real user actions (authentication, checkout, team management, account settings)
  • Event names are descriptive and use consistent snake_case convention
  • Events could form meaningful funnels (authentication → checkout → subscription management)
  • No PII in capture properties; email/name correctly placed 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