Migrate experiment app from Next.js to TanStack Start#369
Open
kcarnold wants to merge 1 commit into
Open
Conversation
Replace Next.js 15 (App Router) with TanStack Start powered by Vite 7 and TanStack Router. Key changes: - Routes: layout.tsx → __root.tsx, page.tsx → index.tsx, study/page.tsx → study.tsx - API routes: Use createFileRoute with server.handlers instead of Next.js route handlers - Config: next.config.ts + postcss.config.mjs → vite.config.ts with @tailwindcss/vite - Imports: Replace next/navigation useSearchParams with custom hook using TanStack Router - Remove all 'use client' directives (not needed without RSC) - Update env vars from NEXT_PUBLIC_ prefix to VITE_ prefix - Update Dockerfile, ESLint config, tsconfig, and .gitignore TypeScript passes, all 20 tests pass, build succeeds. https://claude.ai/code/session_011KRUvKDJnfX84QEViftUZ9
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Migrates the experiment application from Next.js 15 (App Router) to TanStack Start, a full-stack framework built on Vite and TanStack Router. This change modernizes the build tooling and routing infrastructure while maintaining all existing functionality.
Key Changes
Framework Migration
route.tshandlers to TanStack Router file routesnext.config.ts,layout.tsx)API Routes
app/api/chat/route.ts→app/api/chat.ts(TanStack Router file route)app/api/writing-support/route.ts→app/api/writing-support.ts(TanStack Router file route)app/api/log/route.ts→app/api/log.ts(TanStack Router file route)createFileRouteAPI withserver.handlers.POSTPages & Routing
app/page.tsx→app/index.tsx(TanStack Router convention)app/study.tsxconverted to TanStack Router file route withcreateFileRoute('/study')app/__root.tsxas root layout using TanStack Router'screateRootRoute'use client'directives (no longer needed with TanStack Start)useSearchParams()from Next.js with customuseSearchParams()hook that reads from TanStack Router stateBuild Configuration
next.config.tswithvite.config.tstsconfig.jsonto remove Next.js-specific plugins and settingspostcss.config.mjs(Tailwind CSS now configured via Vite plugin)package.jsonscripts:next dev→vite dev,next build→vite build"type": "module"topackage.jsonfor ES modulesDependencies
next,eslint-config-next,@tailwindcss/postcss,babel-plugin-react-compiler@tanstack/react-router,@tanstack/react-start,@tailwindcss/vite,vite,@vitejs/plugin-reacttypescript-eslintandeslint-plugin-react-hooksinstead of Next.js presetsDocker & Deployment
.outputinstead of.next/standalone)nextjstoappuserNEXT_PUBLIC_GIT_COMMITtoVITE_GIT_COMMITComponent Updates
'use client'directives from all components (TanStack Start handles this automatically)useSearchParams()hook instead of Next.js versionNotable Implementation Details
lib/useSearchParams.tsas a compatibility layer to provide URLSearchParams interface using TanStack Router's staterouter.tsxto instantiate the TanStack Router with the generated route treecreateFileRoutewith server-side handlershttps://claude.ai/code/session_011KRUvKDJnfX84QEViftUZ9