Postgres
Managed PostgreSQL in your environment’s private network, with continuous backups, point-in-time restore into a new database, and a secure tunnel from your laptop.
Create a database
apprail databases create shop main
apprail databases create shop analytics --version 17 --storage 20 --cpu 500 --memory 1024
apprail databases shop| Option | Choices |
|---|---|
--version | 16 or 17. Minor versions are kept current |
--storage | 1–50 GB |
--cpu, --memory | Millicores and MB reserved for the database; they count toward your workspace limits |
--env | Which environment; production by default |
It takes a minute or two to become ready. Then every service in the environment receives its variables and is updated automatically.
Connect from your app
Read DATABASE_URL. Each database also provides APPRAIL_DATABASE_<NAME>_URL, _HOST, _PORT, _NAME, _USER, and _PASSWORD — for a database called main, APPRAIL_DATABASE_MAIN_URL.
// Node.js (pg)
const pool = new Pool({ connectionString: process.env.DATABASE_URL });
# Python (psycopg)
conn = psycopg.connect(os.environ["DATABASE_URL"])The generated URL uses sslmode=disable: the connection never leaves the environment’s isolated network, and it works the same in every client (strict certificate checks in Node and Prisma would otherwise refuse the database’s internal certificate).
Create your schema with a pre-deploy command such as npx prisma migrate deploy, so it exists before your app starts.
Connect from your computer
apprail databases connect opens a local port and prints a connection URL for psql, TablePlus, DBeaver, or a migration tool. The connection is relayed through Apprail’s API into the database and encrypted end to end; the database never gets a public address.
apprail databases connect shop main # 127.0.0.1:54329
apprail databases connect shop main --port 6543 --env staging- Needs a member who can change the project, using a full-access token (browser sessions and read or deploy tokens can’t open tunnels).
- Revealing the password and opening a tunnel are both recorded in the activity history.
- Idle connections are kept alive; a tunnel closes after 12 hours at most.
Backups
Every database is backed up continuously to offsite storage: the write-ahead log is archived as it happens, and a full base backup runs daily at 02:00 UTC. Take one yourself before a risky change:
apprail databases backup shop main
apprail databases backups shop mainRestore
A restore never overwrites anything. It creates a new database from another one’s backups — to the latest state or to a moment you choose — and leaves the source untouched. Check the restored data, then point your app at it (or delete the old one so the restored one becomes the default).
apprail databases restore shop main main-restored
apprail databases restore shop main main-before-bug --to 2026-09-25T14:30:00ZRotate the password
The database gets a new password, and about 45 seconds later every live service in the environment restarts with it. Expect a brief moment of failed connections; apps that reconnect on error handle it without help.
apprail databases rotate-password shop mainDelete
apprail databases delete shop main --confirm mainDeleting needs the database’s name and removes the server, its disk, and its credentials. Its backups are kept in offsite storage.
Take your data with you
apprail databases connect shop main &
pg_dump "postgres://…@127.0.0.1:54329/…" > shop.sqlGood to know
Each database is a single instance without a standby replica. If its machine fails, the database is unavailable until it is restarted elsewhere, and data written since the last archived log segment could be lost — recoverable up to that point from backups. There’s no connection pooler or read replicas yet, and only stock Postgres extensions. Keep connection pools modest.