Skip to content

Remove Lingering Next.js References#276

Open
zacjones93 wants to merge 1 commit intomainfrom
claude/remove-nextjs-references-eRL3x
Open

Remove Lingering Next.js References#276
zacjones93 wants to merge 1 commit intomainfrom
claude/remove-nextjs-references-eRL3x

Conversation

@zacjones93
Copy link
Copy Markdown
Contributor

@zacjones93 zacjones93 commented Feb 14, 2026

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

  • Replaced Next.js App Router with TanStack Start file-based routing (routes/ directory)
  • Updated from Next.js build system to Vite/Vinxi via TanStack Start
  • Changed deployment from OpenNext to native Cloudflare Workers via Alchemy IaC
  • Updated dev server port from 3000 to 5173

API & Server Functions

  • Migrated from Next.js Server Actions (ZSA) to TanStack Start createServerFn pattern
  • Moved server functions from src/actions/ to src/server-fns/
  • Removed Next.js-specific patterns like revalidatePath comments (TanStack handles cache invalidation differently)

Authentication & Sessions

  • Replaced Lucia Auth with custom authentication using Cloudflare KV sessions
  • Updated session handling to use getSessionFromCookie() in server functions instead of server components

Environment Variables

  • Changed Next.js public variable prefixes from NEXT_PUBLIC_ to VITE_ (Vite convention)
  • Updated OAuth redirect URIs to use port 5173
  • Updated PostHog configuration variable naming

Project Structure

  • Reorganized from src/app/ (Next.js App Router) to apps/wodsmith-start/src/routes/ (TanStack Router)
  • Consolidated database functions in src/db/
  • Removed Next.js-specific files: open-next.config.ts, nextjs.json TypeScript config
  • Removed server-only package usage and related mocks/stubs (TanStack handles server-only code differently)

Documentation & Configuration

  • Updated README with TanStack Start tech stack details
  • Updated project structure documentation to reflect new file organization
  • Removed Next.js-specific development guidelines (Server Components, use client directives)
  • Updated NOTES.md to reflect TanStack Start patterns
  • Removed Next.js reviewer reference from Claude skills

Code Cleanup

  • Removed import "server-only" directives from components (no longer needed in TanStack Start)
  • Removed server-only stub file and related Vite alias configuration
  • Cleaned up comments referencing Next.js-specific patterns in server functions

Implementation Details

  • All database operations remain unchanged (Cloudflare D1 + Drizzle ORM)
  • State management continues using Zustand for client state and NUQS for URL state
  • UI components remain unchanged (Shadcn UI, Tailwind CSS)
  • TypeScript configuration simplified by removing Next.js-specific settings

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

    • Routing/build: TanStack Start with Vite/Vinxi; routes in apps/wodsmith-start/src/routes; dev port 5173; remove OpenNext.
    • Server layer: Server Actions → createServerFn; server functions in src/server-fns and used by loaders/components.
    • Auth: Lucia → KV session auth; use getSessionFromCookie in server functions.
    • Cleanup: delete Next configs and “server-only” imports/aliases; update docs; remove Next.js reviewer persona in .claude.
    • Unchanged: D1 + Drizzle ORM, Zustand/NUQS, Shadcn UI/Tailwind.
  • Migration

    • Env: replace NEXT_PUBLIC_* with import.meta.env.VITE_*; set VITE_TURNSTILE_SITE_KEY and VITE_STRIPE_PUBLISHABLE_KEY; use APP_URL (not NEXT_PUBLIC_APP_URL); optionally set POSTHOG_HOST.
    • OAuth/Webhooks: update redirects to http://localhost:5173 and Stripe listen target to :5173.
    • Local dev: pnpm dev and open http://localhost:5173.
    • Deploy: use Alchemy IaC to Cloudflare Workers; remove OpenNext pipeline/config.

Written for commit b21bdb7. Summary will update on new commits.

Summary by CodeRabbit

  • Chores
    • Updated all environment variable naming conventions to align with new configuration standards (Turnstile and Stripe public keys now use VITE_ prefix).
    • Changed local development server port to 5173.
    • Removed legacy framework-specific configuration files and obsolete references throughout the project.
    • Updated comprehensive documentation, setup examples, and project structure references.

- 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
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Feb 14, 2026

Walkthrough

This 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

