Conversation
- Delete next-env.d.ts, .next/, open-next.config.ts, server-only-stub.ts - Delete packages/typescript-config/nextjs.json and .claude nextjs-reviewer - Remove server-only aliases from vite.config.ts and vitest.config.ts - Remove `import "server-only"` from container components - Update README.md, AGENTS.md, NOTES.md to reference TanStack Start - Rename NEXT_PUBLIC_* env vars to VITE_* in .env.example - Remove NEXT_PUBLIC_POSTHOG_HOST from .env.example and .dev.vars.example - Clean up Next.js migration comments in server-fns and lib files - Remove Next.js reviewer persona from review skill https://claude.ai/code/session_01QFUPre3A3WHrf1xCidGzcK
WalkthroughThis PR migrates the codebase from Next.js and OpenNext to TanStack Start, removing Next.js-specific configurations, aliases, and imports while updating environment variables, documentation, and build configurations to reflect the new framework. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@README.md`:
- Around line 211-226: Update the README.md fenced code block that shows the
apps/wodsmith-start/src directory tree by adding a language tag (e.g., use
```text) to the opening fence so markdownlint MD040 is satisfied; locate the
block containing the apps/wodsmith-start/src/ tree and change the opening ``` to
```text.
🧹 Nitpick comments (1)
apps/wodsmith-start/src/server-fns/movement-fns.ts (1)
139-140: Comment accurately documents the D1 constraint.The updated comment correctly references D1's 100-parameter limit and the
autochunkutility. Note thatworkoutIdson line 144 and line 155 (and line 181) are all unboundedinArraycalls that would break if a movement appears in 100+ workouts. The comment currently only covers the first query.Consider applying autochunk proactively or extending the comment
If you'd like to defer
autochunkadoption, at least note that the same risk applies to theworkoutTagsandworkoutMovementsqueries below:- // Note: D1 has a 100 parameter batch limit, but for typical use cases this should be fine - // If this becomes an issue, use autochunk from `@/utils/batch-query` + // Note: D1 has a 100 parameter batch limit for all inArray queries below. + // If workoutIds exceeds ~100, use autochunk from `@/utils/batch-query`
| ``` | ||
| src/ | ||
| ├── app/ # Next.js App Router | ||
| │ ├── (auth)/ # Authentication pages | ||
| │ ├── (main)/ # Main application | ||
| │ │ ├── workouts/ # Workout management | ||
| │ │ ├── programming/ # Programming tracks | ||
| │ │ ├── log/ # Workout logging | ||
| │ │ ├── movements/ # Movement library | ||
| │ │ └── calculator/ # Workout calculators | ||
| │ ├── (admin)/ # Admin dashboard | ||
| │ ├── (settings)/ # User settings | ||
| │ └── api/ # API routes | ||
| ├── components/ # Reusable React components | ||
| ├── db/ # Database configuration | ||
| │ ├── schemas/ # Database schema definitions | ||
| │ └── migrations/ # Auto-generated migrations | ||
| ├── server/ # Server-side business logic | ||
| ├── actions/ # Server actions (ZSA) | ||
| ├── utils/ # Utility functions | ||
| ├── state/ # Client state management (Zustand) | ||
| ├── schemas/ # Zod validation schemas | ||
| └── react-email/ # Email templates | ||
| apps/wodsmith-start/src/ | ||
| ├── routes/ # TanStack Router file-based routes | ||
| │ ├── api/ # API routes (server handlers) | ||
| │ └── compete/ # Competition features | ||
| ├── components/ # React components | ||
| ├── db/ # Database schema and migrations | ||
| │ ├── schema.ts # Main schema exports | ||
| │ └── migrations/ # Auto-generated migrations | ||
| ├── server/ # Server-only business logic | ||
| ├── server-fns/ # Server functions (createServerFn) | ||
| ├── lib/ # Shared utilities | ||
| ├── utils/ # Utility functions | ||
| ├── state/ # Client state management (Zustand) | ||
| └── schemas/ # Zod validation schemas | ||
| ``` |
There was a problem hiding this comment.
Add a language to the fenced code block.
markdownlint MD040 flags the project-structure block for missing a language tag.
💡 Suggested fix
-```
+```text
apps/wodsmith-start/src/
├── routes/ # TanStack Router file-based routes
│ ├── api/ # API routes (server handlers)
│ └── compete/ # Competition features
├── components/ # React components
├── db/ # Database schema and migrations
│ ├── schema.ts # Main schema exports
│ └── migrations/ # Auto-generated migrations
├── server/ # Server-only business logic
├── server-fns/ # Server functions (createServerFn)
├── lib/ # Shared utilities
├── utils/ # Utility functions
├── state/ # Client state management (Zustand)
└── schemas/ # Zod validation schemas📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| ``` | |
| src/ | |
| ├── app/ # Next.js App Router | |
| │ ├── (auth)/ # Authentication pages | |
| │ ├── (main)/ # Main application | |
| │ │ ├── workouts/ # Workout management | |
| │ │ ├── programming/ # Programming tracks | |
| │ │ ├── log/ # Workout logging | |
| │ │ ├── movements/ # Movement library | |
| │ │ └── calculator/ # Workout calculators | |
| │ ├── (admin)/ # Admin dashboard | |
| │ ├── (settings)/ # User settings | |
| │ └── api/ # API routes | |
| ├── components/ # Reusable React components | |
| ├── db/ # Database configuration | |
| │ ├── schemas/ # Database schema definitions | |
| │ └── migrations/ # Auto-generated migrations | |
| ├── server/ # Server-side business logic | |
| ├── actions/ # Server actions (ZSA) | |
| ├── utils/ # Utility functions | |
| ├── state/ # Client state management (Zustand) | |
| ├── schemas/ # Zod validation schemas | |
| └── react-email/ # Email templates | |
| apps/wodsmith-start/src/ | |
| ├── routes/ # TanStack Router file-based routes | |
| │ ├── api/ # API routes (server handlers) | |
| │ └── compete/ # Competition features | |
| ├── components/ # React components | |
| ├── db/ # Database schema and migrations | |
| │ ├── schema.ts # Main schema exports | |
| │ └── migrations/ # Auto-generated migrations | |
| ├── server/ # Server-only business logic | |
| ├── server-fns/ # Server functions (createServerFn) | |
| ├── lib/ # Shared utilities | |
| ├── utils/ # Utility functions | |
| ├── state/ # Client state management (Zustand) | |
| └── schemas/ # Zod validation schemas | |
| ``` |
🧰 Tools
🪛 markdownlint-cli2 (0.20.0)
[warning] 211-211: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
🤖 Prompt for AI Agents
In `@README.md` around lines 211 - 226, Update the README.md fenced code block
that shows the apps/wodsmith-start/src directory tree by adding a language tag
(e.g., use ```text) to the opening fence so markdownlint MD040 is satisfied;
locate the block containing the apps/wodsmith-start/src/ tree and change the
opening ``` to ```text.
There was a problem hiding this comment.
2 issues found across 23 files
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="apps/wodsmith-start/.dev.vars.example">
<violation number="1" location="apps/wodsmith-start/.dev.vars.example:36">
P3: The example env var name no longer matches the code’s `VITE_POSTHOG_HOST` lookup, so configuring PostHog host using this file won’t take effect. Keep the VITE_ prefix or update code to read POSTHOG_HOST.</violation>
</file>
<file name="apps/wodsmith-start/.env.example">
<violation number="1" location="apps/wodsmith-start/.env.example:60">
P2: The .env example drops the `VITE_` prefix, but the code reads `import.meta.env.VITE_POSTHOG_HOST`. This example will mislead developers into setting a variable that never gets picked up by the app. Use `VITE_POSTHOG_HOST` to match the runtime lookup.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
|
|
||
| ### PostHog Configuration (Optional) | ||
| # NEXT_PUBLIC_POSTHOG_HOST=https://us.i.posthog.com | ||
| # POSTHOG_HOST=https://us.i.posthog.com |
There was a problem hiding this comment.
P2: The .env example drops the VITE_ prefix, but the code reads import.meta.env.VITE_POSTHOG_HOST. This example will mislead developers into setting a variable that never gets picked up by the app. Use VITE_POSTHOG_HOST to match the runtime lookup.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At apps/wodsmith-start/.env.example, line 60:
<comment>The .env example drops the `VITE_` prefix, but the code reads `import.meta.env.VITE_POSTHOG_HOST`. This example will mislead developers into setting a variable that never gets picked up by the app. Use `VITE_POSTHOG_HOST` to match the runtime lookup.</comment>
<file context>
@@ -57,7 +57,7 @@ BRAINTRUST_API_KEY=
### PostHog Configuration (Optional)
-# NEXT_PUBLIC_POSTHOG_HOST=https://us.i.posthog.com
+# POSTHOG_HOST=https://us.i.posthog.com
# POSTHOG_LOGS_ENDPOINT=https://us.i.posthog.com/i/v1/logs
</file context>
| # POSTHOG_HOST=https://us.i.posthog.com | |
| # VITE_POSTHOG_HOST=https://us.i.posthog.com |
|
|
||
| ### PostHog Configuration (Optional) | ||
| # NEXT_PUBLIC_POSTHOG_HOST=https://us.i.posthog.com | ||
| # POSTHOG_HOST=https://us.i.posthog.com |
There was a problem hiding this comment.
P3: The example env var name no longer matches the code’s VITE_POSTHOG_HOST lookup, so configuring PostHog host using this file won’t take effect. Keep the VITE_ prefix or update code to read POSTHOG_HOST.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At apps/wodsmith-start/.dev.vars.example, line 36:
<comment>The example env var name no longer matches the code’s `VITE_POSTHOG_HOST` lookup, so configuring PostHog host using this file won’t take effect. Keep the VITE_ prefix or update code to read POSTHOG_HOST.</comment>
<file context>
@@ -33,7 +33,7 @@ VITE_APP_URL=http://localhost:5173
### PostHog Configuration (Optional)
-# NEXT_PUBLIC_POSTHOG_HOST=https://us.i.posthog.com
+# POSTHOG_HOST=https://us.i.posthog.com
# POSTHOG_LOGS_ENDPOINT=https://us.i.posthog.com/i/v1/logs
</file context>
| # POSTHOG_HOST=https://us.i.posthog.com | |
| # VITE_POSTHOG_HOST=https://us.i.posthog.com |
Summary
This PR completes the migration of WODsmith from Next.js 15 to TanStack Start, updating the framework, build tooling, authentication patterns, and API layer throughout the codebase.
Key Changes
Framework & Build System
routes/directory)API & Server Functions
createServerFnpatternsrc/actions/tosrc/server-fns/revalidatePathcomments (TanStack handles cache invalidation differently)Authentication & Sessions
getSessionFromCookie()in server functions instead of server componentsEnvironment Variables
NEXT_PUBLIC_toVITE_(Vite convention)Project Structure
src/app/(Next.js App Router) toapps/wodsmith-start/src/routes/(TanStack Router)src/db/open-next.config.ts,nextjs.jsonTypeScript configserver-onlypackage usage and related mocks/stubs (TanStack handles server-only code differently)Documentation & Configuration
use clientdirectives)Code Cleanup
import "server-only"directives from components (no longer needed in TanStack Start)Implementation Details
https://claude.ai/code/session_01QFUPre3A3WHrf1xCidGzcK
Summary by cubic
Migrates WODsmith from Next.js to TanStack Start, moving routing, server functions, and build tooling to Vite/Vinxi and deploying natively to Cloudflare Workers. Removes all Next.js-specific code and simplifies auth with KV-backed sessions.
Refactors
Migration
Written for commit b21bdb7. Summary will update on new commits.
Summary by CodeRabbit