Browse docs

Services

Postgres

A Postgres 16 database per project, with a built-in explorer, SQL editor and nightly backups.

Deploy

Click Deploy on the Postgres card. CloudHike.dev creates a database named app and a non-superuser role that owns it, then shows the connection string with Reveal, Copy, Reset password and Delete.

PlanWhere it runsSize
FreeA shared server. Your project gets its own p_… database and a role that can open only that database, with at most 30 connections and a 30 second statement timeout.500 MB, 128 MB RAM
ProA container of its own10 GB, 256 MB RAM

After upgrading, a Pro user can move a shared database to its own container from the Postgres card. Writes pause while it is copied, every table's row count is checked against the original, and the old copy is kept closed for 7 days before it is dropped.

Connect

The connection string is in DATABASE_URL. When TLS is on, it ends in ?sslmode=require and the public port accepts only encrypted connections.

VariableUse it for
DATABASE_URLYour app's queries. On the Free plan it goes through a connection pooler (PgBouncer), so up to 200 app connections share a few real ones.
DIRECT_URLOnly on pooled databases: migrations (drizzle-kit push, Prisma's directUrl), pg_dump, LISTEN/NOTIFY, session-level SET and advisory locks. It is limited to 30 connections.

The pooler lends a real connection for one transaction at a time. Prepared statements work. Anything that has to last longer than a transaction on one connection needs DIRECT_URL.

Terminal
psql "$DATABASE_URL"
node-postgres
import { Pool } from "pg";

const pool = new Pool({ connectionString: process.env.DATABASE_URL });
const { rows } = await pool.query("select * from todos where done = $1", [false]);
Drizzle ORM
import { drizzle } from "drizzle-orm/node-postgres";
import { Pool } from "pg";

// One pool per process, kept across dev hot reloads.
const globalForDb = globalThis as unknown as { pool?: Pool };
const pool = globalForDb.pool ?? new Pool({ connectionString: process.env.DATABASE_URL, max: 5 });
if (process.env.NODE_ENV !== "production") globalForDb.pool = pool;

export const db = drizzle(pool);
psycopg
import os, psycopg

with psycopg.connect(os.environ["DATABASE_URL"]) as conn:
    print(conn.execute("select version()").fetchone())

Open connections count against the plan. Use one pool per server process and keep it small, especially on serverless platforms where each invocation can open its own connection. In development, keep the pool on globalThis as above: otherwise every hot reload opens a new pool and the old one stays connected.

  • Connections idle for 5 minutes are closed by the server. Pools open a new one on their next query.
  • Once a database uses half its connection limit, the usage check (every 5 minutes) closes connections that have been idle for over a minute, such as those a dev server leaves behind on hot reload. Running queries are never touched.
  • If you see too many connections for role, click Close idle connections on any tab of Open database to free the limit right away.
  • The Usage page shows each database's connections and marks one Maxed out for a day after it hit its limit.

Database explorer

Click Open database on a ready Postgres card to browse and query without installing anything.

TabWhat it does
DataPick a schema, search the table list, browse 25 to 250 rows per page, sort, search across a row, and click a row to see or copy it as JSON.
SQL EditorRun SQL with results in a grid, save snippets, and keep a per-project history in your browser.
StatsDatabase size, connections, cache hit ratio, uptime, and each table's size, rows and index use.
ConfigurationThe key Postgres settings, read-only.
ExtensionsSee what is installed and enable trusted extensions such as pgcrypto, citext and hstore.
BackupsList, take, download and restore backups.
ConnectHost, port, database and user, with the password on request.

Everything is read-only until you switch off Read-only in the SQL editor. Each query has a 10 second statement timeout and a 3 second lock timeout. With writes allowed, a script runs in one transaction that commits only if every statement succeeds, and statements like DROP, DELETE and UPDATE ask for confirmation.

Backups

A nightly job at 02:00 runs pg_dump for every running database and stores the dump in the project's storage bucket under _backups/postgres/. Without a Storage service, it uses the platform's backup bucket instead.

  • Retention is set on the Backups tab: up to 7 days on Free and 30 on Pro. The newest backup is always kept.
  • Take a backup at any time with the Backup now button.
  • Download a backup through a short-lived signed link.
  • Restore first takes a safety backup, loads the dump into a new database next to the live one, and swaps them only after it fully loads. A failed restore leaves your database untouched.
  • Backups stop when storage would pass 98% of the plan limit.

Limits, sleeping and size

  • A database over its size limit gets a warning from the usage check. After 3 days over, it becomes read-only until you free space or upgrade.
  • Free databases with no connections for 6 hours are stopped. Click Wake on the card to start one again.
  • Click Pause on the card to stop a database yourself. Your data is kept, and compute is not charged while it is paused. Click Resume to start it again.
  • Reset password creates a new password and updates DATABASE_URL. Apps still using the old password are disconnected until you update them.

Use with AI

Ask an agent to connect your app to the project's database, create tables and write queries.

  1. 1

    Open a terminal in your app's folder and start Claude Code.

    claude
  2. 2

    Paste the prompt below and press Enter. Approve the file edits and commands it asks about.

  3. 3

    Optional: save a short note about CloudHike.dev in CLAUDE.md so every session knows about it.

PROMPT
Read https://cloudhike.dev/docs/md/postgres, then connect this app to my CloudHike.dev Postgres database.

- DATABASE_URL is in my env file (if not, follow https://cloudhike.dev/prompt.md with my project id and access token to download it).
- Use the ORM or driver this app already uses. If it has none, use node-postgres or the standard driver for this language.
- Create the tables this app needs with migrations. Do not drop or rewrite existing tables.
- Open at most a small connection pool (3 to 5 connections), created once per process and kept on globalThis so dev hot reloads reuse it.
- Never print or commit the connection string.

Replace the placeholders in <angle brackets> before sending. Always review what the agent changes.