Skip to content

Publishing

How a publish becomes a version, how live moves between versions, and how previews and rollbacks work.

On this page

How a publish works

  1. Declare. The client sends each file's path, size and sha256.
  2. Upload. Perafly answers with upload addresses only for files it doesn't have yet; everything else is reused.
  3. Build and finalize. The files are deployed. Source is built by the hosting provider; ready output skips the build. When the deployment is ready, the version is ready and gets its number.
  4. Go live. Live moves to the new version, unless it was a preview or the project publishes manually.

The CLI, Drop, MCP, the built-in agent and Git all use this same flow. If the files are byte for byte the same as the live version, no new version is made and the CLI says No changes.

Versions

Every publish is a version: an unchangeable set of files and configuration. A version moves through created → uploading → uploaded → building → ready; it can also end as failed, canceled or expired (a version left uploading for 24 hours expires). Only a ready version gets a number (v7), its permanent address https://<project>--v7.perafly.app and can go live.

Terminal
perafly versions ls
perafly versions get v7
perafly logs build --version v8   # build log of a failed version

A version that isn't live can be deleted with perafly versions rm <version>; its address stops working. The live version can't be deleted.

Live, promote and rollback

Live is a pointer from the project to one ready version; the project's address and custom domains serve that version. Promoting and rolling back are the same action: the pointer moves and nothing is rebuilt, so it takes effect right away.

Terminal
perafly promote v8     # make v8 live
perafly rollback v7    # back to v7; asks to confirm

Promote and rollback keep working even when a plan limit has paused new builds.

Previews and the publish rule

A preview is a ready version that isn't live. Publish one with --target preview; check it at its version address, then promote it.

Terminal
perafly publish ./dist --target preview
perafly promote v9

Each project has a publish rule. auto (the default) makes every publish live. manual turns every publish into a preview, and going live is always a separate promote. Change it in the project's settings or with perafly projects update --publish-rule manual.

Snapshot and additive

By default a publish is a snapshot: the new version has exactly the files you sent. With --publish-mode additive, paths you didn't send are kept from the live version, which is handy for adding or replacing a few files.

Files that are never published

These never leave your machine and the server rejects them too (path_blocked): .env* (except .env.example), .git/, node_modules/, private keys such as *.pem, *.key and id_rsa, .npmrc, .netrc and .perafly/state.json. Symbolic links are skipped. When you publish source, rules in the folder's .gitignore are applied too (not with --prebuilt).

Paths with .., absolute paths, backslashes, empty segments, duplicates and two paths that differ only by case are rejected. vercel.json and now.json aren't accepted: configuration goes in perafly.jsonc.

perafly publish --dry-run shows what would be uploaded and what is skipped, without uploading anything.

Version size

How many files a version may have, how big one file and the whole version may be depends on your plan; see Pricing. Going over answers with too_many_files, file_too_large or version_too_large, the limit and, when a bigger plan allows it, upgradeTo. Large media that changes often belongs in project storage.

Publishing without an account

Without credentials, POST /v1/publish (and npx perafly publish, Drop) opens a project with no owner. The response returns its project key (pfc_…) once; it can publish, finalize, read versions and promote in that project only. The project serves until 24 hours after its last ready version, can be claimed for 7 more days and is then deleted. It accepts static file types only, up to 1,000 files, 50 MB per file and 100 MB per version.

Claiming moves it into a team: perafly projects claim from the same folder, or the claim link. See Quickstart.

Publishing with the API

Three requests, all on https://api.perafly.com. Send an Idempotency-Key header with POST requests so a retry can't publish twice.

1. Declare the files

Terminal
curl https://api.perafly.com/v1/publish \
  -H "Authorization: Bearer $PERAFLY_TOKEN" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
    "project": "my-site",
    "files": [{ "path": "index.html", "size": 1043, "sha256": "9f86d0…" }]
  }'

The response has the version, an uploads list with an upload address for each missing file, and finalizeUrl. Leave out project to create a new project.

2. Upload the missing files

Terminal
curl -X PUT --data-binary @index.html "<uploads[0].url>"

Upload addresses need no Authorization header and last one hour. The bytes must match the declared size and hash.

3. Finalize

Terminal
curl -X POST "https://api.perafly.com/v1/versions/<version id>/finalize" \
  -H "Authorization: Bearer $PERAFLY_TOKEN"

Finalize waits up to 30 seconds by default (?wait= up to 60). If the version is ready or failed by then you get it back; otherwise the answer is 202 with an operation to follow at GET /v1/operations/{id}. Every endpoint is in the API reference.