Home › Guides › AI-built apps
AI-built apps

How to Productionize an App Built with ChatGPT, Claude, Cursor or Lovable: The Complete Guide

Short answer

To productionize an app built with AI, put the code in your own Git repository, make the build reproducible, move secrets to environment variables, enforce authentication and authorisation on the server, protect the database with access rules and tested backups, add tests and a CI/CD pipeline, deploy to staging and production, add monitoring and cost caps, tune performance, and agree a maintenance routine. For mobile apps add signing, store listings, privacy forms and crash reporting. AWI Digital does this for AI-built apps from $100 per hour with a free initial review.

AWI Digital Team Updated 2026-11-25⏱ 8 min read

What 'production-ready' actually means

An AI tool can produce an app that works for you, on your machine, on the happy path. Production means it keeps working for strangers, at unpredictable times, under load, when something fails, and when the person who built it is not looking. That needs six things: a reproducible build, secure data handling, safe deployment, visibility into failures, acceptable speed and cost, and someone responsible for maintenance.

The rest of this guide is a staged checklist. Work through the stages in order; each one makes the next cheaper and safer.

Stage 0: Take stock (one hour)

  • Where does the code live? If it is only inside a builder or a chat, export it to a Git repository you own now.
  • List every service the app touches: database, authentication, file storage, payments, email/SMS, AI APIs, analytics, domain and DNS.
  • Write down who owns each account and where the credentials are. If the answer is 'a freelancer's personal account', fix that first.
  • Note what is broken, slow or scary, and the date you need to launch.

A one-page inventory like this is the most valuable document in the whole project.

Stage 1: Code and repository hygiene

  1. Create a Git repository with a sensible .gitignore (node_modules, .env, build output, local database files).
  2. Add a README that explains how to install, run, test and deploy the app. If you cannot write it, nobody else can run the app either.
  3. Pin dependencies with a lock file and a fixed Node or Python version. Unpinned packages are a common reason an AI-built app 'suddenly' stops building.
  4. Remove dead code and duplicated files that the AI left behind; keep one way of doing each thing.
  5. Scan the repository and its history for secrets (for example with gitleaks). Rotate any key that ever appeared in a chat, a screenshot or a commit.

Stage 2: Environments and configuration

Production needs at least two environments: staging (a safe copy) and production. Both read configuration from environment variables, never from files in the repository.

# .env.example (committed). Real values live in your host's dashboard.
DATABASE_URL=
AUTH_SECRET=
STRIPE_SECRET_KEY=
OPENAI_API_KEY=
PUBLIC_APP_URL=
SENTRY_DSN=

Public front-end variables (for example those prefixed with NEXT_PUBLIC_ or VITE_) are visible to every visitor. Never put a secret key in one. Paid APIs (OpenAI, Anthropic, Stripe secret keys) must be called from your server.

Stage 3: Security

CheckWhy AI-built apps miss itFix
Authorisation on every API routeUI hides buttons; the API trusts the clientCheck the caller and the record owner on the server for every request
Database access rulesRow-level security off or too broad (Supabase/Firebase)Enable and test rules as anonymous and as a normal user
Input validationForms accepted as-isValidate with a schema (Zod, Pydantic) on the server
Rate limiting and spend capsPublic endpoint calls a paid LLMPer-user limits and provider budget alerts
SecretsKeys in the browser bundle or repositoryServer-only variables; rotate exposed keys
DependenciesCopied snippets with old packagesRun the package audit; enable Dependabot or Renovate
Security headers and HTTPSDefaults left onHTTPS only, secure cookies, CSP and standard headers
Prompt injection (AI features)Untrusted text reaches a model that can actLeast privilege, allow-listed tools, human approval for risky actions

Use the production checklist and consider an independent security test before launch.

Stage 4: Data, backups and migrations

  • Use a managed database (Postgres on Neon or Supabase, MongoDB Atlas, managed MySQL) rather than a database file on a server disk that can vanish.
  • Turn on automated daily backups, then practise a restore into a scratch database. A backup you have never restored is a hope, not a backup.
  • Move schema changes into migration files that run in order. Nobody edits the production schema by hand.
  • Plan for personal data: know where it is stored, how to delete it, and which laws apply (GDPR/UK GDPR, state privacy laws, DPDP in India).
# manual backup and restore of a Postgres database
pg_dump "$DATABASE_URL" -Fc -f backup.dump
pg_restore --clean --if-exists -d "$SCRATCH_DATABASE_URL" backup.dump

Stage 5: Tests and a CI/CD pipeline

You do not need a huge test suite on day one. You need a smoke test for the journeys that make money or hold data (sign-up, login, the core action, payment), plus tests for any bug you fix. A pipeline then runs them on every change.

name: CI
on: [push, pull_request]
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with: { node-version: 20, cache: npm }
      - run: npm ci
      - run: npm run lint --if-present
      - run: npm test --if-present
      - run: npm run build

