ScalixScalix Docs
Sign up

Connecting

Connect to ScalixNova with any standard PostgreSQL driver: psql, node-postgres, psycopg, Prisma, Drizzle

It's just Postgres

ScalixNova speaks the native PostgreSQL wire protocol, so you connect with the driver and tools you already use: psql, node-postgres (pg), psycopg, Prisma, Drizzle, SQLAlchemy, or anything else that speaks Postgres. There is no proprietary database driver to install.

Use a standard driver for running SQL (the data plane). For control-plane operations (creating branches, point-in-time restores, and provisioning), use the CLI, the SDK, or the API.

Get your connection string

Every database has a ready-made connection string. Get yours from:

  • Console → your project → Database → Connect, or
  • the connection_string field returned when you create a database via the CLI or API.

It looks like this:

text
postgresql://t_a1b2c3d4e5f6:YOUR_API_KEY@api.scalix.world:5432/db_a1b2c3d4e5f6?sslmode=require

Replace YOUR_API_KEY with a Scalix API key. Then store the whole string as an environment variable:

bash
export DATABASE_URL="postgresql://t_a1b2c3d4e5f6:scalix_sk_...@api.scalix.world:5432/db_a1b2c3d4e5f6?sslmode=require"

Anatomy

PartValueNotes
Usert_…Your database's dedicated NOSUPERUSER role — assigned automatically.
Passwordyour API keyUse a Scalix API key as the password. Scope and rotate it like any key.
Host / Portapi.scalix.world:5432The managed wire endpoint (same host as the API). Copy the exact host/port from your connection string.
Databasedb_…Your isolated database — assigned automatically. The API key selects your project; the database name is then resolved within that project: the primary db_… name (or postgres/scalixnova) routes to the primary database, and db_<branch timeline UUID> routes to that branch while it is attached. A name that resolves to nothing in your project is rejected (3D000) — it never silently serves the primary.
sslmode=requirerequiredTLS is mandatory. Connections without TLS are rejected.

Connect

All examples assume DATABASE_URL is set as above.

psql

bash
psql "$DATABASE_URL"

Node.js: node-postgres (pg)

javascript
import { Pool } from 'pg'
 
const pool = new Pool({ connectionString: process.env.DATABASE_URL })
 
const { rows } = await pool.query('SELECT now()')
console.log(rows[0])

Python: psycopg

python
import os
import psycopg
 
with psycopg.connect(os.environ["DATABASE_URL"]) as conn:
    with conn.cursor() as cur:
        cur.execute("SELECT now()")
        print(cur.fetchone())

Prisma

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

Drizzle

typescript
import { drizzle } from 'drizzle-orm/node-postgres'
import { Pool } from 'pg'
 
const pool = new Pool({ connectionString: process.env.DATABASE_URL })
export const db = drizzle(pool)

One statement per query on the wire

The wire protocol runs each query through the extended (prepared) protocol, so a message carries exactly one statement: sending a script with several ;-separated statements is rejected with "stacked queries (multiple statements) are not allowed". This is intentional on the wire path. To run a multi-statement script, use the HTTP SQL surface (POST /api/v1/sql, or the SDK's executeSql), which accepts scripts and batches of queries, or split the script into individual statements on the wire.

TLS is required

ScalixNova rejects plaintext connections. Every client must use TLS (sslmode=require or stronger). Most drivers negotiate this automatically when sslmode=require is in the connection string. The password is only sent after the TLS handshake completes.

For stricter verification, use sslmode=verify-full with your system CA bundle.

Connection pooling

Pooling is built in at the gateway. You don't need PgBouncer or an external pooler. Point your client at the connection string above and open connections normally; the platform multiplexes them for you.

Prefer HTTP?

If you'd rather not manage a TCP connection (for example, from a serverless function or an AI agent), run SQL over HTTPS with the SDK:

typescript
import { executeSql } from "@scalix-world/sdk"
 
const { data, error } = await executeSql({
  headers: { Authorization: `Bearer ${process.env.SCALIX_API_KEY}` },
  body: { query: "SELECT now()" },
})
console.log(data?.rows)

Next steps