Advanced: Render Start Commands and Health Checks (Self-Hosting)
For developers self-hosting a copy: what the start command and health check path do on Render.
After a successful build, Render launches the service with a start command and then watches a health check endpoint to decide whether the new version is alive.
The start command
npm startThis runs the project's start script — for Next.js, `next start` — booting the production server produced by the build. The server must listen on the port Render provides in the PORT environment variable.
Build and start are different jobs: the build command runs once per deploy and can be slow; the start command runs every time the service boots and should do nothing but start the server. Do not put migrations or installs in the start command.
The health check path
/api/healthA tiny endpoint that returns HTTP 200 when the app is up. Render uses it for zero-downtime deploys (traffic switches only once the new version is healthy) and to restart an instance that stops answering.
Common startup failures
- Missing environment variable: the app throws on boot because a required value (database URL, secret) is absent. Check the service's Environment tab.
- Crash loop: the process exits immediately and Render restarts it repeatedly. The first stack trace in the logs is the real error.
- Port binding: the server hard-codes a port instead of reading PORT.
Free tier behavior
On Render's free tier, web services spin down after a period without traffic, and the next request triggers a cold start that takes a while. Paid instance types stay always-on.