Moving a Next.js app from Vercel to your own server
To move a Next.js app from Vercel to your own server, connect the same GitHub repository to the Coolify panel on the server, copy the environment variables, replace the Vercel-specific parts (cron, analytics, storage), test on a temporary address and switch your domain's A record last. The Next.js docs say all features work on a Node.js server. Your Vercel deployment stays up until you switch, so you have a way back.
Really, this is a choice of billing model. Vercel's docs explain that infrastructure is billed by data transferred, requests and compute duration. A server costs a fixed monthly fee for the RAM, CPU and disk you choose. Our comparison shows how to run your own numbers.
What changes when you move?
| Topic | Vercel | Your server |
|---|---|---|
| Billing | By usage | Fixed monthly, unlimited traffic, daily backups included in the price |
| Location | Global delivery network | One server, in Istanbul |
| Traffic spikes | The platform absorbs them and the bill grows | The site slows when capacity runs out, and you scale up |
| Builds | On the platform's machines | On the same server, so builds set the memory you need |
| Maintenance | The platform's job | OS updates, package updates and monitoring are yours, as is root access |
| Previews | Automatic for branches | Enabled separately in Coolify |
| Network security | Vercel Firewall | You manage the server's firewall |
To be plain: there's one server, no worldwide edge delivery, and maintenance becomes yours. Who won't mind? If your visitors are mostly in Turkey and nearby countries, one location is fine. If your pages all read from a single database, responses wait on that database wherever the code runs. Dashboards, internal tools and products with predictable traffic rarely need automatic scaling. If your audience is spread worldwide, your traffic spikes hard, or you never want to touch maintenance, Vercel may be the better fit.
Prepare the new server
- Order from the Next.js VPS page. The server comes with Coolify.
- Connect the repository. The short way: open the project in Claude Code or Cursor, paste the Paste into your AI tool row from the Overview tab, and the tool deploys it. You can also do it by hand.
- Pin your Node version with
engines.nodeinpackage.json. - Pull your variables:
vercel env pull .env.move --environment=production. Secret values can't be read back, so the CLI writes placeholders and you get those from their source. Keep the file out of the repository and enter its contents under Environment Variables in Coolify, withNEXT_PUBLIC_values available at build time. - Search for Vercel-specific code:
grep -n "@vercel/" package.jsonandgrep -rnE "VERCEL_|x-vercel-" app src. System variables such asVERCEL_URLdon't exist on your server, so use your own.
Next.js features and Vercel-specific parts
| Part | On your server | What to do |
|---|---|---|
| Image optimization | Works with next start, no setup | It uses your server's CPU and memory |
| ISR and caching | Work by themselves on one instance with a local disk | Several instances must share the cache, and it refills after each deploy |
| Middleware (Proxy in Next.js 16) | Works with next start, no setup | Requests are now handled in Istanbul |
| Cron jobs | vercel.json isn't read | Call the same path from Scheduled Tasks in Coolify: curl -fsS -H "Authorization: Bearer $CRON_SECRET" http://localhost:3000/api/cron. Vercel cron runs on UTC, while Coolify uses the server's timezone |
| Redirects and headers | vercel.json isn't read | Move them to next.config |
| Web Analytics, Speed Insights | Rely on routes Vercel adds to a deployment | Remove the components and use a tool such as Umami |
| AI Gateway | Callable from any server | Set AI_GATEWAY_API_KEY |
What about Postgres, KV and Blob?
- Postgres and KV: Vercel's docs say these products are gone and older databases moved to Marketplace providers, so your data sits with a separate provider behind an environment variable. Carry that over and the app reaches the same database. If billing runs through your Vercel account, take your data before closing it. A distant database adds that distance to every query.
- Moving it to your server: Create PostgreSQL in Coolify, export with
pg_dump -Fc "OLD-DATABASE-URL" --no-owner --no-privileges -f backup.dump, and upload the archive with Import backup on the database's Backups page. If Redis is only a cache, starting empty is usually fine. - Blob:
BLOB_READ_WRITE_TOKENalso works from another host, so you can leave it alone. To bring files onto your server, change the code and mount the folder with Persistent Storage.
Moving your domain without downtime
- Test on the HTTPS address Coolify gives you: sign-in, forms, payments, images, and Execute now for cron.
dig NS example.com +shortshows where your records live: Vercel's Domains page if it lists Vercel's nameservers, otherwise your DNS provider.- Lower the TTL on the root and
wwwrecords, to 300 seconds for example, and wait for the old TTL to pass. - If the database is moving too, stop writes and load the final copy.
- Point the A record at the server's IP address. Leave MX and TXT records alone for email.
- Add the domain with
httpson the Domains page in Coolify and press Redeploy. The certificate is issued automatically. - Keep the Vercel deployment up for a few days. Visitors with the old record cached land there, and you can point the record back if needed.
- Once traffic has moved, remove the domain from the Vercel project, cut the Git connection with Disconnect, and restore the TTL.
The certificate is only issued after the domain points at the server, so early visitors may see a brief certificate warning. Switch during a quiet hour.
Frequently asked questions
What size should I start with?
The sales page recommends at least 4 GB of RAM, 2 vCores and 40 GB of disk. A small project built on 2 GB, while one with 85 packages ran out of memory at 2 GB and built at 4 GB. You can scale up from your panel.
What will it cost per month?
That size is about $6 a month (VAT included), and outside Turkey you pay in US dollars. Traffic is unlimited.
Do I have to transfer a domain I bought from Vercel?
No. Vercel's docs treat registration and DNS as separate. Changing the A record at Vercel is enough, and your record overrides the default ones.
How do updates work after the move?
With a webhook, git push builds and publishes each version. If one goes wrong, Coolify's Rollback page returns you to an earlier image.
Can I move without moving the database?
Yes, and it's the lowest-risk order. Move the app first and the database later.
Comments0
No Comments Yet
Be the first to share your thoughts.
Please sign in or sign up to leave a comment.