Move from Vercel
This guide is for projects that run on Vercel today. LeafCloud has no build service and no serverless functions for static sites, so what moves depends on what the project does:
- Static sites and single-page apps. Vite, React, Vue, Svelte, Astro, plain HTML, and Next.js with
output: "export".leaf deploybuilds the project on your machine or CI runner and uploads the files. See Path 1. - Next.js or Node apps that need a server. Server rendering, API routes, route handlers, middleware, server actions. LeafCloud app hosting runs your Docker image on a server we set up. It is invite-only. See Path 2.
- Vercel Postgres (Neon). LeafCloud managed Postgres. It is also invite-only. See Path 3.
A project can use more than one path: a site for the front end, an app for the API, and a database.
How the pieces map
Section titled “How the pieces map”| Vercel | LeafCloud |
|---|---|
| A project | A site for files, created with leaf sites create <name>, or an app for a container |
| Framework preset, build command and output directory | Framework detection, or build and dir in leaf.toml, or --dir on the command line |
| Environment variables for the build | The environment of the shell that runs leaf deploy. Variables that start with LEAF_ are removed before the build runs. |
| Preview deployments, one URL per push | A second site with a fixed name, such as my-app-staging, or one site per branch from CI |
| Git integration: build and deploy on push | GitHub Actions with LEAF_TOKEN. See CI and API keys. |
| Instant Rollback | leaf deploys and leaf rollback |
vercel.json rewrite or route to index.html | not_found = "spa:index.html" in leaf.toml. The page is served with status 200. |
| Custom 404 page | not_found = "page:404.html" in leaf.toml. The page is served with status 404. |
| Other redirects, rewrites and headers | Not supported on a static site. See What does not move. |
| A domain on a project | leaf domains add <domain> --project <site> |
| Vercel Postgres | leaf db, managed Postgres (invite-only) |
Without a not_found setting, a missing path returns a plain 404. LeafCloud does not fall back to
index.html unless you set spa:.
Before you start
Section titled “Before you start”Check what the project needs:
- If it builds to files only, and every page works without a server, use Path 1.
- If it has API routes, route handlers, middleware, server actions,
getServerSidePropsordynamic = "force-dynamic", it needs a server. Use Path 2. - If it uses a database, start with Path 1 or 2 and add Path 3.
Install the CLI and sign in:
leaf loginSee Install the CLI and Sign in.
App hosting and managed databases are invite-only. In the dashboard, choose Request access on the Apps or Databases page, or email admin@leafcloud.in. We review these by hand.
The build runs on the machine where you run leaf deploy, not on LeafCloud. Node and your package
manager must be installed there, as they are today. If node_modules is missing, leaf asks before it
installs dependencies.
Path 1: static sites and single-page apps
Section titled “Path 1: static sites and single-page apps”Step 1: Pull the environment and run a dry run
Section titled “Step 1: Pull the environment and run a dry run”Pull the production variables from Vercel into a file and export them in the shell that will run the deploy:
vercel env pull .env.production --environment=productionset -a. ./.env.productionset +aThe file name and the flags are the Vercel CLI’s. Check Vercel’s documentation for the exact form in
your version of the CLI. Do not commit .env.production.
Run a dry run from the project folder. It builds nothing and uploads nothing:
leaf deploy --dry-runCheck the framework, the build command, and the absolute output directory. If the output directory is
wrong, correct it with dir in leaf.toml or with --dir at deploy time.
Step 2: Create the site and deploy
Section titled “Step 2: Create the site and deploy”leaf sites create my-appAdd a leaf.toml file in the project root. For a single-page app with client-side routing, include the
not_found line:
site = "my-app"not_found = "spa:index.html"Deploy:
leaf deployIf the project is already built, or you have a folder of built files, deploy that folder and skip the build:
leaf deploy --no-build --dir distStep 3: Check the site
Section titled “Step 3: Check the site”Open https://my-app.leafcloud.app and check these:
- The home page loads.
- A client-side route, such as
/settings, loads the app and does not show a 404. - A missing file, such as
/no-such-file.png, returns a 404. - A folder with an
index.htmlfile, such as/about, redirects to/about/.
Check the deploy history:
leaf deploys --site my-appStep 4: Deploy the other projects
Section titled “Step 4: Deploy the other projects”Each project folder needs its own leaf.toml with its site name. Run a loop over the folders in a
shell script:
for dir in ~/projects/static-sites/*/; do (cd "$dir" && leaf deploy --yes --json) || echo "failed: $dir"done--yes trusts each project’s build and install scripts. Only run this on code you trust. Run it from a
machine that has a LEAF_TOKEN or a saved login.
Two default limits matter here: 5 sites per account and 100 deploys per day. See Limits that apply.
Next.js static export
Section titled “Next.js static export”Static export needs three settings in next.config.ts:
const nextConfig: NextConfig = { output: "export", images: { unoptimized: true }, trailingSlash: true,};output: "export"writes static files instead of a server build.images: { unoptimized: true }makesnext/imagewrite plain<img>tags. Vercel’s image optimization service is not part of LeafCloud.trailingSlash: truewrites each page asabout/index.html. LeafCloud serves that at/about/and redirects/aboutto/about/. Without it, Next.js writesabout.html, which only answers at/about.html; a visit to/aboutreturns 404.
The CLI refuses a static export that still needs a server. The full list is in
Troubleshooting. It includes API routes under
app/api or pages/api, middleware, getServerSideProps, server actions, dynamic = "force-dynamic", revalidate, and next/image without images.unoptimized: true. Move those into an
app (Path 2) or remove them. See Next.js.
Path 2: an app that needs a server
Section titled “Path 2: an app that needs a server”App hosting is an invite-only beta. Our team creates the server, its domain and certificate, its
backups and the app’s compose file, and registers the app against your account. You build an image,
push it to a registry, and deploy a tag with leaf app.
What we need from you
Section titled “What we need from you”Send these with your access request:
- The app name, such as
my-app. It is a lowercase letter, then 1 to 38 lowercase letters, digits or dashes. - The domain the app should answer on.
- The port your container listens on, and a health URL that returns
2xxwhen the app is ready. - The registry and image name, such as
ghcr.io/acme/my-app. For a private registry, a read-only pull token. - The environment variables the app needs, including
DATABASE_URL. Keep secrets out of the repository and send them through the channel you used for the request.
Step 1: Build an image for a server
Section titled “Step 1: Build an image for a server”For Next.js, set standalone output in next.config.ts:
const nextConfig: NextConfig = { output: "standalone",};Add a Dockerfile that copies the standalone server and the static files it serves:
FROM node:22-alpine AS buildWORKDIR /appCOPY package.json package-lock.json ./RUN npm ciCOPY . .RUN npm run build
FROM node:22-alpineWORKDIR /appENV NODE_ENV=productionENV PORT=3000ENV HOSTNAME=0.0.0.0COPY --from=build /app/.next/standalone ./COPY --from=build /app/.next/static ./.next/staticCOPY --from=build /app/public ./publicEXPOSE 3000CMD ["node", "server.js"]This example uses npm. Change the install and build commands if the project uses pnpm, yarn or Bun.
Remove the public line if the project has no public/ folder. Add a .dockerignore file with
node_modules, .next and .git.
The image must listen on the port we configure and answer the health URL. The server runs the image as
it is: it does not build anything, read vercel.json, or apply Vercel’s project settings.
Step 2: Push the image
Section titled “Step 2: Push the image”IMAGE="ghcr.io/acme/my-app"docker build --platform linux/amd64 -t "$IMAGE:$(git rev-parse --short HEAD)" .docker push "$IMAGE:$(git rev-parse --short HEAD)"App servers are x86-64 (linux/amd64). --platform linux/amd64 matters when you build on an Apple
Silicon Mac or another ARM machine: without it the image is built for ARM and does not start on the
server. On an x86-64 machine or a GitHub Actions ubuntu-latest runner the flag changes nothing.
The server pulls the image itself. A public GHCR image needs no credentials; a private one needs the read-only token above. Check your registry’s documentation for that token’s scope.
Step 3: Deploy the tag
Section titled “Step 3: Deploy the tag”leaf app deploy my-app <tag> --wait--wait prints the result and exits 0 only when the deploy succeeded. It waits up to 55 minutes, then
exits with status 5; the deploy may still finish. The server pulls the image, starts it, probes the
health URL, and rolls back to the previous tag if the check fails.
Without --wait, the command returns as soon as the deploy is queued. Follow it with:
leaf app deploys my-appleaf app deploy-log my-app <deploy-id>A tag is 1 to 128 letters, digits, dots, dashes or underscores. It cannot start with a dash or a dot,
and the word rollback is reserved. Use the commit SHA as the tag, as in the example.
One deploy runs at a time for each app. An account may request 30 deploys or rollbacks an hour.
Step 4: Roll back
Section titled “Step 4: Roll back”leaf app rollback my-app --waitThe server keeps the current tag and the previous tag. A rollback switches to the previous one; a second rollback switches back. When there is no previous tag, the command fails.
From GitHub Actions
Section titled “From GitHub Actions”Replace Vercel’s Git integration with a workflow that pushes the image and deploys its tag. Create a
key with the apps scope. A deploy key, the static-site key, cannot deploy an app:
leaf keys create --name github-deploy --can apps --expires 90dStore the secret as LEAF_TOKEN in the repository’s Actions secrets, then add
.github/workflows/deploy.yml:
name: deployon: push: branches: [main]permissions: contents: read packages: writejobs: deploy: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - name: Build and push the image (tag = commit SHA) run: | IMAGE="ghcr.io/${GITHUB_REPOSITORY,,}" docker build --platform linux/amd64 -t "$IMAGE:$GITHUB_SHA" . docker push "$IMAGE:$GITHUB_SHA" - name: Install the leaf CLI run: | curl -fsSL https://leafcloud.in/install.sh | sh echo "$HOME/.local/bin" >> "$GITHUB_PATH" - name: Deploy env: LEAF_TOKEN: ${{ secrets.LEAF_TOKEN }} run: leaf app deploy my-app ${{ github.sha }} --waitThe job fails unless the deploy succeeds. For a staging app, use the same workflow with that app’s name and domain, and a different branch or tag.
Path 3: Vercel Postgres
Section titled “Path 3: Vercel Postgres”Keep the Vercel database running until the last step.
Step 1: Dump the Vercel database
Section titled “Step 1: Dump the Vercel database”Use the non-pooling connection string:
pg_dump --no-owner --no-acl -Fc "$POSTGRES_URL_NON_POOLING" -f vercel.dumpPOSTGRES_URL_NON_POOLING is the direct connection. Vercel’s pooled POSTGRES_URL goes through
PgBouncer in transaction mode, which does not keep the session that pg_dump needs for one consistent
snapshot; a dump through it can fail or miss rows. Recent Neon integrations name the direct variable
DATABASE_URL_UNPOOLED. Check Vercel’s documentation for the variable names in your project.
Use a pg_dump at least as new as the source server. pg_dump --version must be the same or a later
major version than the Vercel database; an older client refuses a newer server. A dump is a snapshot:
take the last one when writes can stop, or copy the rows written after it.
Step 2: Create the LeafCloud database
Section titled “Step 2: Create the LeafCloud database”List the plans, then create the database in a city near you. --allow restricts connections to your
address. The command replaces the whole allowlist when you pass addresses.
leaf db plans --engine postgresleaf db create --engine postgres --engine-version 17 --plan <plan> --city blr \ --name shop --allow 203.0.113.10/32--city is del or blr. Use --engine-version to match the Vercel database’s major version, which
its settings show. Wait until it is running:
leaf db info shopIf your address changes, replace the allowlist, or connections are refused:
leaf db allow shop 198.51.100.7/32Step 3: Restore
Section titled “Step 3: Restore”Get the connection URL. On a terminal, leaf db url refuses to print the password unless you pass
--show; capture it in a variable instead:
export LEAF_DB_URL="$(leaf db url shop)"pg_restore --no-owner --no-acl -d "$LEAF_DB_URL" vercel.dump--no-owner --no-acl drops the Vercel database’s roles from the restore; the tables are owned by
leaf_admin instead. The URL ends in ?sslmode=verify-full&sslrootcert=system, which needs libpq 16
or newer. On an older client, replace sslrootcert=system with your operating system’s CA bundle, for
example /etc/ssl/certs/ca-certificates.crt on Debian or Ubuntu.
If the dump creates an extension LeafCloud does not offer, pg_restore reports that statement and
continues. Read its errors and its exit status; a non-zero status with only extension errors still
leaves the rest of the data in place. Create an extension you need, or remove its CREATE EXTENSION
line from a plain-text dump.
Step 4: Verify
Section titled “Step 4: Verify”Compare the schema, a few row counts and the sequences with the Vercel database:
psql "$LEAF_DB_URL" -c '\dt'psql "$LEAF_DB_URL" -c "select schemaname, relname, n_live_tup from pg_stat_user_tables order by n_live_tup desc;"psql "$LEAF_DB_URL" -c "select count(*) from public.<table>;"n_live_tup is an estimate from the table statistics. Use count(*) for the tables that matter, and
check that the next id continues above the highest existing one. Run the same queries against the
Vercel database before the switch.
Step 5: Switch DATABASE_URL
Section titled “Step 5: Switch DATABASE_URL”For a Next.js app or a Node app on LeafCloud, the environment is set on the server by our team. Send the new URL through the channel you used for the request; do not put it in the repository. For a local test, set it in your untracked environment file and run the app.
Keep two differences in mind:
- Do not pass the dashboard URL with
sslrootcert=systemto Node’spg. It reads that value as a file name. Usesslmode=verify-fulland Node’s own trust store, or pass the CA bundle explicitly. The details are in Connect to a database. - A static site cannot read a database at runtime. Only the build can use it, and it runs on your machine.
When the app has run on the new database for as long as you choose, delete the Vercel store and remove its variables from the Vercel project. Until then, keep both.
Move your domain
Section titled “Move your domain”Your sites live at <name>.leafcloud.app. Update links, sitemaps and OAuth redirect URLs that point to
*.vercel.app.
To keep your own domain, follow this order. The domain keeps answering while you go through it.
-
Deploy and check the site, as in Path 1.
-
Add the domain to the project. For a bare domain and
www, the command adds both:TerminalTerminal windowbash leaf domains add shop.example.com --project my-app -
Create the records at the DNS provider that hosts the zone. Add the TXT record
_leafcloud-verify, the CNAME to the site target, and the_acme-challengeCNAME, exactly asleaf domains show shop.example.comprints them.- The domain uses Vercel’s name servers. Open the domain’s DNS records in the Vercel dashboard. If Vercel already created a record for this host, change its target to the LeafCloud target instead of adding a second record with the same name. Vercel’s dashboard labels change; check Vercel’s documentation.
- The domain uses other name servers. Add the same records at that provider.
For the bare domain, the CNAME’s name is the domain itself. Use the provider’s CNAME flattening or ALIAS option. Vercel DNS answers a CNAME at the bare domain; check Vercel’s documentation for how it shows that record.
-
Wait for Live. Run this and do not go on until it exits with
0:TerminalTerminal windowbash leaf domains check shop.example.com --wait -
Remove the domain from the Vercel project only after it is live. In the Vercel dashboard this is Settings → Domains → Remove. Removing it before the LeafCloud domain is live can leave the host with no working site.
-
Check the domain in a browser and with
leaf domains show shop.example.com.
Removing the domain from the Vercel project is not a DNS change. Confirm the records you added are still in place, and keep the Vercel project and its deployments until your checks pass.
For the records and the states, see Records to add and Status and checks.
Roll back
Section titled “Roll back”To go back to the deploy before the current one:
leaf rollback --site my-appTo go back to a specific deploy, pass its ID from leaf deploys --site my-app:
leaf rollback <deploy_id> --site my-appOnly deploys that LeafCloud keeps can be rollback targets. By default it keeps the last 5 deploys of each site. See Deploy history and rollback.
An app rolls back to its previous tag with leaf app rollback my-app --wait. Only the current and
previous tags are kept.
What does not move
Section titled “What does not move”These Vercel features have no equivalent on a static site:
- Edge Functions, Middleware, API routes and server actions. They run code on every request. Move them into an app (Path 2) or your own backend, or run the same logic in the browser.
- Incremental Static Regeneration and
revalidate. LeafCloud serves the files from the last deploy. Rebuild and deploy on a schedule, or make the page static. - Vercel Image Optimization. Set
images: { unoptimized: true }and serve the original files, or generate the sizes you need at build time, or use a third-party image service. - Vercel KV, Blob and Edge Config. There is no equivalent on a site. Use a database, an object store you run, or a third-party provider.
- Cron Jobs. LeafCloud has no scheduler. Use a scheduled GitHub Action or another scheduler that calls your app or API.
- Analytics and Speed Insights. Use another analytics service.
- Preview deployments, one URL per push. Use a second site with its own name for staging, or a CI deploy per branch. Each site counts against the account’s site limit.
vercel.jsonredirects, rewrites, headers andcleanUrls. A static site serves exactly the files you upload, andnot_foundis the only fallback. For redirects, write the redirect files at build time (for example a meta refresh page) or move the routing into an app. Response headers are set by LeafCloud, not by a configuration file.- Builds in the cloud.
leaf deployruns the build on your machine or CI runner.
Your own domain moves with the steps in Move your domain.
Limits that apply
Section titled “Limits that apply”These are the default limits for a new account. To raise them, send a request from Settings → Help & feedback in the dashboard.
| Limit | Default |
|---|---|
| Sites per account | 5 |
| Deploys per day | 100. The count resets at midnight UTC. |
| Files per deploy | 5,000 |
| Size of one file | 25 MB |
| Space for kept deploys | 250 MB |
| Deploys kept per site | 5 |
Managed Postgres plans have their own limits. leaf db plans lists each plan’s vCPU, memory, disk and
whether it sleeps when idle.
For pricing and fair use, see Pricing and limits.