Moving a TanStack Start app from Cloudflare to Vercel mostly means swapping the deployment layer. On Vercel, TanStack Start runs on Vercel Functions with Fluid compute enabled by default, so your app automatically scales up and down with traffic.
This guide walks you through the full migration. You'll swap @cloudflare/vite-plugin for the Nitro Vite plugin, delete your Wrangler configuration, and move Cloudflare storage to its Vercel equivalents (e.g., R2 to Vercel Blob). It also covers recreating environment variables, mapping Cron Triggers and Queues to Vercel Cron Jobs and Vercel Queues, and deploying with Git or the vercel CLI.
Before you begin, make sure you have:
- A working TanStack Start app
- A Vercel account
- Vercel CLI installed (
npm i -g vercel) - Node.js 20 or later
If you use an AI coding agent like Claude Code or Cursor, you can have it handle most of the migration for you and provide expert guidance. Install the Vercel Plugin to provide your agent with Vercel-specific context, then add the companion skill for this guide.
Install the Vercel Plugin:
Add the TanStack Start migration skill:
With both in place, ask your agent to migrate your TanStack Start app from Cloudflare to Vercel. Your agent will follow the migration steps and apply Vercel's recommended patterns for Vercel Functions, storage solutions, environment variables, and more.
On Cloudflare, TanStack Start runs as a Worker, and your server code interacts with Cloudflare Developer Platform services via bindings. On Vercel, the same application runs on Vercel Functions using the Nitro Vite plugin, retrieves configuration from environment variables, and connects to storage providers in the Vercel Marketplace via native integrations.
The table below maps each Cloudflare component to its Vercel counterpart.
| Cloudflare | Vercel |
|---|---|
| Workers runtime | Vercel Functions (Fluid compute) |
@cloudflare/vite-plugin | Nitro Vite plugin (nitro/vite) |
wrangler.jsonc or wrangler.toml | vercel.json (optional) and nitro.config.ts |
wrangler deploy | Git push or the vercel CLI |
env from cloudflare:workers | process.env |
| R2 (object storage) | Vercel Blob |
| Workers KV | Redis from the Vercel Marketplace, or Edge Config for read-heavy config |
| D1 (SQL) | Postgres from the Vercel Marketplace |
| Cron Triggers | Vercel Cron Jobs |
| Queues | Vercel Queues |
| Workflows | Vercel Workflows |
| Durable Objects | No direct equivalent. Use a database or Redis for shared state |
Workers AI (env.AI) | Vercel AI Gateway with AI SDK |
Vercel deploys TanStack Start using Nitro, which compiles your app into Vercel Functions. Install Nitro in your project root:
Then update vite.config.ts to replace the Cloudflare plugin with the Nitro plugin:
Remove the cloudflare() plugin and its viteEnvironment option. Nitro detects Vercel during a Vercel build and applies the vercel preset without any extra configuration.
Delete the Cloudflare-specific files and dependencies that no longer apply on Vercel:
- Remove
wrangler.jsonc(orwrangler.toml). - Uninstall the Cloudflare packages:
npm uninstall @cloudflare/vite-plugin wrangler. - Remove any
compatibility_dateorcompatibility_flagssettings. Vercel Functions run on Node.js, so thenodejs_compatflag has no equivalent.
If you used a custom server entrypoint (src/server.ts) to export Durable Objects or handle Queue and Cron events, see step six and the mapping table for the Vercel approach to those features.
Replace the Wrangler deploy script in package.json with the standard Vite commands. Vercel runs the build for you, so you no longer need a deploy script that calls wrangler:
You can also remove the cf-typegen script that generates types from your Wrangler configuration. Vercel auto-detects TanStack Start during import and sets the build command and output directory, so the remaining scripts mainly support local development.
This is the core code change. On Cloudflare you import env from cloudflare:workers and call bindings such as env.MY_BUCKET. On Vercel, you read connection details from process.env and talk to each store through its SDK. Remove every import { env } from "cloudflare:workers" statement and replace the binding calls.
For example, an R2 upload on Cloudflare looks like this:
On Vercel, the same upload uses Vercel Blob:
Install the Blob SDK with npm i @vercel/blob, then create a Blob store from the Storage page in your Vercel dashboard. For authentication, connect the store to your project from its Projects tab. Vercel then adds a BLOB_STORE_ID and a short-lived VERCEL_OIDC_TOKEN that it rotates automatically. The SDK pairs the two automatically, so the put() call above needs no token in your code. This OIDC approach is recommended over the long-lived BLOB_READ_WRITE_TOKEN, which you'd use only for code that runs outside Vercel.
Map your other Cloudflare storage the same way:
- Workers KV becomes a Redis integration (e.g., Upstash Redis) from the Vercel Marketplace for caching and session data, or Edge Config for small, read-heavy configuration.
- D1 becomes a Postgres database (e.g, Neon) from the Vercel Marketplace.
- Durable Objects have no direct equivalent; add shared state in a database or Redis.
When you provision storage from the Marketplace, Vercel adds the connection string and credentials as environment variables, which your code reads from process.env.
Recreate your Cloudflare secrets and variables as Vercel environment variables. Cloudflare stores these in wrangler.jsonc vars and Wrangler secrets, while Vercel stores them per environment (production, preview, and development) in project settings.
Add each variable to your project’s environment variables, or from the CLI:
To run your app locally with the same values, link the project and pull the variables into a local .env file:
vercel env pull writes a .env file with your development environment variables. Vercel supports up to 64 KB of environment variables per deployment across all variables combined.
If your Worker used Cron Triggers or Queues, Nitro maps both to Vercel features at build time. Skip this step if your app doesn't use them.
For scheduled work, define Nitro scheduled tasks in nitro.config.ts. Nitro converts them into Vercel Cron Jobs during the build, so you don't write any vercel.json cron configuration by hand:
To secure the generated cron endpoint, set a CRON_SECRET environment variable in your Vercel project. When CRON_SECRET is set, Nitro validates the Authorization header on every cron invocation.
For message processing, replace Cloudflare Queues with Vercel Queues. Define your topics under the vercel.queues key in nitro.config.ts:
Handle incoming messages with the vercel:queue hook in a Nitro plugin under server/plugins/:
To produce messages, install @vercel/queue (npm i @vercel/queue) and call its send() from any server function, for example const { messageId } = await send('orders', order).
For long-running, multi-step processes that Cloudflare Workflows handled, consider Vercel Workflows, which run durable steps on Vercel Functions and Vercel Queues.
You have two deployment options. Both build your app with Nitro's Vercel preset and run it on Vercel Functions.
Deploy with Git (recommended):
- Push your project to GitHub, GitLab, or Bitbucket.
- In the Vercel dashboard, select Add New > Project, then import your repository.
- Vercel detects TanStack Start and sets the build command and output directory. Confirm the framework preset, add your environment variables, and select Deploy.
After the first import, every push to your main branch creates a production deployment, and every pull request gets its own preview URL.
Deploy with the CLI:
Run vercel from your project root to create a preview deployment, or vercel --prod to deploy to production.
Once deployed, your app runs on Vercel Functions with Fluid compute, with preview deployments, observability, and the Vercel Firewall available.
Server code still imports the Cloudflare bindings module. Search your project for cloudflare:workers and replace each binding call with its Vercel equivalent. The cloudflare:workers import only resolves inside the Workers runtime.
Confirm each variable exists in the correct environment under your project’s environment variables, then redeploy. Variables added to production aren't available in preview or development unless you add them there too. For local runs, re-run vercel env pull after changing variables.
Nitro's /api directory convention isn't compatible with Vercel. Move standalone API handlers to routes/api/ so Nitro generates the correct Vercel Functions.
- Tune function resources per route. If specific routes need more memory or a longer timeout than the default, set
vercel.functionRulesinnitro.config.tsto overridemaxDuration,memory, orregionsfor matching route patterns. - Place functions near your data. Set
regionsinfunctionRulesor your project settings close to your marketplace database to reduce latency.