fargone / docs / databases

Attach managed databases to your apps. Each database runs as a container on the platform's internal network, with credentials injected automatically.

Supported databases

Type Default version Env var
PostgreSQL 16 DATABASE_URL
Redis 7 REDIS_URL
MariaDB 11 MARIADB_URL
MongoDB 7 MONGODB_URL

Add a database

fargone db my-app add postgres
fargone db my-app add redis
fargone db my-app add mariadb
fargone db my-app add mongo

Specify a version with --version:

fargone db my-app add postgres --version 15

The CLI polls until the database is ready (usually under 2 minutes), then prints the connection URL.

List databases

fargone db my-app list

Shows each database's type, status, and connection URL.

How it works

  1. A Docker container is created with auto-generated credentials (username, random password, database name).
  2. The connection string is stored internally as internal:{container}:{port}.
  3. On every deploy, the full connection string is assembled and injected as an environment variable into your app container.
  4. Databases are only accessible from within the platform's Docker network — they are not exposed to the public internet.

Using the connection string

In your app code, read the injected env var:

// Node.js
const { Pool } = require("pg");
const pool = new Pool({ connectionString: process.env.DATABASE_URL });
# Python
import os
import psycopg2
conn = psycopg2.connect(os.environ["DATABASE_URL"])

The connection string format (PostgreSQL shown):

postgres://fargone:randomPassword@fargone-res-{id}:5432/fargone

MariaDB uses the mysql:// scheme instead:

mysql://fargone:randomPassword@fargone-res-{id}:3306/fargone

Override the env var key

Each database resource has an envKey field. The defaults are DATABASE_URL, REDIS_URL, MARIADB_URL, and MONGODB_URL. You can override this when adding a database to use a custom key name.

Notes

  • Databases are not backed up automatically. Plan your own backup strategy.
  • The CLI waits up to ~2 minutes for provisioning. If it times out, the container may still be starting — check fargone db my-app list after a few minutes.
  • MariaDB uses the mysql:// scheme in its connection string, and injects as MARIADB_URL (set a custom envKey like DATABASE_URL if your app expects that name).