Web Development

Migrate Vercel to Coolify for Next.js: controlled cutover

Plan a controlled Vercel to Coolify migration for Next.js, with deployment settings, secrets, DNS cutover, feature gaps, verification, and rollback steps.

Developer reviewing Next.js deployment cutover from Vercel to Coolify
Developer reviewing Next.js deployment cutover from Vercel to Coolify

Yes—you can move a Next.js app from Vercel to Coolify. Coolify isn’t a drop-in replacement. Your application code may stay mostly portable, but you’ll manage deployment, caching, storage, cron, previews, monitoring, and integrations. The safest path is to classify dependencies, build staging, test production workflows, and switch DNS with rollback ready.

1. Decide what moves before you migrate

Coolify can fit when you want control over the server, Docker deployment, networking, and hosting costs. It may fit less well if your app relies on Vercel-only services or your team doesn’t want to operate databases, storage, workers, monitoring, and updates. Vercel hides more infrastructure; Coolify gives you more control and responsibility.

Classify each dependency before creating the target application:

Vercel or Next.js featureCoolify resultWhat to do
Server-rendered pagesUsually portableMatch Node.js and the start command
API routes and middlewareUsually portableTest headers, cookies, rewrites, and timeouts
Server ActionsUsually portableTest request size, authentication, and persistence
Next.js image optimizationUsually availableTest remote hosts and cache behavior
ISR and revalidationConfiguration-sensitiveDecide how cache persistence will work
Vercel Postgres or other managed dataNot transferred automaticallyDump, restore, and verify the database
Vercel Blob, KV, or managed queuesNeeds a replacementChoose another supported service
Vercel CronNeeds a schedulerRecreate the jobs in Coolify or externally
Vercel previewsNeeds configurationCreate preview deployments or another review flow
Vercel Analytics and integrationsMay need replacementReinstall an equivalent tool or remove the dependency

Before deployment, list the repository, package manager, lockfile, Node.js version, and all build-time and runtime variables. Also list the database, object storage, uploads, webhooks, email provider, queues, scheduled jobs, OAuth callbacks, DNS records, and third-party allowlists. Vercel variables and integrations may not appear fully in Git. Export or document them before the first target build. Keep separate development, preview, and production records.

Never commit exported secrets. Don’t place them in a repository or Docker image. Build-time variables must exist during compilation. Server-only values should enter when the container runs. Browser-visible variables must follow the framework’s public-variable convention and contain no credentials.

Don’t start production migration until you have a verified database backup, separate staging configuration, and documented rollback path.

2. Build and deploy a staging application in Coolify

Build staging before production. Use the same repository and production commit, but a separate Coolify application, hostname, and database or schema where possible. This lets you verify the build, runtime, environment variables, health checks, and external services without production traffic or credentials.

  1. Connect the staging application to the repository.

Coolify should read the repository and deploy the selected commit without production traffic or credentials.

  1. Match the application’s Node.js version.

Read the version from package.json, .nvmrc, volta configuration, or the current Vercel project settings. Pin a supported LTS version so local and production environments don’t drift. Check current Coolify and Next.js documentation for supported versions as of 2026.

  1. Configure the package manager and build command.

Use the package manager shown by the lockfile. Typical installation commands are npm ci, pnpm install --frozen-lockfile, or yarn install --frozen-lockfile. Then run the existing build script, usually npm run build or its package-manager equivalent. Don’t change the build command only because the hosting provider changed.

  1. Choose the deployment output mode.

For a normal Node server, use the existing start script, such as npm run start. Make sure it listens on the container interface. For Next.js standalone output, set output: 'standalone' in next.config.js. Copy the generated standalone files, public, and .next/static into the runtime image. Start the generated server.js. Standalone output can make the runtime image smaller, but it may expose missing files or native dependencies that Vercel previously supplied.

  1. Configure the application port and host.

Expose the container port, commonly 3000, and set Coolify’s application port to the same value. The process must listen on 0.0.0.0, not only localhost. A successful build doesn’t prove that the container can receive requests.

  1. Add staging environment variables.

