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 linkin 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_dumpandpg_restoreinstalled 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/analyticsand@vercel/speed-insightsfrom 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_TOKENand any otherVERCEL_*. If your code usesVERCEL_URLto 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.
Step 2: Prepare the App
- Next.js
- Static site (Vite, React, Astro...)
- Serverless functions (/api)
Shard Cloud runs Next.js with The build runs each time the app starts, with the app’s environment variables, so
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
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).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
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:
REDIS_URL in .env.production and delete the KV_* variables.
Blob (Vercel Blob)
Files move to the Shard Cloud CDN:- Replace
put()from@vercel/blobwith 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. - Copy the existing files: list them with
list()from@vercel/blob, download each one, and upload it to the CDN. - If your database stores Blob URLs (
https://...public.blob.vercel-storage.com/...), replace them with the new CDN URLs.
Step 4: Replace Cron Jobs
Vercel calls the paths invercel.json’s crons on a schedule, with Authorization: Bearer $CRON_SECRET:
vercel.json
scheduler.js
package.json
.shardcloud
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 ownSUBDOMAIN (for example myapp-staging), its own environment variables, and its Deploy page connected to your development branch.
Troubleshooting
Out of memory during the build
Out of memory during the build
next build runs inside the app’s RAM. Raise MEMORY to 1024 MB or more.The site doesn't load, but the logs show the server started
The site doesn't load, but the logs show the server started
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.A NEXT_PUBLIC_ variable is empty in the browser
A NEXT_PUBLIC_ variable is empty in the browser
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.Error connecting to the database after switching
Error connecting to the database after switching
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).Changed an environment variable and nothing happened
Changed an environment variable and nothing happened
Environment variables are read when the app starts: restart the application after changing them.