Connect

BashGres requires PostgreSQL with the ltree extension. Pick your database driver:

Install

Install BashGres with your preferred PostgreSQL driver and just-bash:

npm install bash-gres postgres just-bash

Setup

import postgres from "postgres"
import { setup, PgFileSystem } from "bash-gres/postgres"

const sql = postgres("postgres://localhost:5432/myapp")

// Creates table, indexes, extensions, RLS (idempotent)
await setup(sql)

const fs = new PgFileSystem({ db: sql, workspaceId: "workspace-1" })

Docker Compose

The easiest way to get a compatible PostgreSQL instance running:

docker-compose.yml
services:
  postgres:
    image: postgres:18
    ports:
      - "5432:5432"
    environment:
      POSTGRES_DB: myapp
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD: postgres
docker compose up -d