The short answer
Before you deploy, ask your coding agent to go through this list. Most failures on a first deploy come from a handful of things that work on your machine and not on a server. The usual ones: an out-of-date lock file, no start script, a hardcoded port, localhost addresses, missing variables, tables that were never created, files saved to disk and timers inside the app.
Say this to your coding agent
Check this project against the deploy checklist: lock file, start script, PORT, localhost URLs, environment variables, migrations, uploads, SQLite and timers. Fix anything that fails.
The checklist
-
The lock file matches
package.jsonRun
npm installand commitpackage-lock.json. See the lock file error. -
There is a
startscript, and the build passesnpm run buildshould pass on your machine, andpackage.jsonneeds astartscript for a server app. See Express and Next.js. -
The app reads
PORTand listens on0.0.0.0Never a fixed port, never
127.0.0.1. See never started listening. -
There is no
localhostin the codeSearch for
localhostand127.0.0.1. Use relative paths or an environment variable for the API address. -
Every variable the code reads is set
Names in your
.envmust exist online too. See environment variables. -
The database comes from
DATABASE_URLNot a local address and not SQLite. See add a database and SQLite resets.
-
Migrations create the tables
Use a tool Antideploy detects, or run your migration before the app listens. See relation does not exist.
-
Uploads go to a bucket
Nothing important is saved to the app's disk. See file uploads.
-
Timers are scheduled jobs
Replace
node-cronandsetIntervalwith a route and a scheduled job. See scheduled jobs. -
Secrets are not in the code
No keys in files you commit, and none in
NEXT_PUBLIC_orVITE_variables. Keep.envout of Git.
For Python projects
- Every import is in
requirements.txt, including the server:gunicornfor Flask and Django,uvicornfor FastAPI - The Python version is pinned in
.python-versionif your packages need a specific one - Django lists your address in
ALLOWED_HOSTS