Skip to content

[CI] (0ae2102) next-js/15-app-router-todo - #1226

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

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

Conversation

@wizard-ci-bot

@wizard-ci-bot wizard-ci-bot Bot commented Apr 15, 2026

Copy link
Copy Markdown

Automated wizard CI run

Source: wizard-pr
Trigger ID: 0ae2102
App: next-js/15-app-router-todo
App directory: apps/next-js/15-app-router-todo
Workbench branch: wizard-ci-0ae2102-next-js-15-app-router-todo
Wizard branch: release-please--branches--main--components--wizard
Context Mill branch: main
PostHog (MCP) branch: master
Timestamp: 2026-04-15T19:18:45.475Z
Duration: 402.3s

@wizard-ci-bot

wizard-ci-bot Bot commented Apr 15, 2026

Copy link
Copy Markdown
Author

Now I have all the information needed to write the evaluation. The app is a Next.js 15 App Router todo app with no authentication. Let me produce the review.


PR Evaluation Report

Summary

This PR integrates PostHog into a Next.js 15 App Router todo application by adding both client-side (posthog-js) and server-side (posthog-node) SDKs. It initializes PostHog via instrumentation-client.ts, configures a reverse proxy through Next.js rewrites, tracks CRUD operations on both client and server, and captures exceptions in catch blocks. The app has no authentication system.

Files changed Lines added Lines removed
9 +141 -0

Confidence score: 4/5 👍

  • No .env.example file: The .env.local is gitignored (correctly), but there is no .env.example or equivalent committed file documenting the required environment variables (NEXT_PUBLIC_POSTHOG_PROJECT_TOKEN, NEXT_PUBLIC_POSTHOG_HOST). A new developer cloning this repo wouldn't know what env vars are needed. [MEDIUM]
  • Duplicate events on client and server: todo_created, todo_updated/todo_completed, and todo_deleted are captured on both client and server for the same user action. While not incorrect, this leads to double-counting in funnels and trends unless the user carefully distinguishes them. The events have the same names, which will cause confusion. [MEDIUM]
  • No identify() call: While the app has no authentication, the absence of identify() is noted. This is acceptable given the app's architecture (no user accounts), so marked N/A. [LOW]

File changes

Filename Score Description
instrumentation-client.ts 5/5 Correct Next.js 15.3+ pattern for client-side PostHog initialization with env vars, reverse proxy host, exception capture, and defaults
lib/posthog-server.ts 4/5 Server-side singleton with posthog-node, correct flushAt: 1 and flushInterval: 0 for serverless. Uses NEXT_PUBLIC_POSTHOG_HOST for the server host which works but is slightly unusual naming for a server-side variable
next.config.ts 5/5 Proper reverse proxy rewrites for /ingest → PostHog with assets route and skipTrailingSlashRedirect
components/todos/todo-list.tsx 4/5 Client-side event captures in event handlers (not useEffect), exception tracking in catch blocks. Passes PostHog identity headers to API routes for server-side correlation
app/api/todos/route.ts 3/5 Server-side todo_created capture with enriched properties. Duplicates client-side event name
app/api/todos/[id]/route.ts 3/5 Server-side todo_updated and todo_deleted captures. Missing await posthog.shutdown() after captures
package.json 5/5 Both posthog-js and posthog-node added correctly
.gitignore 5/5 .env.local added to gitignore to prevent secret leakage
posthog-setup-report.md N/A Documentation file, not evaluated

App sanity check ⚠️

Criteria Result Description
App builds and runs Yes No syntax errors, valid TypeScript, correct imports
Preserves existing env vars & configs Yes Only PostHog additions to existing files, no existing code removed
No syntax or type errors Yes All TypeScript is valid, imports resolve correctly
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 file: Environment variables NEXT_PUBLIC_POSTHOG_PROJECT_TOKEN and NEXT_PUBLIC_POSTHOG_HOST are not documented in any committed file. While .env.local exists locally, it's gitignored. New developers won't know what variables to set. [MEDIUM]
  • Missing await posthog.shutdown(): The server-side API routes create/use the PostHog client but never call await posthog.shutdown(). The Next.js docs specifically recommend calling shutdown in short-lived serverless functions to ensure events are flushed. Since the client is a singleton, events may eventually flush, but there's no guarantee in serverless environments. [LOW]

Other completed criteria

  • Build configuration is valid — package.json has correct dependency entries
  • Code follows existing codebase patterns — naming, structure, and indentation match surrounding code
  • No unnecessary modifications — all changes are PostHog-related

PostHog implementation ✅

Criteria Result Description
PostHog SDKs installed Yes posthog-js@^1.369.0 and posthog-node@^5.29.2 in package.json
PostHog client initialized Yes Client via instrumentation-client.ts (correct Next.js 15.3+ pattern), server via lib/posthog-server.ts singleton
capture() Yes Multiple meaningful captures: todo_created, todo_completed, todo_reopened, todo_deleted, todo_updated on both client and server
identify() N/A App has no authentication — no user accounts, login, or session management
Error tracking Yes capture_exceptions: true in init config for automatic exception capture, plus manual posthog.captureException(error) in catch blocks
Reverse proxy Yes Next.js rewrites in next.config.ts routing /ingest/* → https://us.i.posthog.com/* and /ingest/static/* → https://us-assets.i.posthog.com/static/*

Issues

  • Duplicate client/server events with same names: todo_created, todo_deleted are captured on both client and server with the same event name. This will cause double-counting in PostHog dashboards. Either remove server-side duplicates or use distinct names (e.g., server_todo_created). [MEDIUM]

Other completed criteria

  • API key loaded from environment variable NEXT_PUBLIC_POSTHOG_PROJECT_TOKEN — not hardcoded
  • API host correctly configured — client uses /ingest (reverse proxy), server uses env var NEXT_PUBLIC_POSTHOG_HOST
  • Server-side client uses flushAt: 1 and flushInterval: 0 for serverless compatibility
  • PostHog identity headers (x-posthog-distinct-id, x-posthog-session-id) passed from client to server for session correlation

PostHog insights and events ✅

Filename PostHog events Description
components/todos/todo-list.tsx todo_created, todo_completed, todo_reopened, todo_deleted, captureException Client-side tracking of all CRUD operations with properties (todo_id, has_description), plus exception capture in all catch blocks
app/api/todos/route.ts todo_created Server-side capture on POST with todo_id, has_description, ``
app/api/todos/[id]/route.ts todo_updated, todo_deleted Server-side capture on PATCH/DELETE with todo_id, completed status, ``

Issues

  • Duplicate event names across client and server: The same action triggers events with the same name on both client and server, which inflates counts in dashboards. [MEDIUM]

Other completed criteria

  • Events represent real user actions — creating, completing, reopening, and deleting todos map directly to product usage
  • Events enable product insights — can build todo creation trends, completion funnels (created → completed), deletion rates
  • Events include relevant properties — todo_id, has_description, completed status provide meaningful context
  • No PII in event properties — only IDs and boolean flags
  • Event names are descriptive and consistent — snake_case convention, action-based 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