---
title: Migrate to Vercel
description: Choose where each workload runs on Vercel, migrate your apps, workers, file storage, sandboxes, and AI model calls, then test the deployment and...
url: "https://vercel.com/docs/migrate"
last_updated: 2018-10-20
related:
  - /docs/incremental-migration
  - /docs/cli
  - /docs/frameworks
  - /docs/functions/runtimes/container
  - /docs/daemons
install_vercel_plugin: npx plugins add vercel/vercel-plugin
search_with_vercel_cli: npx vercel@latest docs search "<query>"
search_kb_with_vercel_cli: npx vercel@latest kb search "<query>"
---

# Migrate to Vercel

You can migrate your whole stack to Vercel or one workload at a time. Deploy a framework app from source, or run a Docker container on the Container Runtime. Move background workers to Vercel Daemons, files to Vercel Blob, code-execution sandboxes to Vercel Sandbox, and AI model calls to AI Gateway.

Vercel Blob, Vercel Sandbox, and AI Gateway work from a backend on any host, so any of the three can move before your app does. Each workload has step-by-step guides for providers such as AWS, Cloudflare, Fly.io, Railway, and Render. To move a live site's traffic in stages, see [incremental migration](/docs/incremental-migration).

## Prerequisites

Before you begin, make sure you have a [Vercel account](https://vercel.com/signup) and the latest [Vercel CLI](/docs/cli).

## Choose where each workload runs

Match each part of your stack to the Vercel product that runs it:

| What you run today | Where it runs on Vercel | It fits when |
| --- | --- | --- |
| An app in a supported framework | [Built from source](/docs/frameworks) | Vercel detects the framework, such as Next.js, SvelteKit, or Nuxt |
| A containerized web app or API | [Container Runtime](/docs/functions/runtimes/container) | It serves HTTP requests |
| A long-running worker | [Vercel Daemons](/docs/daemons) | It pulls its own work from a queue, workflow engine, or external API and keeps running |
| A scheduled task | [Schedules](/docs/schedules) | It runs on a schedule and exits |
| An object storage bucket | [Vercel Blob](/docs/vercel-blob) | It holds images, videos, documents, and other files |
| A code-execution sandbox | [Vercel Sandbox](/docs/sandbox) | It runs untrusted or agent-generated code |
| Model provider SDKs or another AI gateway | [AI Gateway](/docs/ai-gateway) | Your app calls AI models |
| A FastAPI, Flask, or Django API | [Python runtime](/docs/functions/runtimes/python) | Vercel detects the Python framework |

## Create and link a Vercel project

Log in and link your directory to a project:

```bash filename="Terminal"
vercel login
vercel link
```

Your environment variables don't move with your code. Add each variable that the workload you're migrating reads. Replace `your_variable_name` with the name your code uses, such as `DATABASE_URL` for a database connection string. The CLI prompts you for the value and the environments. Run the command once for each environment, and give Preview test credentials so that preview deployments don't use production data:

```bash filename="Terminal"
vercel env add your_variable_name
```

Don't pipe a secret into the command with `echo`, because your shell saves the secret to its history.

The first deployment of a new project goes to production, even without `--prod`. Traffic from your live site doesn't reach that deployment until you [cut over](#cut-over-to-vercel). Later runs of `vercel deploy` create preview deployments.

## Migrate each workload

### Deploy a framework app from source

Apps built with a [supported framework](/docs/frameworks) such as Next.js, SvelteKit, or Nuxt deploy from source with no `Dockerfile`. Vercel detects the framework and configures the build. Deploy from the project root, then open the URL that the command prints to confirm that the app works:

```bash filename="Terminal"
vercel deploy
```

### Run a Docker app on the Container Runtime

The Container Runtime requires [fluid compute](/docs/fluid-compute) with [Active CPU pricing](/docs/functions/usage-and-pricing#active-cpu) enabled. Vercel builds the `Dockerfile` or `Containerfile` at your project root and sends traffic to port `80`.

1. If Vercel detects a framework such as Next.js in the same project, it builds that framework and skips the `Dockerfile`. Set the project's framework to Container before you deploy:

   ```bash filename="Terminal"
   vercel project update --framework container --yes
   ```

2. If your server listens on a port other than `80`, add a `PORT` environment variable and leave the image unchanged. When the CLI prompts you, enter your port, such as `8080`, and select the environments:

   ```bash filename="Terminal"
   vercel env add PORT
   ```

3. Deploy, then open the URL that the command prints and confirm that your container's server responds:

   ```bash filename="Terminal"
   vercel deploy
   ```

Plan for two differences from a container host, which also apply to Vercel Daemons. Anything your code writes to an instance's disk is gone when that instance stops. Put files that lived on a volume in [Vercel Blob](/docs/vercel-blob), and replace a self-hosted database with a managed one from the [Vercel Marketplace](/docs/marketplace-storage). Vercel also can't reach your current provider's internal hostnames. Give each service you keep an address that Vercel can connect to. Use [Static IPs](/docs/networking/static-ips) on Pro and Enterprise for an IP allowlist, or [Secure Compute](/docs/networking/secure-compute) on Enterprise for a private connection.

Follow the step-by-step guide for [AWS](/kb/guide/migrate-containers-from-aws-to-vercel), [Fly.io](/kb/guide/migrate-fly-io-to-vercel), [Google Cloud Run](/kb/guide/migrate-cloud-run-to-vercel), [Railway](/kb/guide/migrate-railway-to-vercel), or [Render](/kb/guide/migrate-render-to-vercel). The AWS guide also covers self-hosted Next.js. Before you cut over, review [what changes when a Docker app moves to Vercel](/docs/functions/runtimes/container/migrate), including when idle instances scale down.

### Run background workers on Vercel Daemons

Each daemon pulls its own work from a queue, workflow engine, or external API, and accepts no inbound traffic. Daemons run only in production, so a preview deployment can't test a worker.

1. Add a `Dockerfile` for the worker and an entry under `daemons` in `vercel.json`. This example defines one daemon named `worker` in the `iad1` region. It sets `instances` to `0` so that the first production deployment starts no workers:

   ```json filename="vercel.json"
   {
     "$schema": "https://openapi.vercel.sh/vercel.json",
     "daemons": {
       "worker": {
         "root": "worker/",
         "entrypoint": "Dockerfile",
         "instances": { "iad1": 0 }
       }
     }
   }
   ```

2. Test the worker image locally with Docker. Point `.env.local` at a test source of work first:

   ```bash filename="Terminal"
   docker build -t worker worker/
   docker run --env-file .env.local worker
   ```

3. Deploy to production. Production deployments also update your production app, so deploy only when the app's code is ready to go live:

   ```bash filename="Terminal"
   vercel deploy --prod
   ```

4. Raise the count with a scaling override while your current workers keep taking work from the same source. This example starts two instances in `iad1`. Running instances use Provisioned Memory by the hour, even while they wait for work:

   ```bash filename="Terminal"
   vercel daemons scale worker iad1=2
   ```

5. Confirm that the instances are running:

   ```bash filename="Terminal"
   vercel daemons instances list worker
   ```

6. Once the daemon handles the load, stop your old workers. Then set the final count in `vercel.json` and deploy to production again:

   ```bash filename="Terminal"
   vercel deploy --prod
   ```

7. Clear the override only after that deployment is live. Clearing it returns the daemon to the count in the current production deployment, so clearing it earlier would scale the daemon back to `0`:

   ```bash filename="Terminal"
   vercel daemons scale worker --reset
   ```

Follow the guide that moves a Sidekiq worker from [Fly.io](/kb/guide/migrate-fly-io-workers-to-vercel-daemons), a BullMQ worker from [Railway](/kb/guide/migrate-railway-workers-to-vercel-daemons), or a Celery worker from [Render](/kb/guide/migrate-render-workers-to-vercel-daemons). For commands, shutdown signals, and instance counts, review [how daemons differ from other worker hosts](/docs/daemons/migrate).

### Move file storage to Vercel Blob

Create a Blob store from your linked project. You can't change a store's access or region after you create it. This example creates a private store named `Images` in the `iad1` region:

```bash filename="Terminal"
vercel blob create-store Images --access private --region iad1 --yes
```

The `--yes` flag connects the store to your project in every environment, so writes from preview deployments and local tests land in the same store as production. To keep test writes separate, pass `--environment` to connect fewer environments, and create a second store for testing.

The command also adds `BLOB_READ_WRITE_TOKEN` to the project. If your code runs outside Vercel, set that token in your own host's environment. For local tests, run `vercel env pull` to write the store's credentials to `.env.local`.

Install the SDK:

**pnpm**

```bash
pnpm i @vercel/blob
```

**yarn**

```bash
yarn add @vercel/blob
```

**npm**

```bash
npm i @vercel/blob
```

**bun**

```bash
bun add @vercel/blob
```

Then replace each storage call with the SDK. `put()` throws if a blob already exists at the pathname. If your current provider replaces a file on every write, pass `allowOverwrite`. This excerpt belongs in your upload handler, where `file` is the request body and the pathname is an example:

```ts filename="upload.ts"
import { put } from '@vercel/blob';

const blob = await put('avatars/user-123.png', file, {
  access: 'private',
  allowOverwrite: true,
});
```

After your handler runs, confirm the upload from the terminal:

```bash filename="Terminal"
vercel blob list
```

Your existing files need a copy, and the file URLs you've stored need an update. If your current store still receives writes, follow the staged cutover in the guide for [Cloudflare R2](/kb/guide/migrate-from-cloudflare-r2-to-vercel-blob), [Netlify Blobs](/kb/guide/migrate-from-netlify-blobs-to-vercel-blob), [Supabase Storage](/kb/guide/migrate-from-supabase-storage-to-vercel-blob), or [Upstash Blob](/kb/guide/migrate-from-upstash-blob-to-vercel-blob). Private blobs aren't readable by URL alone. Check that the user may read the file, then [stream it from a Function](/docs/vercel-blob/private-storage#delivering-private-blobs) or issue a [signed URL](/docs/vercel-blob/vercel-signed-urls). Before you cut over, review [caching and upload size limits on Vercel Blob](/docs/vercel-blob/migrate).

### Move sandboxes to Vercel Sandbox

Install the SDK:

**pnpm**

```bash
pnpm i @vercel/sandbox
```

**yarn**

```bash
yarn add @vercel/sandbox
```

**npm**

```bash
npm i @vercel/sandbox
```

**bun**

```bash
bun add @vercel/sandbox
```

Link a project and pull credentials. `vercel env pull` writes a token to `.env.local`, which your local process must load before it calls the SDK:

```bash filename="Terminal"
vercel link
vercel env pull
```

Vercel manages the token when your code runs on Vercel. On another host, set a team ID, a project ID, and an [access token](/docs/sandbox/concepts/authentication#access-tokens) in that host's environment and pass them to `Sandbox.create()`.

Two defaults may differ from your current provider. Sessions stop after 5 minutes, and outbound traffic is open. This excerpt replaces the call that creates a sandbox in your code. Both options are optional, and the values are examples that allow 30 minutes and block all outbound traffic:

```ts filename="index.ts"
import { Sandbox } from '@vercel/sandbox';

const sandbox = await Sandbox.create({
  timeout: 30 * 60 * 1000, // 30 minutes
  networkPolicy: 'deny-all',
});
```

Sandboxes are persistent by default. Vercel saves the filesystem when a session stops, and each saved snapshot uses Snapshot Storage, which Vercel bills separately from compute. Pass `persistent: false` for one-off work. Processes don't survive a stop, so restart them after each resume. For a complete script that you can run, follow the [Vercel Sandbox quickstart](/docs/sandbox/quickstart).

Follow the guide for [Cloudflare Sandbox](/kb/guide/migrate-from-cloudflare-sandbox-to-vercel-sandbox), [Daytona](/kb/guide/migrate-from-daytona-to-vercel-sandbox), [E2B](/kb/guide/migrate-from-e2b-to-vercel-sandbox), [Fly.io Sprites](/kb/guide/migrate-from-fly-io-sprites-to-vercel-sandbox), [Freestyle VMs](/kb/guide/migrate-from-freestyle-vms-to-vercel-sandbox), [Modal Sandboxes](/kb/guide/migrate-from-modal-sandboxes-to-vercel-sandbox), [Railway Sandboxes](/kb/guide/migrate-from-railway-sandboxes-to-vercel-sandbox), or [Upstash Box](/kb/guide/migrate-from-upstash-box-to-vercel-sandbox). Before you cut over, review [persistence, images, and memory on Vercel Sandbox](/docs/sandbox/migrate).

### Route model calls through AI Gateway

If your calls already pass through [Cloudflare AI Gateway](/kb/guide/cloudflare-aig-to-vercel-aig), [Netlify AI Gateway](/kb/guide/netlify-aig-to-vercel-aig), or [Neon AI Gateway](/kb/guide/neon-aig-to-vercel-aig), follow that gateway's guide. Each guide also replaces gateway settings such as response caching and rate limits.

For calls that go straight to a model provider, give your coding agent the [AI Gateway migration prompt](/docs/ai-gateway/getting-started/migrate-to-ai-gateway). The agent lists your model calls and proposes a plan before it edits a file, so review the plan first. Embeddings stay on their current provider unless you ask, and the agent reports video and realtime calls in Python without converting them.

Each migrated call names its model as a `creator/model` string, as in this example. Keep a model that your team can access:

```ts filename="index.mts"
import { generateText } from 'ai';

const { text } = await generateText({
  model: 'openai/gpt-6-astra',
  prompt: 'Summarize the release notes.',
});
```

The code reads `AI_GATEWAY_API_KEY` from the environment of the host that runs it. Deployments on Vercel can use an [OpenID Connect (OIDC) token](/docs/ai-gateway/authentication-and-byok/oidc) instead of a key. To confirm the migration, send a real request and check that it appears in AI Gateway in the dashboard.

### Deploy a Python API on the Python runtime

Vercel runs FastAPI, Flask, and Django APIs as Vercel Functions from source. It detects the framework from `requirements.txt`, `pyproject.toml`, or `Pipfile` and loads your application from an entrypoint such as `app.py`. This FastAPI example defines the top-level `app` that Vercel loads:

```python filename="app.py"
from fastapi import FastAPI

app = FastAPI()

@app.get("/")
def home():
    return {"message": "Hello from Python on Vercel"}
```

Deploy from the project root, then open the URL that the command prints:

```bash filename="Terminal"
vercel deploy
```

Follow the guide for [Heroku](/kb/guide/migrate-a-python-api-from-heroku-to-vercel), [Railway](/kb/guide/migrate-a-python-api-from-railway-to-vercel), or [Render](/kb/guide/migrate-a-python-api-from-render-to-vercel) to move the rest of your platform's setup.

## Cut over to Vercel

Follow these steps only if you're moving HTTP traffic for a website or API.

1. To move one section of the site at a time, rewrite the paths you haven't migrated to your current host. Use your framework's rewrites if it has them, or `vercel.json` if it doesn't. This example sends `/blog` to a host named `legacy.example.com`:

   ```json filename="vercel.json"
   {
     "$schema": "https://openapi.vercel.sh/vercel.json",
     "rewrites": [
       {
         "source": "/blog/:path*",
         "destination": "https://legacy.example.com/blog/:path*"
       }
     ]
   }
   ```

2. Create a production build that Vercel doesn't assign to your domains yet:

   ```bash filename="Terminal"
   vercel deploy --prod --skip-domain
   ```

3. Open the URL that the command prints. Test a migrated path and a rewritten path.

4. Promote the build to production. Replace `your-deployment-url` with the URL from step 2:

   ```bash filename="Terminal"
   vercel promote your-deployment-url
   ```

If your site has a custom domain, add it to the project and check which DNS records it needs. Replace `example.com` and `my-project` with your own values:

```bash filename="Terminal"
vercel domains add example.com my-project
vercel domains verify example.com --project my-project
```

If your site can't tolerate a gap in HTTPS, [pre-generate its SSL certificate](/docs/domains/pre-generating-ssl-certs) before you change DNS. Then update the records at your DNS provider. Traffic moves to Vercel as the change takes effect. Run `vercel domains verify` again to confirm the DNS configuration, then check that Vercel issued the certificate and load your site on its own domain:

```bash filename="Terminal"
vercel certs list
```

Once production traffic reaches Vercel, check the last hour of runtime logs for errors:

```bash filename="Terminal"
vercel logs runtime --environment production --query 'level:error' --since 1h
```

To keep your domain on the old server and proxy to Vercel instead, see [incremental migration strategies](/docs/incremental-migration).

### Recover from a failed release

Keep your previous provider running after the cutover. If your first release on Vercel fails, send your traffic back to that provider. No earlier deployment on Vercel has carried your live traffic.

After later releases, [Instant Rollback](/docs/instant-rollback) returns production to a deployment that served production before. Deployments that never served production, such as most preview deployments, aren't eligible. On Hobby, you can roll back to the previous deployment only. Vercel also rolls out the daemons that the earlier deployment configures. Replace `your-deployment-url` with the earlier deployment's URL:

```bash filename="Terminal"
vercel rollback your-deployment-url
```

After a rollback, Vercel stops assigning new production deployments to your domains. Promote a deployment with `vercel promote` to turn that back on.

## Find more migration guides

Search the guides from the terminal without logging in. This example finds the Railway guides and prints one as Markdown:

```bash filename="Terminal"
vercel kb search "migrate from Railway"
vercel kb inspect migrate-railway-to-vercel
```

For other providers, browse the [migration guides in the Knowledge Base](/kb/migrations).

## Next steps

- [Work through the production checklist](/docs/production-checklist) before you cut over.
- [Compare background worker options](/docs/background-workers) if a daemon isn't the right fit.
- [Manage environment variables](/docs/environment-variables) for each environment.

## Search the docs from your terminal

Search the Vercel docs and read pages as Markdown with the Vercel CLI. No login required.

```bash
# Find docs pages by keyword
npx vercel@latest docs search "environment variables"
npx vercel@latest docs search "function timeout"

# Print a docs page as Markdown, by path or URL
npx vercel@latest docs inspect <page>
```

## Search guides from your terminal

Search the Knowledge Base and read guides as Markdown with the Vercel CLI. No login required.

```bash
# Find guides by keyword
npx vercel@latest kb search "rewrites and redirects"
npx vercel@latest kb search "AI SDK streaming"

# Show the latest guides
npx vercel@latest kb

# Print a guide as Markdown, by slug or URL
npx vercel@latest kb inspect <guide>
```

---

[View full sitemap](/docs/sitemap)


If you encounter incorrect information, can’t find what you need, need a capability Vercel doesn’t currently offer, or have any other feedback to report, please do it by following the instructions at https://vercel.com/feedback.md.
