Deploy Vibe Coded Apps
Your AI-built prototype works on localhost or in a builder's preview. This guide turns it into a production web app that keeps its data, keeps its secrets, survives real traffic and doesn't surprise you with the bill.
- โ Pre-flightFix the 12 things that break between localhost and live
- ๐ค๏ธDeployFollow the path for the tool that built your app
- ๐ธPick hostingChoose free, managed or flat-rate for your traffic
"Localhost to Live" pre-flight checklist
Twelve checks that catch the problems AI-built apps most often hit in production. Open any item to see why it fails and copy a prompt that fixes it. Your progress is saved in this browser.
Secrets & .env
Why it fails in production: AI agents happily create a .env file and then commit it, or paste a key straight into a config file. Bots scan public GitHub for keys within minutes of a push, and deleting the file in a later commit does not remove it from the history.
Explore the repository first and show me a short plan before you edit anything. Audit this repository for leaked secrets. 1) Make sure .env, .env.local and any other env files are listed in .gitignore. 2) Search every tracked file and the full git history (git log -p) for API keys, tokens, passwords, database URLs and private keys. 3) For every secret you find, move it to an environment variable, list the variable name (never the value) in a .env.example file, and tell me which keys I must rotate because they were already committed. Do not print any secret values in your reply.
Why it fails in production: Anything prefixed with VITE_, NEXT_PUBLIC_, REACT_APP_ or PUBLIC_ is baked into the JavaScript every visitor downloads. In a prototype it is common for the OpenAI key, Stripe secret key or Supabase service_role key to sit right there, ready for anyone to open DevTools and copy.
Explore the repository first and show me a short plan before you edit anything. Find every environment variable that is exposed to the browser (prefixes like VITE_, NEXT_PUBLIC_, REACT_APP_, PUBLIC_, or anything imported into client components). For each one, tell me whether it is safe to be public. Move any secret ones (LLM API keys, Stripe secret keys, Supabase service_role key, database URLs) behind a server-side API route or edge function, and update the client to call that route instead. Show me the list of variables before and after.
Why it fails in production: Your local .env is not uploaded when you deploy. A missing variable usually doesn't crash at startup: it shows up later as "undefined" in a URL, a blank page, or an auth error that only happens in production.
Explore the repository first and show me a short plan before you edit anything. Create a single config module that reads every environment variable this app uses, validates them at startup (use zod for TypeScript or pydantic-settings for Python), and throws a clear error naming any missing variable. Replace scattered process.env / os.environ reads with this module. Then generate a .env.example with every variable name, a one-line comment on what it is for, and whether it is public or secret.
Database & Storage
Why it fails in production: Serverless and container hosts throw away their filesystem on every deploy or restart, so a SQLite file or db.json silently resets to empty. Prototypes built in AI sandboxes often keep data in localStorage or memory, which means every user sees only their own browser's data.
Explore the repository first and show me a short plan before you edit anything. Tell me where this app stores data today (SQLite file, JSON files, in-memory arrays, localStorage, or a hosted database). If it is anything other than a hosted database, migrate it to Postgres (Supabase or Neon) using the ORM already in the project, or Prisma/Drizzle for TypeScript and SQLAlchemy plus Alembic for Python if there is none. Create migration files rather than syncing the schema at runtime, read the connection string from DATABASE_URL, and add a seed script for local development.
Why it fails in production: This is the most common serious hole in vibe coded apps. With Supabase or Firebase the browser talks to the database directly, so if Row Level Security or security rules are off, anyone with your public anon key can read or delete every row, including other users' data.
Explore the repository first and show me a short plan before you edit anything. List every database table and storage bucket in this project and whether Row Level Security (or equivalent security rules) is enabled. Enable RLS on all of them. Write policies so that users can only select, insert, update and delete their own rows (matching auth.uid() to an owner column); public read-only data gets an explicit read-only policy. Then write a short test script that signs in as user A and proves it cannot read or modify user B's rows.
Why it fails in production: An upload saved to ./uploads works on your laptop and then vanishes on the next deploy, or never appears on the second server instance. Without limits, one user can also fill your storage with a 2 GB video.
Explore the repository first and show me a short plan before you edit anything. Find every place this app writes user files (uploads, generated images, PDFs, exports) to the local filesystem. Move them to object storage (Supabase Storage, Cloudflare R2 or S3, whichever fits the existing stack) using signed upload URLs so files never pass through my server. Enforce a maximum file size and an allowlist of MIME types on the server, make buckets private by default, and serve private files through short-lived signed URLs.
URLs & CORS
Why it fails in production: fetch("http://localhost:3000/api") works perfectly until the first real visitor, whose browser tries to call their own computer. Links in emails, sitemaps and Open Graph tags break the same way when they point at a *.lovable.app or *.vercel.app preview URL.
Explore the repository first and show me a short plan before you edit anything. Search the whole codebase for hardcoded URLs: localhost, 127.0.0.1, 0.0.0.0, port numbers, and preview domains like *.lovable.app, *.bolt.new, *.vercel.app, *.netlify.app or *.ngrok.io. Replace them with a SITE_URL (or API_BASE_URL) environment variable, use relative paths for same-origin API calls, and make sure emails, OG tags, sitemaps and canonical links use the production domain. List every file you changed.
Why it fails in production: When the front end can't reach the API, the quickest AI fix is allow_origins=["*"]. That either breaks the moment you send cookies (browsers reject * with credentials) or lets any website make requests to your API on behalf of your users.
Explore the repository first and show me a short plan before you edit anything. Review the CORS configuration of every API and edge function in this project. Replace any wildcard origin with an explicit allowlist read from an ALLOWED_ORIGINS environment variable (production domain, www variant, and localhost only in development). Only enable credentials where cookies are actually used, restrict allowed methods and headers to what the client sends, and make sure preflight OPTIONS requests are handled.
Why it fails in production: Sign-in works in the preview, then fails on your domain with "redirect_uri_mismatch", or the magic-link email sends users back to localhost. Stripe and other webhooks keep posting to the old URL, so payments succeed but accounts never upgrade.
Explore the repository first and show me a short plan before you edit anything. List every third-party integration in this app that needs a URL configured outside the code: auth providers (Supabase Auth, Clerk, Auth.js, Firebase), OAuth apps (Google, GitHub, Apple), payment and other webhooks (Stripe, Resend, etc.), and email templates. For each one, tell me exactly which setting to change in which dashboard for the production domain, and update any redirect URLs in code to use the SITE_URL environment variable. Also verify that webhook handlers check the provider's signature.
Security & Rate Limits
Why it fails in production: An unprotected AI endpoint is a free LLM proxy for the internet, and an unprotected sign-up or email form gets scripted within days. Either one can run up a four-figure bill overnight or get your email domain blocklisted.
Explore the repository first and show me a short plan before you edit anything. Add rate limiting to this app. Identify the endpoints that are expensive or abusable: login, sign-up, password reset, anything that calls an LLM or other paid API, anything that sends email or SMS, and file uploads. Apply per-IP and per-user limits (use Upstash Ratelimit, the platform's built-in limiter, or slowapi for FastAPI), return HTTP 429 with a Retry-After header, and add a per-user daily quota for AI calls. Show me the limits you chose and why.
Why it fails in production: Prototypes often protect admin pages by hiding them in the UI, while the API route behind them accepts any request. Anyone can call it with curl, change a user ID in the request body, or send a negative price.
Explore the repository first and show me a short plan before you edit anything. Go through every API route, server action and edge function in this project. For each one: 1) verify the user is authenticated where required, 2) verify they are authorized for the specific resource (they own it or have the right role) using data from the session, never from the request body, 3) validate and parse the input with a schema (zod or pydantic) and reject anything unexpected, and 4) return generic error messages without stack traces. Give me a table of routes with what you added to each.
Why it fails in production: In production nobody reads your console. Without error tracking you find out about a broken checkout from an angry email, and without spend caps you find out about an abused AI key from your bank.
Explore the repository first and show me a short plan before you edit anything. Prepare this app for monitoring in production. 1) Add error tracking (Sentry or the host's built-in equivalent) for both the browser and the server, with source maps uploaded and personal data scrubbed. 2) Add a /health endpoint that checks the database connection. 3) Make sure server errors are logged with a request ID. Then give me a checklist of billing settings to change by hand: monthly budget limits on my LLM provider, spend management on my host, and usage alerts on my database.
Stack-specific deployment paths
Pick the tool that built your app. Each path has four steps, the commands to run and the gotchas that catch people on that stack.
Browser-based builders that generate a Vite + React front end, usually wired to Supabase. Their one-click publish is fine for demos; for a real product, move the code to GitHub so you own the deploy pipeline, the domain and the history.
-
Sync the project to GitHub
Use the builder's GitHub integration so every change lands in a repo you own. Clone it and confirm it builds on your machine, outside the builder.
git clone https://github.com/you/your-app.git cd your-app npm install npm run build && npm run preview
-
Separate dev and production Supabase
Create a second Supabase project for production, enable RLS on every table, and keep only the
anonkey in the front end. Apply the schema with migrations instead of clicking in the dashboard.npx supabase link --project-ref YOUR_PROD_REF npx supabase db push
-
Deploy with an SPA fallback
Import the repo into your host with build command
npm run buildand output folderdist. Add a rewrite so deep links like/dashboarddon't 404 on refresh.# Netlify / Cloudflare Pages echo "/* /index.html 200" > public/_redirects # Vercel: vercel.json { "rewrites": [{ "source": "/(.*)", "destination": "/index.html" }] } -
Point your domain and update auth URLs
Add the domain in your host, create the DNS records it shows you, then set the Site URL and redirect URLs in Supabase Auth to the new domain.
Type Name Value A @ <IP from your host> CNAME www <your-project>.netlify.app
โ ๏ธ Bolt.new / Lovable gotchas
- RLS disabled on tables created during prototyping. The anon key is public, so these tables are effectively public too.
- Supabase free projects pause after about a week without activity. A launch page nobody visits will go dark.
- Preview-only features: builder-specific integrations and edge functions may need to be re-created as Supabase Edge Functions or host functions.
- Two sources of truth: once you edit code locally, re-sync before prompting the builder again or it may overwrite your changes.
Generators that give you components or single-file apps running in a sandbox. The work is mostly turning that output into a real project: install the libraries the sandbox provided, add real persistence, and move any API calls to the server.
-
Create a real project around the code
v0 output drops into a Next.js app with the shadcn CLI. For a Claude Artifact or other single-file React app, scaffold a Vite project and paste the component in as
App.tsx.# v0 โ Next.js npx create-next-app@latest my-app cd my-app && npx shadcn@latest add "<v0 component URL>" # Artifact โ Vite + React npm create vite@latest my-app -- --template react-ts
-
Install what the sandbox gave you for free
Sandboxes ship common libraries preinstalled. Install every import yourself and set up Tailwind if the classes stop applying.
npm install lucide-react recharts npm install -D tailwindcss @tailwindcss/vite
-
Replace mock data and client-side API calls
Swap hardcoded arrays, in-memory state and sandbox storage for a real database, and move any calls to paid APIs into a server route so the key never reaches the browser.
# Next.js: app/api/chat/route.ts holds the key # Vite: add a serverless function, e.g. functions/api/chat.ts
-
Deploy and connect a domain
Deploy from GitHub for automatic preview URLs on every branch, or from the CLI for a quick first launch.
npx vercel --prod # or for a static Vite build npm run build && npx wrangler pages deploy dist
โ ๏ธ v0 / Claude Artifacts gotchas
- Sandbox-only APIs (artifact storage, built-in model calls) don't exist outside the sandbox. Search for them and replace each one.
- "use client" boundaries: v0 components that use hooks need the directive in Next.js App Router, or the build fails.
- Fake data that looks real: generated dashboards often compute stats from hardcoded arrays. Check every number is wired to real data.
- Fonts and images loaded from the sandbox or placeholder services need to be self-hosted or replaced.
Coding agents that work on a full repository with any framework: terminal and cloud agents like Claude Code, OpenAI Codex and Meta's Muse Code, and agent-first IDEs like Google Antigravity, Cursor and Windsurf. You already own the code, so the job is to prove the production build works, then choose the host that matches how the app runs: serverless functions or a long-running server.
-
Run the production build locally
Dev servers hide type errors, missing env vars and SSR crashes. Build and start in production mode, and pin your Node version so the host uses the same one.
npm run build && npm start node -v > .nvmrc
-
Choose serverless or a long-running server
WebSockets, background jobs, cron, queues or a local SQLite file all need a long-running server. Plain request/response apps fit serverless.
# Long-running server, from a Dockerfile fly launch # Fly.io railway up # Railway
-
Set env vars and run migrations on deploy
Add every variable from
.env.examplein the host dashboard, then run migrations as a release step so the schema matches the code.npx vercel env add DATABASE_URL production npx prisma migrate deploy # or: npx drizzle-kit migrate
-
Add the domain and check HTTPS
Point DNS at the host, wait for the certificate, then check that both the apex and
wwwredirect to one canonical URL.dig +short yourapp.com curl -sI https://www.yourapp.com | head -n 3
โ ๏ธ Claude Code / Codex / Antigravity gotchas
- SQLite on serverless resets on every deploy. Use hosted Postgres or Turso, or deploy to a server with a persistent volume.
- Function timeouts: long AI calls, PDF generation and scraping hit serverless limits (often 10โ60 s). Move them to a queue or stream the response.
- Agent-generated scripts like
db:resetorprisma db push --force-resetmust never run against production. - Node or package manager mismatch: commit the lockfile and set
enginesin package.json. - Parallel agents, one production: Codex cloud tasks, Antigravity's Agent Manager and Muse Code subagents each work on their own branch or worktree. Review and merge to
mainbefore deploying, and let preview deploys cover the rest.
Python backends (FastAPI, Flask, Django) that AI tools generate for APIs, AI agents and data apps. They need a long-running server with a production ASGI/WSGI server, pinned dependencies and a real database.
-
Pin dependencies
Unpinned requirements install different versions in production than on your laptop. Lock them with uv or pip.
uv lock # with uv pip freeze > requirements.txt # with pip
-
Run a production server on $PORT
Bind to
0.0.0.0, read the port from the environment, drop--reloadand run more than one worker.uvicorn app.main:app --host 0.0.0.0 --port $PORT --workers 2 # or gunicorn app.main:app -k uvicorn.workers.UvicornWorker -w 2 -b 0.0.0.0:$PORT
-
Containerize and deploy
A small Dockerfile runs the same on Render, Railway, Fly.io or your own VPS.
FROM python:3.13-slim WORKDIR /app COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt COPY . . CMD ["sh", "-c", "uvicorn app.main:app --host 0.0.0.0 --port ${PORT:-8000}"] -
Migrate, set CORS, add the domain
Run Alembic migrations on release, set
allow_originsto your front end's domain, and point anapi.subdomain at the service.alembic upgrade head # DNS CNAME api <your-service>.onrender.com
โ ๏ธ Python / FastAPI gotchas
- Binding to 127.0.0.1 makes the app unreachable inside a container, so the health check fails and the deploy is marked as crashed.
- Blocking calls in async routes (requests, sync DB drivers, time.sleep) freeze every request on that worker. Use httpx and async drivers, or plain def routes.
- Free tiers sleep: the first request after idle can take 30โ60 seconds, long enough for the front end to time out.
- allow_origins=["*"] with allow_credentials=True is rejected by browsers, so cookie auth breaks only in production.
Free vs. flat-rate hosting matrix
Where vibe coded web apps usually end up, what you get for free and what bites later.
| Platform | Free tier | Paid from | Billing model | Watch out for |
|---|---|---|---|---|
| Vercel | Hobby plan, non-commercial use only | Pro $20/user/mo + usage | Usage-based | Commercial apps need Pro. Image optimization and function time are metered. |
| Netlify | Free plan with monthly usage limits | Pro ~$19/member/mo | Credits / usage | Bandwidth and build minutes add up; free sites pause when limits run out. |
| Cloudflare Pages & Workers | Static hosting with unmetered bandwidth | Workers Paid $5/mo | Requests + CPU time | Workers aren't full Node.js; some npm packages need changes. |
| Render | Free web services that sleep when idle | Starter $7/mo per service | Flat per instance | Free services spin down after ~15 min idle; free Postgres expires. |
| Railway | One-time trial credit | Hobby $5/mo incl. $5 usage | Usage (CPU + RAM) | Idle services still bill for the memory they hold. |
| Fly.io | Pay as you go | A few $ per small machine | Usage per machine | Machines and volumes left running in extra regions keep billing. |
| Supabase | 2 free projects | Pro $25/mo per org | Flat + usage | Free projects pause after ~1 week idle; compute add-ons cost extra. |
| VPS + Coolify / Dokploy | n/a (self-hosted, open source) | ~$5โ12/mo (Hetzner, DigitalOcean) | Flat rate | You own updates, backups, security and uptime. |
Approximate list prices in USD as of November 2026. Plans change often, so confirm on each vendor's pricing page before you commit.
Hosting cost estimator
Set your traffic and the kind of app you built to compare monthly bills and see which strategy fits.
Free tiers
Cloudflare Pages, Vercel Hobby, Netlify, Render free, Supabase free
Managed / usage-based
Vercel Pro, Netlify Pro, Render, Railway, Supabase Pro
Flat-rate VPS
Hetzner or DigitalOcean with Coolify or Dokploy
Free tier while it's a side project
Next.js deploys with zero config on Vercel, and small traffic fits inside free limits. If the app makes money, budget $20/mo for Vercel Pro from day one.
- The Hobby plan doesn't allow commercial use.
- Serverless functions time out (10โ60 s by default), so long AI calls or PDF generation fail only in production.
Rough monthly estimates for one app, excluding your domain (~$10โ15/year). "Outgrown" means free limits, sleep or commercial-use rules make that option a poor fit at this traffic. Real bills depend on page weight, caching and how chatty your app is with its database.
After you launch
Deploying is the start. Keep the habits that got you here: small changes, one at a time, committed when they work.