Deployments fail. A typo in an environment variable, a broken API endpoint, a CSS bug that makes the login form unclickable — something always slips through. The difference between a five-minute outage and a five-hour firefight is how fast you can roll back.
PandaStack keeps every deployment's static assets stored and cached. Rolling back is not a rebuild; it is a pointer swap. The CDN starts serving the old version instantly, and users see the working app while you fix the bug locally.
Deploy a Vite + React app
Create a basic Vite app:
npm create vite@latest my-app -- --template react
cd my-app
npm installCommit it to GitHub and create a PandaStack project:
panda projects create \
--name my-app \
--repo github.com/yourname/my-app \
--branch main \
--type static \
--build-cmd "npm run build" \
--output-dir distThe build succeeds, and you get a live URL:
https://my-app-abc123.pandastack.appThe app loads, the React logo spins, and everything works.
Push a broken build
Edit src/App.jsx and introduce a runtime error:
function App() {
const data = null;
return <div>{data.title}</div>; // Crashes: cannot read property 'title' of null
}Commit and deploy:
git commit -am "Add data rendering"
panda projects deploy <project-id>The build succeeds (it is a runtime error, not a build error), and the new version goes live. Open the URL in a browser. The page is blank, and the console shows:
Uncaught TypeError: Cannot read properties of null (reading 'title')Users are now seeing a broken app. You could fix it locally, push a new commit, and wait 30 seconds for the build to complete. Or you could roll back immediately.
Roll back to the last working deployment
List recent deployments:
panda projects list --name my-appOutput:
Deployment ID: 1234 (current) - deployed 2 minutes ago - FAILED
Deployment ID: 1233 - deployed 1 hour ago - SUCCESS
Deployment ID: 1232 - deployed yesterday - SUCCESSThe current deployment (1234) is marked as the live version but is broken. The previous one (1233) is the working build from an hour ago.
Roll back:
panda projects rollback <project-id> --deployment 1233This command takes under 5 seconds. The CDN cache is purged, and the live URL now serves deployment 1233. Refresh the browser — the app works again.
Users who were staring at a blank page now see the working version. You bought yourself time to fix the bug without the pressure of users screaming in Slack.
How rollback works under the hood
PandaStack stores every deployment's static assets separately. Deployment 1233's files are in one directory, deployment 1234's files are in another. The CDN cache points at the "current" deployment's directory.
When you roll back, PandaStack updates the pointer to a different directory and purges the cache. There is no rebuild, no upload, no waiting. The old files are still there, still cached at the edge, and still fast.
This is why static sites on PandaStack have zero-downtime deploys and instant rollbacks. There is no server to restart, no health check to wait for, no rolling update across replicas.
Roll back via the API
Script rollbacks in CI or incident response tools by calling the API directly:
curl -X POST https://api.pandastack.io/v1/projects/$PROJECT_ID/rollback \
-H "Authorization: Bearer $PANDASTACK_TOKEN" \
-H "Content-Type: application/json" \
-d '{"deploymentId": 1233}'This is the same operation as the CLI command, exposed as HTTP. Integrate it into your incident playbook or deploy dashboard.
Fix the bug and deploy the corrected version
Edit src/App.jsx to handle the null case:
function App() {
const data = null;
return <div>{data?.title || 'No data'}</div>;
}Commit and deploy:
git commit -am "Fix null pointer error"
panda projects deploy <project-id>This creates deployment 1235. When the build succeeds, it becomes the new live version, overwriting the rollback. The URL now serves the fixed code.
Deployment 1234 (the broken one) is still stored in case you need to inspect its assets or debug why the error was not caught in testing. You can roll forward to it if you need to reproduce the bug in production.
When rollback does not work
Rollbacks fix broken frontend code — JavaScript errors, CSS bugs, missing assets. They do not fix:
- Backend API changes: If the broken deploy depends on a backend API endpoint that was removed or changed, rolling back the frontend does not restore the endpoint. You need to coordinate frontend and backend rollbacks.
- Database migrations: If the broken deploy ran a migration that changed the schema, rolling back the frontend does not revert the migration. You need a separate migration rollback or schema compatibility layer.
- Environment variable changes: If the broken deploy used a new environment variable that was not set, rolling back the frontend does not restore the old variable. Check the deployment's environment config and match it to the rollback target.
For full-stack rollbacks, version the frontend and backend together (like v2.3.1) and deploy both as a unit. When you roll back, roll back both.
Automate rollback on failed health checks
PandaStack static sites do not have health checks (there is no server to ping), but you can add client-side monitoring and trigger a rollback via the API if error rates spike.
Integrate an error-tracking service (like Sentry) and set up an alert webhook. When the alert fires, call the rollback API:
// Lambda function or edge function triggered by Sentry webhook
const axios = require('axios');
exports.handler = async (event) => {
const { error_rate } = JSON.parse(event.body);
if (error_rate > 5) { // More than 5% of users hitting errors
await axios.post(`https://api.pandastack.io/v1/projects/${PROJECT_ID}/rollback`, {
deploymentId: LAST_KNOWN_GOOD_DEPLOYMENT
}, {
headers: { Authorization: `Bearer ${PANDASTACK_TOKEN}` }
});
console.log('Rolled back due to high error rate');
}
};This is an escape hatch for when you deploy late at night and do not notice the error until hundreds of users have hit it.
Test rollback in staging before you need it in production
Deploy a broken build to a staging environment and practice the rollback flow:
- 1Deploy a working build
- 2Deploy a broken build
- 3Roll back to the working build
- 4Verify the working version is live
If you have never rolled back before and you are doing it for the first time during an incident, you will waste time reading docs and second-guessing commands. Practice in staging so the muscle memory is there when it matters.
Why instant rollback is a competitive advantage
The platforms that do not store old deployments (or make you rebuild them to roll back) add 30–120 seconds of downtime to every bad deploy. If you ship 10 times a day and 5% of deploys have issues, that is 150–600 seconds of user-facing downtime per week.
PandaStack's rollback is under 5 seconds because the old build is already stored and cached. This makes shipping less scary. You can deploy more often, confident that a bad push is a 5-second fix instead of a 5-minute rebuild.
The faster you can recover, the more you can experiment.
References
- [Vite documentation](https://vitejs.dev/guide/)
- [React deployment guide](https://react.dev/learn/start-a-new-react-project)
- [PandaStack deployment rollbacks](https://docs.pandastack.io)