Leave Vercel without rewriting your Next.js app, from your AI agent
Is your Vercel bill climbing, or does your data have to stay in France? Connected to while over MCP, your agent takes your Next.js app as it is, with its database and its jobs, and deploys it in France.
By Aloïs Oddon, co-founder of Nextmap. Facts checked on November 2, 2026.
Prerequisites
- A Next.js app on Vercel, and its repository on your computer.
- An AI agent that works in a terminal: Claude Code, Codex, Cursor or Gemini CLI.
Step 1: Give your agent these instructions
Open your agent in your app’s folder and paste these instructions into it:
Connect to while with my account (while.sh/agents), then deploy my app.
Without an account, your agent deploys your app as a trial, in one request. To keep it, open the link it gives you and create your account.
With your account, your agent adds while’s MCP server itself. If it asks you to, restart it. On the first call to while, a page opens in your browser. In Claude Code, if it doesn’t open, type /mcp, choose while, then Authenticate. On that page, choose your app, or “A new app”, then click Authorize.
Step 2: Open your app
Your agent gives you your app’s address, for example https://mon-appli.while.cloud, over HTTPS.
What your agent does
It writes while.yaml at the root of your app:
apiVersion: while/v1
project: mon-appli
services:
- name: web
port: 3000
health:
path: /
Your app is built, then started with next start, the way Next.js runs outside Vercel, with images, on-demand rendering and server routes included1.
Bring over your scheduled jobs
You, to your agent: Bring over the crons from our vercel.json.
Your agent reads the jobs in vercel.json2 and declares them as scheduled jobs in while, at the same times, with the same code.
Copy your database
You, to your agent: Copy our Neon database to while.
Your agent exports the database with pg_dump, then loads it into a PostgreSQL database in while, backed up every day.
Carry over your variables
You, to your agent: Carry over our environment variables from Vercel.
Your agent carries your settings over to while. You enter your secret keys yourself: your agent never sees them. Your agent declares the ones the browser reads, prefixed with NEXT_PUBLIC_, for the app’s build.
Replace Blob and Upstash Redis
You, to your agent: Replace Vercel Blob and our Upstash Redis.
Your agent adds S3-compatible storage for your files and a Redis-compatible cache for your keys, and connects your code to them.
Move to your own domain
You, to your agent: Put the app on app.acme.com.
Your agent declares the domain, you add the DNS records it gives you, and the HTTPS certificate follows.
Go back to the previous version
You, to your agent: Go back to the previous version.
In the 30 minutes after a deployment, the previous version comes back in a second. After that, it takes a few seconds. Once the previous version is back, your agent reads what broke in while’s logs, fixes it and deploys again.
In the docs: Valkey cache (Redis), Scheduled jobs, Custom domain, Versions and rollback and Variables and secrets.
Next steps
Sources
- Next.js, self-hosting (next start, images, ISR), accessed November 2, 2026
- Vercel, cron jobs (vercel.json), accessed November 2, 2026