Why your app works in preview but breaks when you deploy it
It worked in Bolt, Lovable or Cursor. You hit deploy, and now it's a blank page or a build error. This is one of the most frustrating moments in vibe coding, but it usually comes down to a few causes.
1. Missing environment variables
Your API keys live in a .env file or the tool's secrets panel, and they don't copy over automatically. Add each one in your host's settings. Browser code also needs the right prefix (NEXT_PUBLIC_ or VITE_). Env variable undefined: fix.
2. The production build is stricter
Preview mode lets some type and lint errors slide. A production build doesn't. Run the build command yourself and fix the first error it shows. Vercel build failed: fix.
3. Server and browser render differently
Dates, random numbers or browser-only code can make the server's HTML differ from the browser's. Hydration error: fix.
4. Your live domain isn't allowed
APIs and login providers often only allow your preview URL. Add your real domain to their allowed list. CORS error: fix.
5. Wrong port or address on Replit
Deployed apps need to listen on the port the host gives them. Replit app not reachable: fix.