Enter them through Coolify’s environment or secret settings. Provide build-time variables during the build when required. Keep server-only values private. Use staging credentials for the database, email, OAuth, webhooks, and storage. Never paste production secrets into build logs or commit exported Vercel files.

  1. Add a health endpoint and deploy staging.

Use a small endpoint such as /api/health. It should confirm that the process answers requests without destructive work. If a Docker health check uses curl, include curl in the image. Coolify’s UI health check can override the Dockerfile check, so verify which one is active.

The staging gate is simple: the container starts, the health endpoint responds, static assets load, and logs show no missing environment variables.

3. Test runtime behavior and external services

A staging home page isn’t enough. Test the routes and integrations that Vercel previously managed. Confirm rendering, authentication, data writes, uploads, caching, webhooks, email, queues, scheduled work, and failure paths before you consider the deployment ready.

  1. Test rendering and routing.

Open static, server-rendered, dynamic, and error pages. Check middleware, rewrites, redirects, cookies, authentication, request headers, and host-based routing. Test both the apex and www hosts when both are configured.

  1. Test API routes and Server Actions.

Submit forms, upload representative files, validate authentication, and exercise error paths. Compare request-size and execution-time limits with the server and reverse-proxy settings. Confirm that actions reach the intended database and don’t rely on a Vercel-only variable.

  1. Test image optimization and cache headers.

Load local and remote images through the Next.js image component. Confirm that each remote hostname is allowed and transformed images return the expected content type. Inspect cache headers instead of assuming Vercel’s behavior continues.

  1. Test ISR and revalidation.

Generate a page, change its source data, trigger revalidation, and confirm updated content appears. A self-hosted container may keep ISR data in .next/cache. If deployment replaces that filesystem, the cache can start empty and rebuild on the first request. Decide whether this is acceptable, whether persistent storage is appropriate, or whether you need a shared cache. With multiple instances, one instance’s cache isn’t automatically shared.

  1. Test persistence and background work.

Write an upload to staging storage, redeploy, and read it back. Don’t use the container filesystem for user uploads. Confirm database connections, migrations, transactions, webhooks, email delivery, queue consumers, and scheduled jobs. Recreate Vercel Cron jobs in Coolify or with an external scheduler. Make scheduled work idempotent where the application requires it.

  1. Record failures and stop at the gate.

For each failure, record whether the fix involves application code, a replacement service, a proxy setting, or an accepted behavior difference. Don’t proceed while authentication, payments, uploads, webhooks, or data writes remain unverified. A green build isn’t a green runtime.

4. Prepare domains, DNS, HTTPS, and previews

Prepare domains and previews before production. Record the current DNS and Vercel settings, then verify the Coolify hostname, certificate, redirects, and application behavior. Keep Vercel attached until those checks pass, so the old deployment remains available during the change.

Before the production switch, record A, AAAA, CNAME, TXT, MX, verification, redirect, and domain records. Also record every OAuth callback and webhook endpoint. Lower the relevant DNS TTL ahead of the change when the DNS provider permits it. Resolvers can still retain answers beyond the requested TTL.

Add the production hostname to Coolify. Set the application port and use Coolify’s supported certificate flow, commonly Let’s Encrypt. Check current Coolify and DNS-provider documentation for certificate prerequisites and proxy behavior. Keep the Vercel domain attached until verification passes.

Preview deployments don’t transfer automatically. Decide whether Coolify will deploy preview branches or whether pull requests will use another review environment. Preview credentials must not reach production databases, storage, queues, or email.

Before cutover, verify the Coolify hostname over HTTPS, the certificate, HTTP-to-HTTPS redirect, canonical host, redirects, robots behavior, sitemap, static assets, and image transformations. The application should answer on the intended host without relying on Vercel.

5. Transfer production data and cut over traffic

Cut over only after staging passes and production data has a tested backup. Move application data and object storage separately, prepare the production hostname, change DNS, and watch the verification window. Keep Vercel available until critical paths and callbacks work through Coolify.

  1. Prepare the production configuration.

Copy reviewed production variables into Coolify’s secret settings. Restore the database from a verified dump or connect to the existing managed database. For PostgreSQL, preserve roles, extensions, ownership, and connection permissions. Move object storage separately. Verify object keys, public URLs, and access policies.

  1. Plan the write transition.

