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
-
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.
-
It writes the connection into your
.envThe variables go into your
.envfile through a redirect that never prints the password. The password is never in the chat or the terminal. -
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.
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.