Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.nearbase.dev/llms.txt

Use this file to discover all available pages before exploring further.

Connection String

Every Nearbase instance has a unique connection string available on the Overview tab in the console. It follows this format:
postgresql://admin:{password}@{instance-id}.pg.nearbase.app:5432/postgres?sslmode=require
SSL is required for all connections. Always include sslmode=require (or its equivalent for your driver). Connections without SSL are rejected.

Connection Details

ParameterValue
Host{instance-id}.pg.nearbase.app
Port5432
Databasepostgres
Usernameadmin
SSL moderequire

Code Examples

psql "postgresql://admin:{password}@{instance-id}.pg.nearbase.app:5432/postgres?sslmode=require"

Connection Pooling

For production applications, use a connection pool to efficiently reuse database connections rather than opening a new one per request.
A good starting point: set your pool size to 5–10 connections per CPU on your database instance. You can monitor live active connection counts on the Performance tab.
const pool = new pg.Pool({
  connectionString:
    "postgresql://admin:{password}@{instance-id}.pg.nearbase.app:5432/postgres?sslmode=require",
  max: 10,           // maximum pool size
  idleTimeoutMillis: 30000,
  connectionTimeoutMillis: 2000,
});

SSL / TLS

All Nearbase databases require TLS. If your driver accepts a configuration object instead of a connection string, enable SSL explicitly:
const pool = new pg.Pool({
  host: "{instance-id}.pg.nearbase.app",
  port: 5432,
  database: "postgres",
  user: "admin",
  password: "{password}",
  ssl: { rejectUnauthorized: true },
});
Need help? Reach out at team@nearbase.dev.