# Moving from Vercel

> Most projects move without a code change. Copy the environment variables, compare a preview side by side, then switch the domain with no downtime.

- Category: Get started
- URL: https://www.forkrail.com/docs/moving-from-vercel

## What carries over unchanged

- `vercel.json`, `vercel.toml` or `vercel.ts`: redirects, rewrites, headers, `cleanUrls`, `trailingSlash`, `crons`, `functions`, `images`, `regions`, `fluid`, `git.deploymentEnabled` and `ignoreCommand`. See the [vercel.json reference](https://www.forkrail.com/docs/vercel-json).
- Framework adapters: `@sveltejs/adapter-vercel`, `@astrojs/vercel`, Nitro’s `vercel` preset, `@vercel/react-router` and `@vercel/remix`.
- System variables your code reads: `VERCEL=1`, `VERCEL_ENV`, `VERCEL_URL`, `VERCEL_BRANCH_URL`, `VERCEL_PROJECT_PRODUCTION_URL`, `VERCEL_REGION`, `VERCEL_DEPLOYMENT_ID` and the `VERCEL_GIT_*` variables.
- Request headers: `x-vercel-forwarded-for`, `x-vercel-id` and the `x-vercel-ip-*` location headers.
- Packages: `@vercel/functions` (`waitUntil`, `geolocation`, `ipAddress`), `@vercel/analytics` (reports to forkrail’s [Web Analytics](https://www.forkrail.com/docs/web-analytics)), `@vercel/firewall` rate limit checks, `@vercel/og`, `@vercel/otel`, and services you reach with your own key (Neon, Upstash, Edge Config).

## Move a project

1. **Create the project**

   Import the repository in the dashboard (**New project → Import**) or deploy it once from your terminal. Use the same root directory as on Vercel for a monorepo.

```bash
cd ~/code/storefront
forkrail
```

2. **Copy the environment variables**

   Paste your `.env` into the dashboard’s Environment variables page, or add them with `forkrail env add`. Leave out `VERCEL_OIDC_TOKEN`: it’s a 12-hour Vercel token.

```bash
printf '%s' "$DATABASE_URL" | forkrail env add storefront DATABASE_URL --target production
```

3. **Check a preview side by side**

   Deploy a preview and request the same pages on both: status codes, headers (`x-vercel-cache`), streamed pages, images, forms, and an API call or two. The build log warns about any Vercel-only service your code uses (below).

4. **Deploy production**

   Production is live at `https://<project>.<your domain>` while Vercel keeps serving your real domain.

```bash
forkrail --prod
```

5. **Move the domain without a gap**

   Add the domain in forkrail and let it get a certificate before DNS moves (the `_acme-challenge` record, or automatically on Cloudflare). Lower the record’s TTL, then point it at forkrail. Keep the Vercel deployment until traffic has moved. See [Domains](https://www.forkrail.com/docs/domains#move-without-downtime).

```bash
forkrail domains add shop.example.com storefront
forkrail domains ls storefront   # wait for "issued"
```

## Services that need a key of their own

Some Vercel services sign in with an OIDC token that only Vercel can issue to its own functions. On forkrail they build and deploy, then fail at their first call. The build looks for them and prints a warning with the fix:

| Package | Fix |
| --- | --- |
| `ai` 5+ / `@ai-sdk/gateway` (AI Gateway) | Set `AI_GATEWAY_API_KEY`, or call a provider directly, such as `@ai-sdk/amazon-bedrock` with a project IAM role. |
| `@vercel/blob` | Set `BLOB_READ_WRITE_TOKEN`, or move the files to S3. |
| `workflow` (Workflow SDK) | Set `WORKFLOW_TARGET_WORLD=@workflow/world-postgres` with a Postgres URL. |
| `@vercel/flags-core`, `@flags-sdk/vercel` | Set the `FLAGS` SDK key. |
| `@vercel/sandbox` | Pass a `VERCEL_TOKEN`, team id and project id to `Sandbox.create`. |
| `@vercel/queue` | Use a queue in your own account, such as SQS, with a project role. |
| `@vercel/kms`, `@vercel/oidc-aws-credentials-provider` | Give the project an IAM role: `forkrail project NAME --role ROLE`. The AWS SDK picks it up with no keys. |
| `@vercel/passport` | Sign-in in the app, or [deployment protection](https://www.forkrail.com/docs/deployment-protection) for a team-only site. |
| `upgradeWebSocket()` | WebSockets aren’t supported yet. Use a WebSocket service of its own. |

## Also worth checking

- `*.vercel.app` URLs in code or settings: OAuth redirect URIs, CORS lists, `NEXTAUTH_URL`.
- Integration variables Vercel added for you (`KV_REST_API_*`, `POSTGRES_URL*`, `EDGE_CONFIG`, `UPSTASH_*`, `DATABASE_URL`): bring them along.
- Compression works as on Vercel: the router compresses text answers (Brotli or gzip) for clients that ask, and leaves alone any your app already compressed or marked `content-encoding: identity`.
- Next.js is in beta on forkrail. Read [Frameworks](https://www.forkrail.com/docs/frameworks#nextjs) before moving a Next.js site.
