Hosting10 min readPublished: 2 Aug 2026Updated: 2 Aug 2026

How to Deploy an App Your AI Agent Built

Your agent wrote a working app. Here is what to do next: push it to git, give it a database, keep that database private, and check a change before it ships.

G7Cloud Engineering
Platform team
Share:
Abstract diagram of a repository deploying into a container with three databases connected privately beneath it
  • Deploying is a git problem, not an AI problem. If your agent produced a repository, every normal hosting path is open to you.
  • Decide early whether the app stores anything. An app with a database has a backup problem and a privacy problem that a static site does not.
  • Never expose a database port to the internet. Put the database on a private network with the app instead.
  • Preview each change as a running site before you merge it. Reading agent-written code line by line does not scale.
  • Prefer a fixed monthly price over usage billing while you are still learning what the app does under load.

How do you deploy an app that an AI agent built?

Push the code to GitHub, GitLab or Bitbucket, then connect that repository to a host that builds from git. The host installs the dependencies, runs the build and starts the app. Add a database if the app stores anything, put it on a private network, and point your domain at the result.

The reason this is shorter than you expect is that deploying is a git problem, not an AI problem. Your agent produced a folder of files with a package.json or a Dockerfile in it. That is the same artefact a human developer would have produced, and every normal deployment path is open to you. Nothing downstream needs to know how the code was written.

What does change is the order you do things in. When code arrives faster than you can read it, the parts you would normally get for free through slow, careful work, knowing what the app touches and being able to undo a bad change, have to be put in deliberately. The rest of this guide is those parts.

What do you need before you deploy?

Four things, and you probably have three of them already.

  1. 1A git repository. If your agent worked locally, run git init, commit, and push to a new empty repository. If it worked in a browser tool, use that tool's export or GitHub connection.
  2. 2A build that succeeds on a clean machine. Run the build once yourself from a fresh clone. An app that only builds on the laptop it was written on is the single most common reason a first deploy fails.
  3. 3A list of the secrets it needs. Grep the code for process.env or getenv and write down every name you find. These become environment variables on the host, not committed files.
  4. 4An answer to whether it stores anything. If the app remembers users, orders, posts or uploads, it needs a database. If it only renders pages, it does not.

Check for committed secrets before the first push

Agents sometimes write an API key straight into a config file because it makes the code run immediately. Search the repository for your keys before you push, and rotate anything you find committed. A public repository is indexed within minutes.

On G7Cloud app hosting the build step is handled for you across 14 framework presets: Next.js, Astro, Nuxt, SvelteKit, Remix, Vite, Bun, Strapi, Medusa, Payload and more, plus a custom Docker option for anything the presets do not cover. You choose the repository and the branch, and each push builds and deploys.

Does your AI-built app need a database?

If the app has a login, a form that saves anything, a shopping basket, a dashboard or an admin screen, then yes. Agents frequently scaffold these with a local SQLite file, which works beautifully on your laptop and quietly loses everything the first time the container restarts.

Pick the engine by what the app actually does rather than by what sounds impressive.

You are storingUseWhy
Users, orders, posts, anything you queryPostgreSQLThe default application database. Relational, well understood, and every framework has a mature driver for it.
Sessions, a cache, a job queue, rate limitsRedisIn memory, so it is fast and disposable. Losing it costs you a slow page, not a customer's order.
Events, logs, product analyticsClickHouseBuilt for counting enormous numbers of rows quickly. Wrong choice for orders, right choice for asking what happened last Tuesday.

Most apps need the first one. Some need the first two. Very few need all three on day one.

Pro Tip

Start with one database. An agent will happily wire up three if you ask it to, and you will then be operating three things you do not yet need.

All three are available as managed database instances, each in its own container with memory and CPU you set, and each with its own backups. The connection string is handed to your app as an environment variable, so the code does not need to know where the database physically is.

How do you keep the database off the public internet?

Put the app and the database on the same private network, and do not give the database a public address at all. This is the single highest-value thing on this page, and it is the step most often skipped, because the quick way to make a database reachable is to open its port and rely on the password.

A password is one mistake away from being the only thing between the internet and your customers' data. It appears in a log, in a screenshot, in a committed config file, or in a repository your agent made public by accident. A database with no public route does not have that failure mode, because there is nothing to guess at.

0
database ports that should face the internet

Your app reaches the database over the private network. Your own machine joins the same network when you need to run a query by hand.

On G7Cloud this happens as part of adding the database: attach it to a site and it joins that site's private network in the same step, on a subnet that belongs to you alone. The app connects to a private address. When you want to inspect the data yourself, you add a peer for your laptop and your local tools reach it directly.

