superapp
BackendDatabases

Postgres.js

Connect with the postgres.js driver.

Chat in Claude

High-performance PostgreSQL driver for Node.js, Deno, and Bun.

import { createEngine } from '@superapp/backend'
import { postgresJsProvider } from '@superapp/backend/databases/postgres-js'

const engine = createEngine({
  providers: [postgresJsProvider],
  connections: {
    main: { type: 'postgres-js', connectionString: process.env.PG_URL! },
  },
})

Install

npm install postgres

Why Postgres.js

  • Fastest PostgreSQL driver for Node.js
  • Built-in connection pooling
  • Tagged template literal query interface
  • Supports Deno and Bun natively

Connection Options

OptionTypeDescription
connectionStringstringStandard postgres:// URL
maxnumberMax pool connections (default: 10)
idle_timeoutnumberSeconds before idle connections close
connect_timeoutnumberSeconds before connection attempt times out

On this page