---
title: Built it with AI coding tools, now harden it: a production checklist | Codivated
canonical: https://www.codivated.com/insights/harden-an-app-built-with-ai/
---

[Home](https://www.codivated.com/)/[Insights](https://www.codivated.com/insights/)Delivery · 8 min read

# You built it with AI. Now harden it for production

By the Codivated team · Updated November 17, 2026

An app built with AI coding tools usually works on the happy path and breaks at the edges: logins, permissions, bad input, real data volumes and the third deploy. To harden it, review security first, add tests for what users actually do, add logging so you can see failures, set up a safe way to deploy, and decide which parts to fix and which to rebuild. The good news: the same AI tools that wrote it can do most of the hardening, if someone who knows what production needs is directing them.

## Why do AI-built apps break in production?

Because the tools optimize for "it runs", not "it's safe and it keeps running". In Veracode's tests of more than 100 models, AI-generated code introduced a known security flaw in about 45% of tasks, and its 2026 follow-up found little improvement. The usual gaps aren't exotic. They are the things a senior engineer adds without thinking: checks on who can see what, input validation, secrets kept out of the code, error handling and logs.

## What should you check first?

| | Area | What usually goes wrong | What "hardened" looks like

| Authentication and permissions | Any logged-in user can see or change other users' data by changing an ID | Every read and write checks that this user may do this, on the server

| Secrets | API keys in the front-end code or committed to the repo | Keys in a secrets manager or environment, rotated, never in the browser

| Database rules | Row-level security off, or open to the public key | Least-privilege rules tested with a second user account

| Input | Forms and APIs trust whatever comes in | Validation on the server, safe queries, limits on size and rate

| Errors | The app crashes, or shows a stack trace to users | Errors caught, users see a clear message, the team gets an alert

| Logging | Nobody knows something failed until a customer says so | Structured logs and alerts for errors, slow pages and failed jobs

| Tests | None, or a few that test nothing important | Unit tests for the logic, end-to-end tests for the main user journeys

| Deploys | Changes go straight from a laptop to production | A pipeline that builds, tests and deploys, with a way to roll back

| Costs | An AI feature or query loop with no limits | Usage caps, timeouts and a budget alert

## How do you add tests to an app that has none?

Start with the journeys that would hurt most if they broke: sign up, log in, pay, the core action your users came for. Write end-to-end tests for those first, then unit tests around the business logic. AI coding agents are very good at writing tests once you tell them what must be true. Our team runs this as a loop: exploratory QA agents use the app and file issues, coding agents fix them and add a unit or end-to-end test for each fix, and an agent watches production logs to catch what the tests miss. Every bug becomes a test, so it stays fixed.

## Should you fix it or rebuild it?

Rebuilding used to be the scary option. It isn't anymore. An AI coding agent can walk through an existing app, map what it does and rebuild it with tests, in a fraction of the time it once took. What isn't cheap is knowing what the app must do. So:

- Fix it when the structure is sound and the problems are gaps: missing checks, tests and logs.
- Rebuild a part when one area is tangled, like a data model that fights every feature or an auth setup bolted on late.
- Rebuild the whole thing when every change breaks something else and nobody can explain how it works. Write the specification first: what it does, for whom, with what data and rules. The spec is the asset; the code is the cheap part.

See the [AI agent review checklist](https://www.codivated.com/insights/ai-agent-review-checklist/) for the same question asked about AI agents.

## What about apps with AI features inside?

If the app calls a model, harden that part too: keep prompts and keys on the server, limit what the model can trigger, check its output before it reaches users or your database, and log every call with its cost. Treat anything a user types as untrusted, including text that ends up in a prompt. See [AI agent security](https://www.codivated.com/insights/ai-agent-security/).

## What does a hardening project look like?

- Review. Use the app as different users, read the code and configuration, and run security and dependency scans. Out comes a ranked list of risks.
- Fix the critical items. Permissions, secrets and data exposure come first, before any new features.
- Add the safety net. Tests for the main journeys, logging and alerts, and a deploy pipeline with rollback.
- Decide on rebuilds. Fix, rebuild a part, or rebuild, per area, against a written spec.
- Keep it healthy. Every bug gets a test; dependencies get updated; someone watches the alerts.

Free self-checkIs your company ready for an agent?Ten questions, a readiness score out of 100 and where your first agent should go.

[Take the scorecard](https://www.codivated.com/ai-readiness-scorecard/)

## Common questions

### We built it in Lovable, Bolt or Replit. Can it be hardened there?

Often yes, at least for a while. Many of these tools export real code and use standard back ends like Supabase. Past a certain size, moving the code into a normal repository with tests and a pipeline is usually the safer path.

### How long does hardening take?

A review takes days. Fixing the critical items is often a week or two for a small app. The test and logging safety net grows from there.

### Can we keep building with AI tools after it's hardened?

Yes, and you should. The tests and the pipeline are what make it safe to keep moving fast with AI.

### Do we need a security audit?

For anything that holds customer data or takes payments, at least have someone independent review permissions and secrets. For regulated data, get a formal assessment.

## Sources

- [AI-generated code poses major security risks in nearly half of all development tasks](https://www.veracode.com/press-release/ai-generated-code-poses-major-security-risks-in-nearly-half-of-all-development-tasks-veracode-research-reveals/), Veracode, 2025.
- [OWASP Top 10](https://owasp.org/www-project-top-ten/), OWASP: the most common web application security risks.
- [OWASP Top 10 for LLM Applications](https://owasp.org/www-project-top-10-for-large-language-model-applications/), OWASP: risks for apps with AI features.

Written byThe Codivated teamWe build and run AI agents for established companies.[Book a consultation](https://www.codivated.com/contact/)

## Find your first agent in two weeks.

[Ask about the First Agent Sprint](https://www.codivated.com/contact/)
