Skip to content

Deploy a site

The leaf deploy command detects your framework, runs your project build, hashes generated assets, and deploys them to LeafCloud edge locations.

Run leaf deploy from your project’s root folder:

Terminal window
leaf deploy

What happens during a deploy:

  1. Framework detection: leaf inspects your project files (package.json, configuration files, and lockfiles) to detect your static site framework and package manager.
  2. Site build: If a build command is required, leaf executes the command (for example bun run build or npm run build), ensuring your local node_modules/.bin tools are in the execution path.
  3. Asset hashing: The contents of your output directory are scanned and hashed using SHA-256.
  4. Differential upload: Only new or changed files are uploaded. Identical files from previous deployments are reused instantly.
  5. Instant activation: Once uploads complete, the new deployment is finalized and made live on Indian edge locations.

The --dry-run flag tests framework detection, executes the build command, and hashes output files without authenticating or uploading anything:

Terminal window
leaf deploy --dry-run

Output:

Framework: Astro
Package manager: npm
Build command: npm run build
Output directory: dist
Files: 3
Total size: 1716 bytes
Dry run: nothing was uploaded.

With --json, --dry-run returns structured metadata:

Terminal window
leaf deploy --dry-run --json
{
"schema": 1,
"type": "dry_run",
"data": {
"framework": "Astro",
"package_manager": "npm",
"build": ["npm", "run", "build"],
"output_dir": "dist",
"files": 3,
"bytes": 1716
}
}

Because --dry-run makes zero network requests and does not check for credentials, it is safe to use in local validation, pre-commit hooks, and CI checks.

Deploy scans the exact files in its upload manifest for private-key blocks (in the first 1 MB of each file) and credential filenames. A matching file refuses the whole deploy; remove it from the output folder. The CLI has an explicit --allow-secrets override for files you are certain are meant to be public. MCP deploys never expose this override.

If you have already built your project or want to deploy pre-rendered static assets directly, pass --no-build:

Terminal window
leaf deploy --no-build

leaf will skip running the build command and immediately inspect the output folder.

To deploy a specific folder instead of letting leaf auto-detect your framework output folder, use --dir or provide the path as a positional argument:

Terminal window
# Using the --dir flag
leaf deploy --dir dist
# Or using a positional path
leaf deploy dist

Note: You cannot specify both a positional path and --dir. Use one or the other.

In CI/CD environments or scripts, pass --yes to suppress interactive prompts and --json for machine-readable output:

Terminal window
leaf deploy --yes --json