OneBit Deploy
Databases

PostgreSQL

Provision and connect to a managed PostgreSQL database on OneBit Deploy.

PostgreSQL is a powerful open-source relational database and a great default choice for most applications.

Create a PostgreSQL database

Go to New → Managed database, choose PostgreSQL, give it a name and deploy. Once it's ready, OneBit shows the connection details.

Create a managed database

Connection string

A PostgreSQL connection string looks like this:

postgres://USER:PASSWORD@HOST:PORT/DATABASE

Copy it from the database's page into your app as a secret environment variable (for example DATABASE_URL). See Connecting to a database.

Connecting from Node.js

import { Pool } from 'pg';

const pool = new Pool({ connectionString: process.env.DATABASE_URL });
const { rows } = await pool.query('select now()');
console.log(rows[0]);

Keep the connection string secret. Store it as an environment variable rather than in your code or repository.

On this page