All guides
Databases · 6 min · Beginner

Spin Up a Postgres Database

Create a managed Postgres instance and connect to it from your app.

Databases on SparkCloud are managed Postgres containers — you get a host, port, user, password, and a default database. Backups can be scheduled daily or weekly.

Create

  1. Databases → New Database. Pick a name and disk size.
  2. Wait for status to flip to running.
  3. Open the detail page. Copy the connection string.

Connect

The connection string looks like:

bash
postgres://sparkcloud:<PASSWORD>@<HOST>:<PORT>/sparkcloud

Test it with psql:

bash
psql "postgres://sparkcloud:...@host:port/sparkcloud" -c 'SELECT version();'

From your app

js
// Node + postgres.js
import postgres from 'postgres';
const sql = postgres(process.env.DATABASE_URL);
const rows = await sql`SELECT NOW()`;