Skip to content

[CI] (edaca63) next-js/15-app-router-todo - #2883

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

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

Conversation

@wizard-ci-bot

@wizard-ci-bot wizard-ci-bot Bot commented Jul 16, 2026

Copy link
Copy Markdown

Automated wizard CI run

Source: wizard-pr
Trigger ID: edaca63
App: next-js/15-app-router-todo
App directory: apps/next-js/15-app-router-todo
Workbench branch: wizard-ci-edaca63-next-js-15-app-router-todo
Wizard branch: release-please--branches--main--components--wizard
Context Mill branch: main
PostHog (MCP) branch: master
Timestamp: 2026-07-16T17:06:19.164Z
Duration: 164.9s

YARA Scanner

✓ 69 tool calls scanned, 0 violations detected

No violations: ✓ 69 clean scans

@wizard-ci-bot

wizard-ci-bot Bot commented Jul 16, 2026

Copy link
Copy Markdown
Author

PR Evaluation Report

Summary

This PR integrates PostHog into a Next.js 15 App Router todo application. It adds both client-side (posthog-js via instrumentation-client.ts) and server-side (posthog-node) SDKs, capturing todo CRUD events from both the browser and API routes, with exception tracking on error paths. The integration follows the documented Next.js pattern well, though it's missing a reverse proxy configuration and .env.example documentation.

Files changed Lines added Lines removed
7 +114 -0

Confidence score: 4/5 👍

  • No reverse proxy configured: next.config.ts has no rewrites to proxy PostHog requests, making client-side events susceptible to ad blockers. [MEDIUM]
  • No .env.example updated: The PR adds .env.local but does not create or update .env.example to document the required environment variables for other developers. [MEDIUM]
  • No identify() call: The app has no authentication, so this is N/A for the app's architecture, but worth noting that all server-side events fall back to 'anonymous' as distinct_id when the header is missing.

File changes

Filename Score Description
instrumentation-client.ts 5/5 New file: Initializes posthog-js with env vars, defaults, exception capture, and debug mode — follows the documented Next.js pattern exactly
lib/posthog-server.ts 4/5 New file: Server-side PostHog client factory with correct flushAt: 1 and flushInterval: 0 settings for short-lived Next.js functions
components/todos/todo-list.tsx 4/5 Adds client-side event capture for todo CRUD operations and forwards distinct/session IDs to API routes
app/api/todos/route.ts 4/5 Adds server-side capture for todo_created with properties and exception tracking
app/api/todos/[id]/route.ts 4/5 Adds server-side capture for todo_updated and todo_deleted with exception tracking
package.json 5/5 Adds posthog-js and posthog-node dependencies
posthog-setup-report.md 5/5 Documentation of integration decisions and next steps

App sanity check ✅

Criteria Result Description
App builds and runs Yes No syntax errors, valid TypeScript, proper imports
Preserves existing env vars & configs Yes Only additive changes, no existing code modified destructively
No syntax or type errors Yes All TypeScript is valid; non-null assertions on env vars are standard for Next.js
Correct imports/exports Yes posthog-js imported client-side, posthog-node server-side — correct separation
Minimal, focused changes Yes All changes relate to PostHog integration
Pre-existing issues None Base app appears functional

Issues

  • No .env.example: The .env.local was created with real values but no .env.example file was added to document required variables for other developers. [MEDIUM]

Other completed criteria

  • All changes are relevant to PostHog integration
  • Correct files modified for Next.js App Router pattern
  • Code follows existing codebase conventions (async handlers, try/catch patterns)
  • Build configuration valid with proper dependency additions

PostHog implementation ⚠️

Criteria Result Description
PostHog SDKs installed Yes posthog-js@^1.402.3 and posthog-node@^5.44.0 added to package.json
PostHog client initialized Yes Client: instrumentation-client.ts with posthog.init(). Server: factory function in lib/posthog-server.ts with flushAt: 1, flushInterval: 0 — both follow documented patterns
capture() Yes Multiple meaningful captures: todo_created, todo_completion_toggled, todo_updated, todo_deleted on both client and server
identify() N/A App has no authentication system; no login flow exists to hook into
Error tracking Yes Client-side: capture_exceptions: true in init + manual posthog.captureException(error) in catch blocks. Server-side: posthog.captureException(error, 'anonymous') in API route catch blocks
Reverse proxy No No rewrites configured in next.config.ts — client-side events may be blocked by ad blockers

Issues

  • No reverse proxy: next.config.ts contains no rewrites to proxy PostHog requests through the app's domain. The PostHog docs recommend this for Next.js to avoid ad blockers intercepting client-side events. [MEDIUM]

Other completed criteria

  • API key loaded from process.env.NEXT_PUBLIC_POSTHOG_PROJECT_TOKEN — not hardcoded
  • Host correctly configured via process.env.NEXT_PUBLIC_POSTHOG_HOST pointing to https://us.i.posthog.com
  • Server-side client properly calls await posthog.shutdown() after capturing
  • Session ID and distinct ID correctly forwarded from client to server via headers
  • defaults: '2026-05-30' correctly set in client init

PostHog insights and events ✅

Filename PostHog events Description
components/todos/todo-list.tsx todo_created, todo_completion_toggled, todo_deleted, captureException Client-side tracking of all todo CRUD operations with enriched properties (completion state, has_description)
app/api/todos/route.ts todo_created, captureException Server-side todo creation tracking with properties including initial_completion_state, has_description, source
app/api/todos/[id]/route.ts todo_updated, todo_deleted, captureException Server-side update/delete tracking with completion_state_changed and source properties

Issues

  • No issues — events are well-structured and meaningful.

Other completed criteria

  • Events represent real user actions (creating, completing, deleting todos)
  • Events enable product insights — can build funnels from creation → completion → deletion
  • Events include relevant properties (completion state, has_description, source)
  • No PII in event properties
  • Event names are descriptive and use consistent snake_case naming

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