How do you check a change before it goes live?

Run it, do not read it. When an agent produces four hundred lines in a minute, line-by-line review stops being realistic. The practical substitute is to open the change as a working site and click the thing it was supposed to fix.

The mechanism is a preview environment: open a pull request and that branch gets built and deployed to its own URL, separate from production. You check the URL, and only then merge. It costs you a minute and it catches the class of problem that reads perfectly well as code.

Ask for small pull requests

An agent will write one enormous change if you let it. Asking for one change per pull request costs nothing and makes both the preview and the rollback meaningful, because you can tell which change caused what.

Keep the way back open too. Because deployments are built from commits, going back means redeploying the previous commit, which is one action. Your data lives in a separate database and is untouched by a code rollback, so reverting a bad deploy does not cost you the orders that came in while it was live. Preview environments and one-action rollback are both covered in the developer tooling.

What will it cost when the app gets busy?

This is worth settling before launch rather than after, because the two common billing models fail in opposite directions and you are about to run an application whose behaviour under load you do not know yet.

Usage billing charges per request, per function invocation or per gigabyte transferred. It is cheap while nothing is happening, which is most of the time, and it is the model that produces the invoice nobody planned for when a launch goes well or a crawler discovers an expensive endpoint. Fixed pricing charges the same amount whatever the traffic does, so a good day and a quiet day cost the same.

For a new app the fixed price is usually the easier one to live with, because the number you budget is the number you pay while you are still learning what the thing does. G7Cloud hosting starts at £12/month for a single app with its domain, email, DNS and daily backups. Preview environments and private networking come in at £59/month. The full ladder is on the pricing page.

What should you do in the week after launch?

Four things, in this order. None of them takes long, and each one closes a gap that only becomes visible when it is too late to close.

  1. 1Prove a backup restores. A backup nobody has restored is a guess. Restore one into a scratch copy and look at the data. On G7Cloud every backup is restored onto a test server overnight, so this is already being done for you, but check you can do it on demand too.
  2. 2Turn on uptime monitoring. You want to hear that the app is down from a monitor, not from a customer. Checks should run from outside your own infrastructure, because a check that runs inside it cannot tell you that the outside world has lost its route in.
  3. 3Move every secret out of the repository. If anything is still committed, rotate it and set it as an environment variable instead.
  4. 4Write down what the app talks to. Which database, which third-party API, which webhook. This takes ten minutes now and saves an afternoon the first time something breaks and you cannot remember what depends on what.

That last one matters more with agent-written code than it does otherwise. You did not type the integrations, so you do not carry them in your head the way you would if you had. A short written list is the cheapest possible substitute for that memory.

If you want the whole path in one place, from repository through databases and private networking to what is included at each price, it is on the hosting for apps built with AI agents page. Backup behaviour in detail, including how restores are tested, is on the backups page.

Frequently asked questions

How do I deploy an app that an AI agent built?

Push the code to GitHub, GitLab or Bitbucket and connect the repository to a host that builds from git. The host installs dependencies, runs the build and starts the app. Add a database if the app stores anything, keep that database on a private network, and point your domain at the result.

Does it matter which AI tool wrote the code?

No. Claude Code, Cursor, Copilot, an in-browser builder or a human all produce the same artefact: a git repository. Nothing about deployment changes based on what typed the characters, and you do not need a host that advertises AI support.

Can I deploy an app my agent built without knowing how servers work?

Yes. On managed hosting you connect a repository, choose a branch, and the build and the server are handled for you, including the certificate and the firewall. You need to understand what your app stores and what secrets it needs, but not how to administer a Linux machine.

Why is SQLite a problem for a deployed app?

SQLite writes to a file on local disk. Containers are replaced when you deploy or when the host moves them, and the file goes with them. It is fine for local development and for read-only data shipped with the app, but anything a user creates should live in a database that exists independently of the container.

Should I let my AI agent deploy the app itself?

You can, using an API key restricted to the specific things the job needs. It is usually worth doing the first deploy by hand so you understand what the pieces are, then handing over the repetitive parts once the shape is familiar.

How do I roll back a bad change?

Redeploy the previous commit. Because deployments are built from git, the earlier version is still there and going back is one action. Your database is a separate resource and is not affected, so the data created while the bad version was live survives the rollback.

Put this into practice on G7Cloud

Every site runs in its own dedicated container behind ScaleShield, with daily backups that are restore-tested every night. Start on the free plan, no card needed.

About G7Cloud Engineering

Platform team

Articles written by the engineers who build and run G7Cloud: UK managed hosting and the AI Website Builder. We write about what we operate every day: containers, backups, databases, and the small-business websites that run on them.

More about G7Cloud →