Replit deployment errors: works in the editor, fails when deployed
Common reasons a Replit app runs in the workspace but fails after you deploy, and how to check each.
The server must be reachable
A deployed web app must listen on an address and port the platform can reach. Bind to 0.0.0.0 rather than localhost or 127.0.0.1, and use the port Replit expects (read it from the PORT environment variable when it is set).
Port config in .replit
If your .replit file has a [[ports]] section, Replit turns off automatic port detection for deployments. Set localPort to the port your server actually listens on and externalPort to 80.
Secrets are configured per deployment
Secrets you use in the workspace need to be available to the deployment too. If the app crashes on start with undefined config values, check the deployment's secrets.
Build and run commands differ from the editor
The editor's Run button and the deployment can use different commands. Make sure the deployment's build and run commands match what actually starts your app.
Storage that does not persist
Writing to the local file system for app data is risky on deployed apps. Use a database or object storage for anything you need to keep.
Read the deployment logs
The deployment logs show the actual crash. Look for the first error after start, not the last line.
Sources
Have a specific error? Try the error explainer or the pre-launch checklist.