Cohort / File(s) Summary
Documentation & Guidelines Cleanup
.claude/skills/review/SKILL.md, .claude/skills/review/references/nextjs-reviewer.md, AGENTS.md, NOTES.md, README.md
Removed Next.js references and reviewer guidelines; updated documentation to reflect TanStack Start architecture, custom KV session auth, and Cloudflare Workers deployment via Alchemy IaC. Replaced framework tech stack mentions and adjusted project structure examples.
Environment Variables
.env.example, apps/wodsmith-start/.env.example, apps/wodsmith-start/.dev.vars.example
Renamed environment variables from NEXT_PUBLIC_* to VITE_* prefix for Turnstile and Stripe keys. Updated OAuth and webhook redirect URIs from localhost:3000 to localhost:5173. Updated PostHog variable naming from NEXT_PUBLIC_POSTHOG_HOST to POSTHOG_HOST.
Server-Only Removals
apps/wodsmith-start/src/components/organizer/schedule/heat-schedule-container.tsx, apps/wodsmith-start/src/components/organizer/schedule/venue-manager-container.tsx, apps/wodsmith-start/src/lib/server-only-stub.ts, apps/wodsmith-start/test/__mocks__/server-only.js
Removed server-only import directives from component files and deleted the server-only stub module and mock file used for Next.js compatibility.
Build & Type Configuration
packages/typescript-config/nextjs.json, packages/typescript-config/package.json, apps/wodsmith-start/vite.config.ts, apps/wodsmith-start/vitest.config.ts, open-next.config.ts
Deleted Next.js TypeScript configuration file and removed server-only alias mappings from Vite and Vitest configs. Removed entire Cloudflare/OpenNext configuration export from open-next.config.ts.
Server Function & Analytics Updates
apps/wodsmith-start/src/lib/posthog/client.ts, apps/wodsmith-start/src/server-fns/judge-scheduling-fns.ts, apps/wodsmith-start/src/server-fns/movement-fns.ts, apps/wodsmith-start/src/server-fns/organizer-admin-fns.ts, apps/wodsmith-start/src/server-fns/volunteer-profile-fns.ts
Updated PostHog comment from Next.js-specific to generic SDK settings. Removed revalidation-related comments referencing Next.js patterns. Updated internal documentation and batch limit notes from Next.js context to TanStack/D1 context.
Test Configuration
apps/wodsmith-start/test/server-fns/stripe-connect.test.ts
Updated test environment variable from NEXT_PUBLIC_APP_URL to APP_URL in test setup.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • Tanstack Start #126: Main TanStack Start migration PR that this change applies, removing Next.js-specific configs and converting architecture patterns.
  • Upgrade fix for real #83: Removes the same packages/typescript-config/nextjs.json file and related Next.js configuration dependencies.
  • chore: switch CI to wodsmith-start #141: Modifies the same test suite files (apps/wodsmith-start/test/server-fns/stripe-connect.test.ts) and build configurations.

Poem

🐰 Hops through configs with glee,
Next.js begone, now TanStack's free!
Server-only stubs we delete with care,
Vite and Vinxi dance in the air,
From port 3000 to 5173's embrace,
This migration's won the race! 🏃‍♂️💨

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: removing lingering Next.js references after migration to TanStack Start. It is concise, specific, and directly reflects the primary objective of the PR.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Merge Conflict Detection ✅ Passed ✅ No merge conflicts detected when merging into main

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch claude/remove-nextjs-references-eRL3x

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@theianjones theianjones changed the title Migrate from Next.js to TanStack Start framework Remove Lingering Next.js References Feb 14, 2026
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 autochunk utility. Note that workoutIds on line 144 and line 155 (and line 181) are all unbounded inArray calls 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 autochunk adoption, at least note that the same risk applies to the workoutTags and workoutMovements queries 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`

Comment thread README.md
Comment on lines 211 to 226
```
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
```
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

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.

Suggested change
```
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.

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot Feb 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>
Suggested change
# POSTHOG_HOST=https://us.i.posthog.com
# VITE_POSTHOG_HOST=https://us.i.posthog.com
Fix with Cubic


### PostHog Configuration (Optional)
# NEXT_PUBLIC_POSTHOG_HOST=https://us.i.posthog.com
# POSTHOG_HOST=https://us.i.posthog.com
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot Feb 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>
Suggested change
# POSTHOG_HOST=https://us.i.posthog.com
# VITE_POSTHOG_HOST=https://us.i.posthog.com
Fix with Cubic

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants