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:
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}"$ runix deploy
Success! 2 service(s) deployed:
✓ api
✓ dbConnection String#
The connection string follows the standard PostgreSQL URL format:
postgresql://runix_user:generated_password@db:5432/runix_dbThis 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)
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
// 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#
| Plan | Max Databases | Backups |
|---|---|---|
| Hobby | 1 | No |
| Starter | 1 | No |
| Pro | 5 | No |
| Business | Unlimited | Yes (automatic daily) |