Documentation

databases

PostgreSQL

Provision and connect to a managed PostgreSQL database.

Runix provisions a PostgreSQL 17 container alongside your services. Credentials are generated automatically and made available through connection strings.

Provisioning#

Add a `postgresql` service to your runix.yaml and reference the connection string from other services:

runix.yaml
yaml
name: my-app
services:
  - name: db
    type: postgresql

  - name: api
    type: web-service
    repo: https://github.com/alice/api
    env:
      DATABASE_URL: "${db.connection_string}"
bash
$ runix deploy
Success! 2 service(s) deployed:
  ✓ api
  ✓ db

Connection String#

The connection string follows the standard PostgreSQL URL format:

text
postgresql://runix_user:generated_password@db:5432/runix_db

This string is automatically injected into any service that references `${db.connection_string}`. You do not need to copy or manage it manually.

Connecting from Your App#

Using pg (node-postgres)

javascript
const { Pool } = require("pg");

const pool = new Pool({
  connectionString: process.env.DATABASE_URL,
});

const result = await pool.query("SELECT NOW()");
console.log(result.rows[0]);

Using Prisma

javascript
// prisma/schema.prisma
// datasource db {
//   provider = "postgresql"
//   url      = env("DATABASE_URL")
// }

const { PrismaClient } = require("@prisma/client");
const prisma = new PrismaClient();

const users = await prisma.user.findMany();

Backups#

Automatic daily backups are available on the Business plan. You can also trigger manual backups from the dashboard.

On Hobby and Starter plans, backups are not included. Make sure to implement your own backup strategy for production data.

Limits#

PlanMax DatabasesBackups
Hobby1No
Starter1No
Pro5No
BusinessUnlimitedYes (automatic daily)