Skip to content

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 deploy builds 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.

VercelLeafCloud
A projectA site for files, created with leaf sites create <name>, or an app for a container
Framework preset, build command and output directoryFramework detection, or build and dir in leaf.toml, or --dir on the command line
Environment variables for the buildThe environment of the shell that runs leaf deploy. Variables that start with LEAF_ are removed before the build runs.
Preview deployments, one URL per pushA second site with a fixed name, such as my-app-staging, or one site per branch from CI
Git integration: build and deploy on pushGitHub Actions with LEAF_TOKEN. See CI and API keys.
Instant Rollbackleaf deploys and leaf rollback
vercel.json rewrite or route to index.htmlnot_found = "spa:index.html" in leaf.toml. The page is served with status 200.
Custom 404 pagenot_found = "page:404.html" in leaf.toml. The page is served with status 404.
Other redirects, rewrites and headersNot supported on a static site. See What does not move.
A domain on a projectleaf domains add <domain> --project <site>
Vercel Postgresleaf 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:.

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, getServerSideProps or dynamic = "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:

TerminalTerminal windowbash
leaf login

See 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.

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:

TerminalTerminal windowbash
vercel env pull .env.production --environment=production
set -a
. ./.env.production
set +a

The 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:

TerminalTerminal windowbash
leaf deploy --dry-run

Check 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.

TerminalTerminal windowbash
leaf sites create my-app

Add a leaf.toml file in the project root. For a single-page app with client-side routing, include the not_found line:

leaf.tomltoml
site = "my-app"
not_found = "spa:index.html"

Deploy:

TerminalTerminal windowbash
leaf deploy

If the project is already built, or you have a folder of built files, deploy that folder and skip the build:

TerminalTerminal windowbash
leaf deploy --no-build --dir dist

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.html file, such as /about, redirects to /about/.

Check the deploy history:

TerminalTerminal windowbash
leaf deploys --site my-app

Each project folder needs its own leaf.toml with its site name. Run a loop over the folders in a shell script:

TerminalTerminal windowbash
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.

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 } makes next/image write plain <img> tags. Vercel’s image optimization service is not part of LeafCloud.
  • trailingSlash: true writes each page as about/index.html. LeafCloud serves that at /about/ and redirects /about to /about/. Without it, Next.js writes about.html, which only answers at /about.html; a visit to /about returns 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.

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.

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 2xx when 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.

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 build
WORKDIR /app
COPY package.json package-lock.json ./
RUN npm ci
COPY . .
RUN npm run build
FROM node:22-alpine
WORKDIR /app
ENV NODE_ENV=production
ENV PORT=3000
ENV HOSTNAME=0.0.0.0
COPY --from=build /app/.next/standalone ./
COPY --from=build /app/.next/static ./.next/static
COPY --from=build /app/public ./public
EXPOSE 3000
CMD ["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.

TerminalTerminal windowbash
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.

TerminalTerminal windowbash
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:

TerminalTerminal windowbash
leaf app deploys my-app
leaf 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.

TerminalTerminal windowbash
leaf app rollback my-app --wait

The 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.

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:

TerminalTerminal windowbash
leaf keys create --name github-deploy --can apps --expires 90d

Store the secret as LEAF_TOKEN in the repository’s Actions secrets, then add .github/workflows/deploy.yml:

name: deploy
on:
push:
branches: [main]
permissions:
contents: read
packages: write
jobs:
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 }} --wait

The 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.

Keep the Vercel database running until the last step.

Use the non-pooling connection string:

TerminalTerminal windowbash
pg_dump --no-owner --no-acl -Fc "$POSTGRES_URL_NON_POOLING" -f vercel.dump

POSTGRES_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.

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.

TerminalTerminal windowbash
leaf db plans --engine postgres
leaf 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:

TerminalTerminal windowbash
leaf db info shop

If your address changes, replace the allowlist, or connections are refused:

TerminalTerminal windowbash
leaf db allow shop 198.51.100.7/32

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:

TerminalTerminal windowbash
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.

Compare the schema, a few row counts and the sequences with the Vercel database:

TerminalTerminal windowbash
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.

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=system to Node’s pg. It reads that value as a file name. Use sslmode=verify-full and 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.

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.

  1. Deploy and check the site, as in Path 1.

  2. 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
  3. 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-challenge CNAME, exactly as leaf domains show shop.example.com prints 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.

  4. Wait for Live. Run this and do not go on until it exits with 0:

    TerminalTerminal windowbash
    leaf domains check shop.example.com --wait
  5. 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.

  6. 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.

To go back to the deploy before the current one:

TerminalTerminal windowbash
leaf rollback --site my-app

To go back to a specific deploy, pass its ID from leaf deploys --site my-app:

TerminalTerminal windowbash
leaf rollback <deploy_id> --site my-app

Only 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.

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.json redirects, rewrites, headers and cleanUrls. A static site serves exactly the files you upload, and not_found is 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 deploy runs the build on your machine or CI runner.

Your own domain moves with the steps in Move your domain.

These are the default limits for a new account. To raise them, send a request from Settings → Help & feedback in the dashboard.

LimitDefault
Sites per account5
Deploys per day100. The count resets at midnight UTC.
Files per deploy5,000
Size of one file25 MB
Space for kept deploys250 MB
Deploys kept per site5

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.