{"slug": "your-ai-generated-app-works-locally-but-not-when-deployed-6-checks-before-you", "title": "Your AI-generated app works locally but not when deployed: 6 checks before you ship", "summary": "A developer building the Deployka hosting service added a pre-build scan called Deploy Doctor that checks AI-generated projects for common first-deploy blockers, including missing start scripts, hard-coded or 127.0.0.1-bound ports, unlisted environment variables, missing Python dependencies, non-persistent database paths, leaked API keys and Telegram webhook conflicts. The tool targets apps produced by Lovable, Bolt, Cursor and Replit, flagging configuration problems before the build starts.", "body_md": "AI tools like Lovable, Bolt, Cursor and Replit can generate a working app in an afternoon. Then you deploy it and it fails in a way that never showed up on your laptop. The code is rarely the problem. The problem is the gap between \"runs on my machine\" and \"runs in a container on someone else's server\".\n\nHere are the six checks that catch most first-deploy failures. Each one takes a minute, and each one is a real reason a freshly generated project does not start.\n\nA hosting platform needs to know how to start your app. Generated projects often only have a dev script.\n\nFor a Node.js project, check `package.json`:\n\n```\n{\n  \"scripts\": {\n    \"dev\": \"vite\",\n    \"build\": \"vite build\",\n    \"start\": \"node server.js\"\n  }\n}\n```\n\nIf there is no `start` script, many platforms cannot launch the project. A Vite or Create React App result is a static site, so either serve the built folder or deploy it as static files:\n\n```\n\"start\": \"npx serve -s dist -l $PORT\"\n```\n\nFor Python, the equivalent is a clear entry point (`main.py`) and a `requirements.txt`. For Go, Rust or .NET, expect to need a `Dockerfile`, because there is no file the platform can guess a build from.\n\nOn your laptop, `localhost:3000` is fine. In a container, the platform tells you the port through an environment variable, and the app must listen on all interfaces, not only on `127.0.0.1`.\n\n``` js\n// Node / Express\nconst port = process.env.PORT || 3000;\napp.listen(port, \"0.0.0.0\");\n# FastAPI\n# uvicorn main:app --host 0.0.0.0 --port ${PORT:-8000}\n```\n\nA hard-coded port, or a server bound to `127.0.0.1`, looks perfectly healthy in the logs and is unreachable from outside.\n\nGenerated code reads secrets from the environment, and your local `.env` file is not shipped with the project (and should not be). List every variable the code reads:\n\n```\ngrep -rnE \"process\\.env\\.[A-Z_]+|os\\.environ(\\.get)?\\(|os\\.getenv\\(\" --include=*.js --include=*.ts --include=*.py .\n```\n\nTwo traps are worth knowing:\n\n`VITE_` reach the browser, and they are baked in at build time. If the value is missing during the build, the deployed site shows `undefined` and no error appears anywhere.\nAI-generated Python code regularly imports packages that never made it into `requirements.txt`, because the tool installed them in your session. Test in a clean environment before uploading:\n\n```\npython -m venv /tmp/check && . /tmp/check/bin/activate\npip install -r requirements.txt\npython main.py\n```\n\nFor Node, run `npm ci` in a fresh clone. If it fails or the app crashes on a missing module, the deploy would have failed the same way.\n\nContainer filesystems are disposable. A SQLite file written to a relative path next to your code can disappear on the next redeploy, and an empty database can silently replace the real one. Put persistent data in the directory your platform keeps across restarts (on Deployka that is `/data`), and make the path configurable:\n\n``` python\nimport os\nDB_PATH = os.environ.get(\"DB_PATH\", \"/data/app.db\")\n```\n\nAI tools sometimes hard-code a key to make the demo work. Search before you zip or push:\n\n```\ngrep -rnE \"sk-[A-Za-z0-9]{20,}|BOT_TOKEN\\s*=\\s*['\\\"]|api[_-]?key\\s*=\\s*['\\\"]\" .\n```\n\nIf a key was ever committed, rotate it. Deleting it from the latest commit does not remove it from the history.\n\nIf a webhook is set for your bot and your code starts long polling, Telegram answers with a conflict error. Either remove the webhook (`deleteWebhook`) or use webhooks consistently. This is one of the most common \"my bot does nothing after deploy\" causes.\n\nRunning these by hand is fine once. Doing it for every project gets old. That is why I added a pre-build scan, **Deploy Doctor**, to [Deployka](https://deployka.dev), the hosting service I build for Telegram bots, web apps, APIs and AI projects. It looks at your project for the usual blockers (missing environment variables, a missing start command, configuration problems) before the build starts, and it is made with projects from Lovable, Bolt, Cursor and Replit in mind. The scan is free.\n\nIf you want to try a deploy without paying, there is a free plan with no card required (128 MB RAM, one project; check the site for current limits). You can upload a ZIP or connect a GitHub repository, add your secrets, and read the logs from the dashboard. Whichever platform you use, the six checks above are worth the minute.\n\nWhat is the most confusing deploy failure an AI-generated project gave you? I am collecting these for the next checks.", "url": "https://wpnews.pro/news/your-ai-generated-app-works-locally-but-not-when-deployed-6-checks-before-you", "canonical_source": "https://dev.to/leshan/your-ai-generated-app-works-locally-but-not-when-deployed-6-checks-before-you-ship-501i", "published_at": "2026-10-18 21:43:19+00:00", "updated_at": "2026-10-18 21:48:43.496881+00:00", "lang": "en", "topics": ["ai-tools", "developer-tools", "ai-agents"], "entities": ["Deployka", "Deploy Doctor", "Lovable", "Bolt", "Cursor", "Replit", "Telegram"], "also_reported_by": [], "alternates": {"html": "https://wpnews.pro/news/your-ai-generated-app-works-locally-but-not-when-deployed-6-checks-before-you", "markdown": "https://wpnews.pro/news/your-ai-generated-app-works-locally-but-not-when-deployed-6-checks-before-you.md", "text": "https://wpnews.pro/news/your-ai-generated-app-works-locally-but-not-when-deployed-6-checks-before-you.txt", "jsonld": "https://wpnews.pro/news/your-ai-generated-app-works-locally-but-not-when-deployed-6-checks-before-you.jsonld"}}