Database migrations and new writes complicate rollback. Take a final backup and apply compatible schema changes. Choose a write-free or dual-write window when the data model requires it. Failing a deployment is safer than starting new code against an old schema. Redeploying the old Vercel build won’t reverse data written by Coolify.

  1. Configure the production hostname in Coolify.

Confirm the application port, HTTPS certificate, environment variables, health check, database connection, storage credentials, and external callbacks before changing DNS.

  1. Change the DNS record.

Update the required record while keeping the Vercel deployment available. Check the domain from more than one network and allow for DNS caching.

  1. Verify critical production paths.

Check the certificate, HTTP-to-HTTPS redirect, canonical host, login, forms, redirects, static assets, image transformations, webhooks, email, and one critical transaction. Confirm that new requests reach Coolify and important callbacks no longer point to Vercel.

  1. Watch the verification window.

Inspect Coolify and application logs, reverse-proxy errors, CPU and memory use, disk space, database connections, queue depth, and scheduled-job history. Keep Vercel serving or ready to serve until this gate passes. Don’t delete the old project during the first verification period.

6. Roll back deliberately and operate Coolify afterward

A rollback restores traffic while preserving data. It isn’t just an older image deployment. Before cutover, record the old DNS records, Vercel production deployment and branch, environment-variable source, database endpoint, migration state, and every external callback.

If the new application has accepted writes, stop new writes or use controlled maintenance before switching back. DNS rollback doesn’t undo orders, accounts, uploads, migrations, or other data changes.

If Coolify fails, restore the previous DNS record to Vercel. Keep the known-good Vercel deployment available. Verify the old domain and authentication flow. Check DNS propagation instead of expecting an instant change. Reconcile Coolify writes before reopening the old application.

After cutover, maintain:

  • Automated database backups, with a restore test and retention policy.
  • Persistent or external storage for uploads and caches that must survive redeploys.
  • Application and proxy logs with retention that doesn’t expose secrets.
  • A health check that tests useful availability without changing data.
  • Error monitoring, resource alerts, disk-space alerts, and database connection monitoring.
  • Restricted SSH and Coolify access, strong authentication, least-privilege credentials, and documented recovery access.
  • A patch process for Coolify, Docker, the host operating system, Node.js, and dependencies.
  • Separate staging and production credentials, with previews blocked from production data.
  • A scheduled-job record with its owner, frequency, idempotency, and last successful run.

Review Vercel-specific limits after migration. Analytics, managed databases, blob storage, queues, cron, preview behavior, edge execution, and platform integrations may need separate services or redesign. The migration is complete when production traffic reaches Coolify, critical workflows pass, scheduled work runs, monitoring is active, and the rollback procedure has been checked.

Conclusion

Treat the move as an infrastructure change, not just a new deployment target. Inventory what Vercel supplied, reproduce the build in staging, test persistence and background work, and change DNS only after rollback is real. Check current Coolify, Next.js, Node.js, DNS, and certificate documentation before applying version-specific settings in 2026.

Frequently Asked Questions

Can every Next.js app on Vercel move to Coolify unchanged?

No. The Next.js code may be portable, but Vercel-managed databases, storage, cron, queues, analytics, previews, and edge behavior need replacements or configuration changes. Apps with simple server rendering and external data services usually need less redesign than apps built around Vercel-only integrations.

Should I use standalone output for a Next.js deployment on Coolify?

Use standalone output when you want an explicit Docker runtime with only the files needed to run the server. It isn’t required for every deployment. If you choose it, copy the generated server, static files, and public files correctly, start the generated server, and test native dependencies. Check current Next.js documentation first.

What is the safest way to roll back after changing DNS?

Keep the working Vercel deployment, restore the previous DNS records, and account for DNS caching and database writes before reopening traffic. DNS rollback doesn’t undo migrations, orders, uploads, or account changes made on Coolify. Take a final backup and define how those writes will be reconciled before cutover.

Sources

Cloud & Routing Desk

Think Tech Editorial

Troubleshooting guides for reverse proxies, TLS routing, and self-hosted PaaS deployments.