Preview deployments and instant rollback, explained
Preview deployments build your site at an isolated URL to test changes safely, while instant rollbacks switch traffic back to a previous live version.
On this page 8 sections
Preview deployments allow you to test changes on a dedicated URL before publishing, while instant rollbacks let you point production traffic back to any prior working build without rebuilding. On thelastapi, every deployment preserves an immutable manifest of its files and is stored by content hash. This means testing a feature never risks the live site, and recovering from an outage takes a single command that switches traffic immediately.
Understanding how preview URLs and rollback mechanisms function behind the scenes helps you ship code faster while keeping downtime near zero.
How preview deployments isolate changes
When you push updates directly to production, any syntax mistake, missing asset, or broken client script immediately affects visitors. A preview deployment avoids this by creating an isolated build at a separate URL.
The preview build compiles your code against your build pipeline and serves it independently of your primary address at <slug>.vibiz.app or your connected domain. This allows you, your teammates, or your AI agents to audit layout changes, test interactive flows, and verify assets before customers ever see them.
Because thelastapi tracks files by cryptographic SHA-1 hashes, preview builds do not re-upload assets that the host already stores. If you change two lines in index.html across an application of several hundred images and scripts, only index.html is transferred. The deployment manifest references the existing hashes for everything else. You get an isolated testing environment without redundant file transfers or bloated upload times.
Creating and promoting a preview build
You can generate a preview build using the CLI, an HTTP call, or through AI agents in Claude and ChatGPT via MCP.
To deploy a preview from your terminal, pass the --preview flag:
# Build and upload the local directory to an isolated preview URL
vibiz deploy --preview
# Or specify a subdirectory
vibiz deploy ./site --previewThe CLI queues the build and outputs the deployment identifier (such as dep_123) along with the preview URL.
Once you confirm the preview looks right, you do not need to push your local files again to release it. Instead, run vibiz promote:
# Rebuild the preview deployment as the production site
vibiz promote dep_123When you promote a preview deployment, it rebuilds as production. Once ready, production traffic points to the new release.
You can also run previews through the HTTP API. Deploying over HTTP requires three steps: checking for missing hashes, uploading unseen files, and submitting the manifest:
# 1. Check which files the host needs
SHA=$(shasum -a 1 index.html | cut -d' ' -f1)
curl https://thelastapi.dev/v1/files/missing \
-H "Authorization: Bearer $VIBIZ_API_KEY" \
-H "content-type: application/json" \
-d "{\"shas\":[\"$SHA\"]}"
# 2. Upload missing file bytes
curl -X PUT https://thelastapi.dev/v1/files/$SHA \
-H "Authorization: Bearer $VIBIZ_API_KEY" \
--data-binary @index.html
# 3. Create the deployment with target set to preview
curl https://thelastapi.dev/v1/projects/prj_123/deployments \
-H "Authorization: Bearer $VIBIZ_API_KEY" \
-H "content-type: application/json" \
-d "{\"target\":\"preview\",\"files\":[{\"path\":\"index.html\",\"sha\":\"$SHA\",\"size\":$(wc -c < index.html)}]}"If you are using Claude or ChatGPT via the remote MCP server at https://thelastapi.dev/mcp, an agent can run previews directly with vibiz_deploy { project_id: "prj_123", target: "preview", path: "." } and promote them with vibiz_promote. Learn more about starting projects from scratch in deploy a static site with one command.
What happens during an instant rollback
A rollback restores a previously working release when an unexpected error slips through to production. With traditional build setups, rolling back often triggers a full rebuild from an older git commit. If dependencies have changed, external repositories fail to resolve, or the build takes several minutes, your site remains broken while you wait.
On thelastapi, production rollbacks avoid this wait:
- Cached production switches are instant. If you roll back to a production build that the hosting layer still keeps active, the edge switches traffic back immediately. There is no build step, no asset re-bundling, and zero downtime.
- Environment variables are preserved. An instant rollback runs with the exact environment variables that the target version was built with. If you added a malformed environment variable that broke the current release, reverting to the earlier production version restores the earlier configuration.
- Older builds rebuild from manifests. Versions do not expire and are never deleted. If you roll back to an older version or a preview deployment that the host no longer keeps in hot cache, the host rebuilds the site from its stored file archive. Rebuilds evaluate using current environment variables.
- Restored state becomes the baseline. What was live stays in your deployment history, so you can switch forward again at any time. Any subsequent edit using
base: "live"builds directly on top of the restored version.
To revert immediately to the previous production deployment, run:
vibiz rollbackTo roll back to a specific earlier deployment, pass its identifier:
vibiz rollback dep_old123From an agent, call vibiz_rollback { project_id: "prj_123", deployment_id: "dep_old123" }. In the browser console, navigate to Deployments ▸ Versions and click Go back to this version.
Rolling back code vs. rolling back your database
It is critical to distinguish between application code rollbacks and state management.
The database is never rolled back by vibiz rollback.
When you trigger a code rollback, only static assets, routes, and serverless functions revert. Your Postgres database remains untouched:
- Existing rows stay intact. Customer sign-ups, payment records, and analytical events written during the broken deployment are not discarded.
- Schema changes persist. Tables, columns, and indexes modified by migrations remain in their current state.
- Compatibility risks. If your previous application version expects a column that was renamed or removed in a newer migration, reverting the application code might cause database queries to fail.
Always design database migrations to be backwards-compatible with the previous version of your code before deploying. If you need a complete backup of both assets and data to inspect offline, see our guide on exporting your code and database.
Inspecting changes with versions and diffs
Before initiating a rollback, you often need to see who deployed the build, what files changed, and where errors were introduced. Every deployment automatically generates an entry in the version history without requiring git.
You can inspect versions from the CLI:
# List all versions, newest first
vibiz versions
# Compare the current live version against the one immediately preceding it
vibiz diff
# Compare a specific version against its predecessor
vibiz diff dep_abc
# Compare two arbitrary versions
vibiz diff dep_old dep_newDiffs compare text files up to 512 KB, showing added, modified, or deleted files along with a unified diff for text and file sizes for binary assets. Up to 100 files and 200 KB of text changes are returned in one call; larger changes set truncated: true and specify omitted paths in note. For a deeper look at inspecting file edits over time, read our walkthrough on website version history.
You can also monitor site health across builds automatically using Mission Control and health checks. Mission Control tests production endpoints, monitors error spikes, and warns you if a recent deploy causes 5xx errors.
Build limits, file sizes, and pricing
The following table summarizes the limits and pricing for building, deploying, and previewing sites on thelastapi hosting:
| Resource or limit | Value | Behavior when reached |
|---|---|---|
| Builds per day | 30 per UTC day per project | Returns 429 rate_limited; resets at midnight UTC |
| Maximum files per deployment | 10,000 files | Upload rejected (400 invalid_request) |
| Maximum file size | 50 MB per file | Upload rejected (400 invalid_request) |
| Chat / MCP upload payload | 300 files, 3 MiB/file, 4 MiB total | Must deploy larger apps using @vibiz/cli |
| Hosting price | $0 (recorded in usage at $0) | Pricing is not decided; hosting is currently uncharged |
| Build history retention | Permanent | Versions stay listed for project lifetime |
The CLI automatically ignores development artifacts and sensitive folders. Files matching .env*, node_modules, .git, .next, dist, .turbo, vibiz.json, and credentials like *.pem or .npmrc are never uploaded.
If you are looking to run projects affordably without juggling separate platform accounts, see the cheapest way to host a website and database for a side project.
Next step
To preview an update right now, run vibiz deploy --preview in your project folder. Inspect the resulting preview link, and when you are satisfied with the changes, run vibiz promote <deployment-id> to push it live.
Frequently asked questions
Does rolling back a deployment affect my Postgres database?
No, rolling back only reverts application code and hosting assets. Tables, rows, and schema migrations remain in their current state, so ensure database modifications remain backwards-compatible with older code versions.
How long are past deployment versions stored?
Deployment versions and their source manifests have no time limit and are preserved for as long as the project exists. If an older build is no longer kept in hot cache by the hosting layer, rolling back simply rebuilds it from the stored manifest.
How many preview and production builds can I run in a day?
Each project can run up to 30 builds per UTC day across preview and production deploys. Exceeding this limit returns a 429 rate_limited error until the daily quota resets.
What happens to environment variables during an instant rollback?
An instant switch to an existing production build uses the exact environment variables that the version was built with. If an older version requires a rebuild from stored files, it builds using the project's current environment variables instead.