Connect the repository to your host so a merge to main deploys automatically, with preview deployments for pull requests and a one-click rollback.

Stage 6: Hosting and deployment

Your appTypical home
Static site or front end onlyCloudflare Pages, Netlify, Vercel, GitHub Pages
Next.js / server-renderedVercel, Netlify, Cloudflare, Render
API + database + workersRender, Railway, Fly.io, DigitalOcean App Platform
Several services, full controlA VPS (Hetzner, DigitalOcean, Linode) with Docker and Caddy or Nginx

See the hosting guide and our Vercel vs Render vs VPS comparison. Add your domain, confirm HTTPS, and keep the registrar and DNS login in the business owner's name.

Stage 7: Monitoring and alerting

  • Errors: an error tracker such as Sentry on both the front end and the server.
  • Uptime: an external monitor that pings a /health endpoint and alerts a real person.
  • Logs: structured logs you can search, with no passwords or personal data in them.
  • Costs: budget alerts on the cloud account and hard spending limits on AI API accounts.
// minimal Express health check
app.get('/health', async (req, res) => {
  try { await db.query('select 1'); res.json({ ok: true }); }
  catch (e) { res.status(503).json({ ok: false }); }
});

Stage 8: Performance

  1. Measure first: Lighthouse or PageSpeed for the front end; slow-query logs for the database.
  2. Fix the big three: oversized images and scripts, missing database indexes (and N+1 query loops), and no caching.
  3. Server-render or pre-render pages that need to rank on Google and be read by AI crawlers; many AI bots do not run JavaScript.
  4. Put a CDN in front, set cache headers, and load third-party scripts late.

Details: load testing basics.

Stage 9: Cost control for AI features

  • Call the model from the server, cache repeated answers and trim the context you send.
  • Use a smaller, cheaper model for classification and simple tasks; reserve the large model for hard reasoning.
  • Set per-user rate limits and a daily budget so one abusive session cannot drain the account.
  • Log tokens and cost per feature so you can see where the money goes.

Stage 10: Mobile apps (Android and iOS)

  • Create signing keys and store them safely (use Play App Signing on Android). Losing a key can block updates.
  • Move all secrets and paid API calls to a backend; assume anything inside the app package can be extracted.
  • Prepare store assets, a privacy policy URL and the Google Play Data safety and Apple privacy details, answering honestly.
  • If users can create an account, both stores expect an in-app way to delete it.
  • Test on real devices and OS versions, use internal and closed testing tracks and TestFlight, and add crash reporting before release.

See the publishing checklist and the mobile testing checklist.

Stage 11: A maintenance routine

How oftenTask
WeeklyReview error and uptime alerts, check costs, merge dependency updates
MonthlyApply security patches, test a restore from backup, review slow queries and logs, review access lists
QuarterlyUpdate major dependencies and runtime versions, re-run the security checklist, review cloud and AI spend
YearlyRenew domain and certificates (if not automatic), review architecture and plan the roadmap

When to refactor and when to rewrite

Refactor when the data model is sound but the code is messy: split large files, add tests around critical flows, and improve step by step. Rewrite when the data model is wrong, every change breaks something, or the cost of repair exceeds a rebuild. Most AI-built apps should be hardened first; a short review tells you which case you are in.

How AWI Digital helps

We audit, stabilise, secure, deploy, optimise and maintain AI-built web and mobile apps. Start with the free production-readiness checker or the productionization service. Engineering is from $100 per hour (native mobile core work $300 per hour), testing from $20 per hour, and the initial review is free.

Want a second pair of eyes? Free initial review

Send the repo or live URL. We tell you what to fix before launch.

Frequently asked questions

How long does it take to productionize an AI-built app?

Small apps are often stabilised and deployed in a few days to two weeks. Apps with payments, personal data or several user roles take longer.

Can I keep using Cursor, Claude or ChatGPT after the app is in production?

Yes, with guard rails: work in branches, require tests to pass in CI, review diffs, and never give the tool production credentials.

My app works in Lovable or Bolt but fails when I deploy it elsewhere. Why?

Usually missing environment variables, platform-specific services, a different Node or Python version, or a database that was never provisioned. A short audit finds the cause.

What are the biggest security risks in AI-generated code?

Broken access control, exposed secrets, open database rules and missing rate limits.

Do I need a DevOps engineer?

Not full time. A one-off setup of hosting, CI/CD, monitoring and backups, plus light monthly support, is enough for most small apps.

How do I keep AI API costs under control?

Call models from the server, cache and trim prompts, choose the smallest model that works, and set per-user limits and provider budget alerts.

Can you publish my AI-built app to Google Play and the App Store?

Yes. We handle signing, listings, privacy forms, testing tracks and review feedback.

Should I rewrite my AI-built app?

Only if the data model is wrong or repairs cost more than a rebuild. Otherwise harden and refactor step by step.

Get a free quote in 24 hours

Tell us what you need. We reply with scope, timeline and a fixed price.

Related guides