BlogDatabase

How to add a Postgres database to your app.

Ask your coding agent for a database. Antideploy creates Postgres 17 beside your app and sets DATABASE_URL, with no other account to open.

How the Agent API works
  • Postgres 17On Neon, in Singapore
  • DATABASE_URLSet in development and production
  • MigrationsRun before the new version goes live
  • One database for bothWhat you tested is what ships

The short answer

To add a Postgres database to your app, tell your connected coding agent to add one. It creates a Postgres 17 database beside your app, writes the connection details into your .env file without printing them, and builds and tests your code against it. DATABASE_URL is set in the running app too, so there is nothing to copy. You do not need another account.

Say this to your coding agent

Add a Postgres database to this project and use it for my data.

If your agent is not connected yet, paste this first: Set this project up to deploy on Antideploy. Fetch https://antideploy.com/agent.md and follow it.

What your agent does

  1. It asks for the database before it writes the code

    Your agent creates the database first, so your code is written and tested against the real thing. Asking twice returns the same database, so nothing is made twice.

  2. It writes the connection into your .env

    The variables go into your .env file through a redirect that never prints the password. The password is never in the chat or the terminal.

  3. The same database goes live with the app

    Development and production use one database. Before the app goes live it is a scratch space. Once it is live, its data is real, so the agent is told not to reset or reseed it without asking.

How your code connects

Read DATABASE_URL from the environment. The PG* variables hold the same connection split into host, port, user, password and database name, for tools that read those.

Node
import pg from "pg";

const pool = new pg.Pool({ connectionString: process.env.DATABASE_URL });
const { rows } = await pool.query("select * from trees limit 10");

# Python
import os, psycopg

with psycopg.connect(os.environ["DATABASE_URL"]) as conn:
    rows = conn.execute("select * from trees limit 10").fetchall()

Prisma, Drizzle, SQLAlchemy and Django read DATABASE_URL or a setting built from it. The connection is pooled.

Migrations

If your project has a migration command, Antideploy runs it after the build and before the new version goes live. It detects Prisma, Drizzle, Alembic and Django. A failed migration fails the deploy, so a version your schema cannot support is never released.

What it counts against

A database counts toward your plan's allowance however it was created: 1 on Free and Go, 3 on Pro and 5 on Scale, counted per account. A static site never needs one. Databases cost nothing extra.

01Before you commit

Here's where it stops.

A platform that only tells you what it is good at is one you find the edges of in production. These are the ones to know before your first deploy.

  1. Postgres only

    Antideploy creates Postgres databases. Redis, MySQL and MongoDB are not provided today, so an app that needs one brings its own.

  2. The disk forgets

    Anything written to local disk is gone on the next deploy. Apps that speak S3 get a bucket instead.

  3. Apps sleep when idle

    On every plan, an app nobody is using goes to sleep and the next visit wakes it. The first request took 2.9 to 13.9 seconds in our measurements, depending on the stack. There are no always-on workers, so use a cron job or a webhook for background work.

02Questions

Database questions, answered.

Anything else? Write to us and a person answers.

support@antideploy.com
Do I need a Neon or Supabase account?

No. Antideploy creates the database on its own account and gives your app the connection string. If you set your own DATABASE_URL, for example for Supabase, Antideploy leaves it alone and creates nothing.

Does my data survive a deploy?

Yes. The database belongs to the application and every deploy reuses it. Only the container's disk is replaced.

Can I see what is in it?

Yes. In the console, the Database tab shows tables, columns and row counts, read-only. Your agent can read up to 50 rows at a time through the API, with credential-like columns hidden. For more, connect with the connection string in your .env.

Can my agent delete the database?

No. It can create one, but dropping a database or deleting its application is only possible in the console.

Can I use MySQL, MongoDB or Redis?

Antideploy creates Postgres only. Bring your own for anything else and set its credentials as variables.

Why is the first query slow?

An idle database suspends and wakes on the next query, so the first request after a quiet spell is slower than the rest.

Deploy something. Start with one sentence.

Paste one sentence into your coding agent, click Approve once, and get a live link. No card, no trial clock.

Start from GitHub or a folder
Prompt copied Paste it into Claude Code, Codex or Cursor and press Enter.