DocsBuild and deploy
Deploy commands
Commands that run once for every deployment, before the new version takes traffic. The place for database migrations.
Use with AI
Deploy commands run once for every deployment, after the build and before the new version takes traffic. They are the place for work that has to happen once per release, such as a database migration.
Set them
Section titled “Set them”Open Settings, Deploy commands, write one command per line and save:
npm run migrateThey are used from the next deployment on.
How they run
Section titled “How they run”- Once, not on every replica. They run on a separate, short-lived copy of the new version. That copy takes no traffic and is removed afterwards.
- With your variables. All your environment variables are set, so a command can reach your database.
- In order. The first command that fails stops the rest.
- For up to 15 minutes in total.
If one fails
Section titled “If one fails”The deployment fails and the app that is running is not changed. The deployment page shows the message:
| Message | Meaning |
|---|---|
| A deploy command failed (exit code N) | A command ended with an error. Its output is in the build log |
| The deploy commands did not finish within 15 minutes | They took too long |
| The deploy commands ran out of memory | They need more memory than the size of the app has |
When they run
Section titled “When they run”| Deployment | Deploy commands |
|---|---|
| Git push, manual deploy | Run |
| Restart, redeploy | Run |
| Rollback | Do not run |
| Domain change | Do not run |
What to keep in mind
Section titled “What to keep in mind”- Old code is still running. While a migration runs, the previous version still answers requests. Write migrations that the old code can live with.
- A rollback does not undo them. Rolling back brings back old code, not old data.
- Files they write are not kept. The copy they run on is thrown away. To create files for the app, use a build command.
© 2026 Orbit