Deploying an AI-Built App: From Prototype to Production in 3 Hours

I deployed my first AI-built app and it crashed within 5 minutes. The database connection pool was too small. The error handling was missing. I learned the hard way what deployment looks like when AI wrote 90% of the code. Here is the exact playbook I use now.

How do you prepare an AI-built app for production deployment?

The AI does not think about deployment. It writes code that works on localhost. It assumes infinite database connections, no rate limiting, and no environment variables. My first deploy crashed because the AI hardcoded the database URL. Not in a .env file. In the source code. I had to do an emergency git revert and redeploy. That was my first lesson โ€” never trust AI-generated config.

My checklist before any deploy: remove all hardcoded values, add environment variables, set up error logging, configure rate limiting, and test the database connection pool. Each item is a 5-minute check that saves hours of downtime. I created a deployment checklist file in my repo and run it before every deploy. The AI checks it for me now โ€” I prompt “check this code against my deployment checklist” before I push.

๐Ÿš€

My Deployment Checklist Pre-deploy
10 items, 15 minutes total

Free

Items: 1) No hardcoded secrets. 2) All env vars in .env.example. 3) Database pool size set (min 2, max 10). 4) Rate limiting on public endpoints. 5) Error logging configured (console.error + external service). 6) CORS set correctly. 7) HTTPS enforced. 8) Graceful shutdown handlers. 9) Health check endpoint. 10) Database migrations run automatically.

๐Ÿ”ฅ Controversial take

Most vibe coding tutorials skip deployment entirely. They show you how to build but not how to ship. That is irresponsible. A broken deploy erases the trust you built with users. I lost my first 3 users because the app was down when they tried to sign up. They never came back. Deployment is not optional. If you are learning vibe coding, spend 20% of your time learning deployment. It is more important than perfecting your prompt technique.

Which platform should you deploy your AI-built app on?

I have used Vercel, Railway, and Fly.io. Vercel is the easiest for frontend-heavy apps โ€” it auto-detects Next.js, handles SSL, and deploys from git. But Vercel has a 10-second serverless function timeout and no persistent storage. Railway is better for backend services โ€” it handles databases, cron jobs, and longer-running processes. Fly.io is for when you need more control โ€” custom Dockerfiles, multi-region, and larger compute.

My current setup: Vercel for the Next.js frontend, Railway for the API server and PostgreSQL database. Total cost: $20/mo for Vercel Pro + $5/mo for Railway starter. The AI built the entire deployment pipeline โ€” I prompted “create a Vercel config for my Next.js app and a Railway config for the API server” and it generated both. That saved me 3 hours of reading docs.

Vercel ($20/mo)

Best for Next.js, static sites, frontend-heavy apps. Auto SSL, git deploy, generous free tier.

Railway ($5-20/mo)

Best for API servers, databases, background jobs. Built-in DB hosting, easy scaling.

Fly.io ($10-50/mo)

Best for custom Docker, multi-region, high compute. Most control, steepest learning curve.

Replit ($25/mo)

All-in-one: IDE + deploy. Good for prototypes only. Browser IDE gets slow at scale.

What deployment mistakes does AI code make most often?

Three mistakes consistently. One: no health check endpoint. The AI never generates /health or /ping. Without it, your deployment platform assumes the app is healthy when it is crashing internally. Two: missing graceful shutdown. The AI does not handle SIGTERM. When Railway restarts your app, it drops all active connections. Three: database migrations are fragile. AI assumes the schema is already there. I deployed an app that tried to insert data into a table that did not exist yet.

I now prompt for each of these explicitly: “Add a /health endpoint that returns 200 with status. Add graceful shutdown handling for SIGTERM. Add migration script that runs on startup.” The AI generates all three correctly about 70% of the time. For the other 30%, I debug and fix. The fixes take 10 minutes each. The downtime they prevent is measured in hours.

โšก Copy-Paste: Deploy Check Prompt
Before I deploy, check this code for: hardcoded secrets, missing environment variables, database connection pool settings, graceful shutdown handlers, CORS configuration, rate limiting on public endpoints, and a health check endpoint. List every issue you find, even if it looks minor.
๐Ÿ’ก Coach channel: Run this against your codebase before every deploy. I caught a missing rate limiter on a public endpoint using this โ€” the AI generated an unprotected POST route that anyone could call unlimited times.

References

  1. Deploy your AI app on Vercel step by step
  2. Railway deployment for AI-built apps
  3. Fly.io for AI apps: when you need more control
  4. Vibe coding in production: why enterprise is adopting it
  5. Production readiness checklist for AI-built apps