Modelence runs your Next.js app the way next start runs it on your machine, as one long-running server, in containers on AWS in any of 17 regions, with its Postgres and Redis created in the same region. Moving mostly means describing the project in one config file, which your coding agent writes for you, while you sign in, paste your secrets, copy the database and switch the domain.
The steps below assume a Next.js app, which most Vercel projects are. A Vite, Astro or SvelteKit project moves the same way with its own build and start commands. To weigh the two platforms first, see Vercel vs Modelence.
Paste this into your coding agent to start
Where each part of your Vercel project goes
The app, its storage integrations and its cron jobs become entries in one config file.
| On Vercel | On Modelence |
|---|---|
| Project | A Vercel project becomes a Modelence app, described in modelence.config.json at the root of the repository. Your coding agent writes the file and runs the deploy. |
| Next.js | The app builds with next build and runs as one long-running server with next start, so pages, route handlers, server actions and proxy (middleware before Next.js 16) all run in the same Node.js process. |
| Functions | API routes and server code run inside that server instead of as separate functions, so they keep their database connections open between requests. Background work can run in a worker service next to it. |
| Environment variables | The config file declares the variables the app needs, and the deploy asks you for any value that is missing. NEXT_PUBLIC_ variables also reach the build, since Next.js inlines them into the browser bundle. |
| Neon Postgres | Created in your app's region on the first deploy, with plans from 1 GB to 16 GB of RAM. The data moves with pg_dump and pg_restore. This covers projects created as Vercel Postgres, which now run on Neon. |
| Upstash Redis | Redis is created in your app’s region on the first deploy, with plans from 250 MB to 5 GB, and the app reaches it through REDIS_URL with a Redis client such as ioredis or node-redis. A Redis that only holds a cache can start empty. This covers projects created as Vercel KV, which now run on Upstash. |
| Vercel Blob | Files stay in Vercel Blob, which the app reaches from Modelence with a read-write token in BLOB_READ_WRITE_TOKEN, or move to any S3-compatible bucket whose keys the app reads from its variables. |
| Cron jobs | The schedules from vercel.json run in a small scheduler service that calls the same routes, so the route handlers stay as they are. |
| Preview deployments | Each app has a production environment and sandbox environments for staging or testing, each with its own variables and databases. |
| Regions | Pick any of 17 AWS regions across the Americas, Europe and Asia Pacific, and the app and its databases are created there together. |
| Custom domains | Add your domain to the app and update the DNS record. Domains are unlimited on paid plans, with TLS certificates issued for you. |
From vercel.json to the config file
Your coding agent writes modelence.config.json at the root of the repository. Take a Next.js app with Postgres, Redis and two cron jobs in vercel.json:
{
"crons": [
{ "path": "/api/cron/daily-report", "schedule": "0 5 * * *" },
{ "path": "/api/cron/sync", "schedule": "*/15 * * * *" }
]
}On Modelence, web builds the app with next build and starts it with next start, which listens on the port Modelence sets. Postgres and Redis sit next to it, and env hands their connection strings to the app under the names it reads:
{
"$schema": "https://cloud.modelence.com/schema/modelence.config.json?version=1",
"resources": {
"web": {
"type": "service",
"image": "node-22-slim",
"build": { "commands": ["npm ci", "npm run build"] },
"start": { "commands": ["npm start"] }
},
"scheduler": {
"type": "service",
"image": "node-22-slim",
"build": { "commands": ["npm ci"] },
"start": { "commands": ["node scheduler.mjs"] },
"healthCheck": { "type": "none" },
"rollout": "recreate"
},
"main-db": { "type": "postgres", "plan": "postgres-1gb" },
"cache": { "type": "redis" }
},
"env": {
"DATABASE_URL": { "type": "resource", "resource": "main-db", "output": "url" },
"REDIS_URL": { "type": "resource", "resource": "cache", "output": "url" },
"WEB_URL": { "type": "resource", "resource": "web", "output": "url" },
"CRON_SECRET": { "type": "secret" },
"NEXT_PUBLIC_SITE_URL": { "scopes": ["build", "runtime"] }
}
}If your code reads other names, such as POSTGRES_URL from a Vercel Postgres project, tie those names to the database instead. NEXT_PUBLIC_SITE_URL has a build scope because Next.js inlines it into the browser bundle when it builds. See how deploying from one config file works.
Cron jobs
Vercel Cron calls a route of your app on a schedule. The scheduler service does the same with node-cron: it reads the app's private address from WEB_URL and sends the CRON_SECRET header your routes already check. Add node-cron to the dependencies and save this as scheduler.mjs:
import cron from 'node-cron';
// The schedules from vercel.json, calling the same routes Vercel Cron called
const jobs = [
{ path: '/api/cron/daily-report', schedule: '0 5 * * *' },
{ path: '/api/cron/sync', schedule: '*/15 * * * *' },
];
for (const job of jobs) {
cron.schedule(
job.schedule,
async () => {
const res = await fetch(new URL(job.path, process.env.WEB_URL), {
headers: { Authorization: `Bearer ${process.env.CRON_SECRET}` },
});
console.log(job.path, res.status);
},
{ timezone: 'UTC' },
);
}The scheduler listens on no port, so it has no health check, and "rollout": "recreate" stops the old one before the new one starts. Keep it on one container so each job runs once. Schedules are in UTC, as on Vercel, and can run as often as every minute.
Running Next.js as a server
A few things behave differently when the whole app runs in one server process instead of functions.
- Images.
next/imageoptimizes images in the server itself, with nothing to configure. Optimized images are cached on the container's disk and made again after a deploy. - ISR and the cache. Each container keeps its own cache in
.next/cache. Time-based revalidation works as it is. If the app revalidates on demand and runs on more than one container, set acacheHandlerin next.config that keeps the cache in Redis. - Database connections. The server keeps its connections open between requests, so a regular
pgor Prisma connection works without a pooler.@upstash/redisand@vercel/kvtalk to Upstash over HTTP, so if Redis moves too, connect toREDIS_URLwith ioredis or node-redis. - Files. Each deploy starts containers with an empty disk, so uploads stay in Vercel Blob or another bucket, and sessions in the database or Redis.
The Next.js deploy guide covers health checks and the rest of the setup.
Moving your app
Your coding agent does most of the setup, and you step in to sign in, add secrets and copy the database.
1. Give your coding agent the deploy prompt
Open the project in your coding agent and paste the prompt below. The agent reads the Modelence deploy guide, works out how the app builds from its package.json and vercel.json, and goes through the next steps with you.
Paste this into your coding agent
2. Pull your environment variables
Link the project with the Vercel CLI and write its production variables to a local file:
vercel link
vercel env pull .env.production.local --environment=productionThe file lists every variable the app reads. Vercel stores production values as secrets by default and writes a placeholder for those, so copy their values from where you keep them, or issue new keys, which is a good habit when moving anyway. You can skip the variables the Neon and Upstash integrations set, such as DATABASE_URL, PGHOST and KV_REST_API_URL, since the new databases come with their own. Keep the file out of Git.
3. The agent writes the config file and deploys
It declares the app, its databases and the variables it needs in modelence.config.json, runs next build and next start locally to check them, and runs the deploy. Your browser opens so you can sign in, pick the app and environment, and paste in the values the deploy asks for. The first deploy creates the databases, so run your migrations against the new one before you send it traffic:
DATABASE_URL="<new database URL>" npx prisma migrate deployThe connection string is in the environment's variables in the dashboard. With Drizzle, run npx drizzle-kit migrate the same way.
4. Copy your database
Neon asks for an unpooled connection string for pg_dump. Copy it from the Neon console, under Connect with connection pooling turned off, and copy the data into the new database:
pg_dump -Fc -v -d "<Neon unpooled connection string>" -f neon.dump
pg_restore --verbose --clean --if-exists --no-owner --no-acl \
-d "<new database URL>" neon.dumpUse the latest pg_dump and pg_restore, since an older client refuses a newer server. Do this once as a test run, click through the app on its Modelence URL against the copied data, and time it, so you know how long the final copy will take.
5. Switch over and move your domain
Lower the TTL on your DNS record a day ahead. When you are ready, stop writes on the Vercel deployment, for example with a maintenance page, run the same two commands again for a fresh copy, and check the app on its Modelence URL. Then add your domain to the Modelence app and replace the Vercel DNS record with the target the dashboard shows.
Once traffic has moved over, remove the domain from the Vercel project and delete the project along with its Neon and Upstash databases and any tokens it held.
On AWS, in the region you choose
Your app and its databases run together in the AWS region you pick, on AWS Fargate across two availability zones, with failover and encryption set up from the first deploy. See how Modelence runs your app on AWS.
Americas
- Oregonus-west-2
- N. Californiaus-west-1
- Ohious-east-2
- N. Virginiaus-east-1
- Montrealca-central-1
- São Paulosa-east-1
Europe
- Irelandeu-west-1
- Londoneu-west-2
- Pariseu-west-3
- Frankfurteu-central-1
- Stockholmeu-north-1
Asia Pacific
- Mumbaiap-south-1
- Singaporeap-southeast-1
- Seoulap-northeast-2
- Osakaap-northeast-3
- Tokyoap-northeast-1
- Sydneyap-southeast-2
Frequently asked questions (FAQs)
Does every Next.js feature work outside Vercel?
Yes. With next build and next start, server components, route handlers, server actions, streaming, image optimization and proxy (called middleware before Next.js 16) all run in the Next.js server. Modelence runs that same server in containers on AWS, so the app behaves the way its production build does on your machine.
Do I need output: standalone?
No. Modelence installs the project’s dependencies and runs next start, so the default build output works as it is. If you already use standalone output, copy public and .next/static into .next/standalone after the build and start the app with node .next/standalone/server.js instead.
Does ISR work on Modelence?
Yes. Time-based revalidation works without changes. Each container keeps its own Next.js cache, so if the app calls revalidatePath or revalidateTag and runs more than one container, set a cacheHandler in next.config that keeps the cache in Redis, which Modelence runs in the same region as the app.
Can I keep my database on Neon or Upstash?
Yes. A database hosted elsewhere works as it is: declare its connection string in the config file as a secret and paste the value in when the deploy asks for it. You can move the data to a managed database on Modelence later.
What happens to my Vercel cron jobs?
They run in a small scheduler service next to the app, which calls the same routes on the same schedules over the app’s private network. The scheduler runs on one container and stops before its new version starts, so each job runs once.
Can I keep the frontend on Vercel and move only the backend?
Yes. Move the API, workers and databases to Modelence and point the frontend at the API’s address. The comparison of Vercel and Modelence covers that setup.
Can Claude Code or Cursor do the migration for me?
Yes. Open the project in Claude Code, Cursor, Codex or another coding agent and paste the prompt from the first step. The agent reads the Modelence deploy instructions, writes the config file, checks the build and asks you for the secrets. Copying the data and switching the domain follow the steps above.
How does the cost compare?
Modelence bills each container and database by the hour based on its size, at AWS rates with no markup, rather than per function invocation. Each paid plan includes its price as usage, so the bill stays at the plan price unless your apps run more than it covers, and there is no charge per seat. Modelence Starter is $20 a month with $20 of usage included.