Skip to main content

Introduction

This guide moves a Vercel project to Shard Cloud. On Shard Cloud your app runs as a regular, always-on server instead of serverless functions, so there are no cold starts and no function time limits.

Before You Start

What you need

  • The Vercel CLI (npm i -g vercel), logged in, and the project linked (vercel link in the code folder)
  • The project’s code
  • A Shard Cloud account with room for the app (a Next.js app needs about 1024 MB to build), plus any databases
  • To copy a Postgres database: Docker, or pg_dump and pg_restore installed locally

What doesn’t move

  • Preview deployments per pull request. You can keep a staging app instead: a second application deployed from another branch (step 7).
  • Vercel Analytics, Speed Insights and Edge Config. They only work on Vercel. Shard Cloud web apps have their own HTTP analytics (Core plan and above). Remove @vercel/analytics and @vercel/speed-insights from your code, and move Edge Config values to environment variables or your database.

Step 1: Export the Environment Variables

.env.production now holds the production variables. Open it and:
  • Delete the ones Vercel adds itself: VERCEL, VERCEL_ENV, VERCEL_URL, VERCEL_OIDC_TOKEN and any other VERCEL_*. If your code uses VERCEL_URL to build links, set your own variable with the Shard Cloud address instead.
  • Fill in the sensitive ones. Variables marked Sensitive on Vercel come back empty: copy their values from where they came from.
  • Leave the database variables for now: you’ll replace them in step 3.
This file contains your secrets. Don’t commit it, and delete it when you’re done.

Step 2: Prepare the App

Shard Cloud runs Next.js with next start, which supports everything a Node.js server does: server rendering, API routes and route handlers, server actions, middleware, ISR and image optimization. Check that package.json has the usual scripts:
package.json
next start listens on the PORT variable, which Shard Cloud sets to 80, so no -p flag is needed. Create a .shardcloud file at the root:
.shardcloud
The build runs each time the app starts, with the app’s environment variables, so NEXT_PUBLIC_* values are picked up. After changing a variable, restart the app so it builds again.If you used rewrites, redirects or headers in vercel.json, move them to next.config.js (same names, see the Next.js docs).
Set VERSION to your Vercel project’s Node.js version (in Settings → Build and Deployment) if it isn’t the recommended one. Dependencies are installed with npm, yarn, pnpm or bun, following your lockfile.

Step 3: Move the Data

Postgres (Vercel Postgres or Neon)

1

Create the database

In the Dashboard, create a PostgreSQL database with the same major version as the old one or a newer one (the version can’t change later).
2

Dump the old database

Use the direct (unpooled) connection URL: POSTGRES_URL_NON_POOLING or DATABASE_URL_UNPOOLED in your environment variables. The pooled URL can break pg_dump.
3

Restore it into Shard Cloud

Use the Docker image of your Shard Cloud database’s major version (postgres:17, postgres:18).
4

Point the app at it

In .env.production, set every Postgres variable your code reads (DATABASE_URL, POSTGRES_URL, POSTGRES_PRISMA_URL…) to the Shard Cloud connection URL, and delete the PG* and unpooled ones your code doesn’t use.
@vercel/postgres and @neondatabase/serverless talk to Neon over HTTP and WebSockets, which a regular PostgreSQL server doesn’t speak. If your code imports them, switch to pg (or postgres). Prisma, Drizzle with node-postgres and other regular drivers work as they are.

KV (Vercel KV or Upstash Redis)

Create a Redis database. KV data is usually a cache, so it starts empty. @vercel/kv and @upstash/redis use Upstash’s HTTP API, so they can’t talk to a regular Redis server. Switch to a Redis client such as redis or ioredis, with the connection URL from the database page:
Then set REDIS_URL in .env.production and delete the KV_* variables.

Blob (Vercel Blob)

Files move to the Shard Cloud CDN:
  1. Replace put() from @vercel/blob with an upload to the CDN API. The upload has to happen on the server (a route handler or API route), since it uses your CDN token.
  2. Copy the existing files: list them with list() from @vercel/blob, download each one, and upload it to the CDN.
  3. If your database stores Blob URLs (https://...public.blob.vercel-storage.com/...), replace them with the new CDN URLs.
The Lovable migration guide walks through the same steps for another storage service, with a script you can adapt.

Step 4: Replace Cron Jobs

Vercel calls the paths in vercel.json’s crons on a schedule, with Authorization: Bearer $CRON_SECRET:
vercel.json
Keep your cron routes as they are, and call them from a small scheduler application:
scheduler.js
package.json
.shardcloud
Set its APP_URL (https://myapp.shardweb.app, or your domain) and the same CRON_SECRET as the app. It has no SUBDOMAIN, so 256 MB is enough, and it restarts automatically if it crashes. Vercel cron schedules are in UTC, as above.

Step 5: Deploy

1

Upload the app

Zip the project without node_modules/, .next/, .vercel/ and build output (100 MB at most), and upload it in the Dashboard.
2

Import the environment variables

On the application’s page, open Environment Variables, choose Import .env and pick .env.production. Check the values, then restart the application so it builds with them.
3

Follow the first start

Watch the logs on the application’s page: dependencies install, the build runs, then the server starts.
4

Connect GitHub

To deploy on every push like on Vercel, connect the application to your repository on its Deploy page, choosing the production branch. See Git integration. Turn on Auto-Restart on Deploy so each push builds and serves the new code.

Step 6: Test, Then Switch the Domain

1

Test on the free subdomain

Open https://myapp.shardweb.app and check pages, logins, forms, uploads and anything that reads or writes data.
2

Add your domain

Add your domain to the application and update its DNS to point at Shard Cloud instead of Vercel. If the domain uses Vercel’s nameservers, change the records in Vercel’s DNS settings, or move the domain’s DNS elsewhere first. See Custom Domain. HTTPS is set up for you.
3

Clean up Vercel

Once traffic is on Shard Cloud and you’ve checked the data, remove the domain from the Vercel project and delete the project and its stores to stop any charges.

Step 7 (Optional): A Staging App

To replace preview deployments, create a second application from the same code with its own SUBDOMAIN (for example myapp-staging), its own environment variables, and its Deploy page connected to your development branch.
A .shardcloud file in your repository is applied to every application deployed from it, so two apps would fight over the same SUBDOMAIN. With more than one application on the same repository, keep .shardcloud out of the repository (add it to .gitignore) and let each application keep the one it was uploaded with.

Troubleshooting

next build runs inside the app’s RAM. Raise MEMORY to 1024 MB or more.
The server must listen on port 80 (the PORT variable) and on 0.0.0.0. next start and serve -l 80 already do; check custom servers.
NEXT_PUBLIC_* values are baked in at build time. Check that the variable is set on the application, then restart it so the build runs again.
Check that every database variable your code reads points to the Shard Cloud URL, and that the code doesn’t use @vercel/postgres, @neondatabase/serverless, @vercel/kv or @upstash/redis, which only speak HTTP (see step 3).
Environment variables are read when the app starts: restart the application after changing them.