Skip to main content

Overview

IronClaw supports two database backends:
  • PostgreSQL - Production-grade, requires a running server
  • libSQL - Embedded SQLite, zero dependencies, optional Turso cloud sync
The onboarding wizard helps you choose and configure either option. This guide covers manual configuration and advanced settings.

PostgreSQL

Requirements

  • PostgreSQL 15 or later
  • pgvector extension (required for embeddings)

Installation

Configuration

Set the database URL in your environment or ~/.ironclaw/.env:
URL format:

Connection Pool

Configure the connection pool size:
Recommendations:
  • Local development: 5-10 connections
  • Production: 20-50 connections (depends on workload)
  • Docker/VPS: Start with 10, adjust based on pg_stat_activity

SSL/TLS Configuration

Control SSL mode for PostgreSQL connections:
Options: Recommendations:
  • Local PostgreSQL: disable (no TLS needed)
  • Managed databases (Neon, Supabase, RDS): prefer or require
  • VPS/self-hosted: prefer (default, works everywhere)

Migrations

Migrations run automatically on first connection. To run manually:
Or apply with refinery CLI:

Cloud Providers

Neon provides serverless Postgres with automatic scaling.
pgvector is pre-installed. Set DATABASE_SSLMODE=require.
Supabase includes Postgres with pgvector.
Enable pgvector in SQL Editor:
Railway provides managed Postgres.
Install pgvector via Railway’s Postgres plugin settings.
RDS for PostgreSQL with pgvector.
Enable pgvector:

Troubleshooting

Error: pgvector extension not foundSolution:Then enable in your database:
Error: PostgreSQL 14 detected. IronClaw requires PostgreSQL 15 or laterSolution: Upgrade PostgreSQL:
Error: connection refused or could not connect to serverCheck PostgreSQL is running:
Check port:
Check pg_hba.conf if connecting remotely.
Error: password authentication failedCheck password:
Reset password:

libSQL (Embedded)

Overview

libSQL is an embedded SQLite database with optional Turso cloud sync. No external database server required. Benefits:
  • Zero dependencies
  • Single file storage
  • Automatic migrations
  • Optional remote sync

Local Setup

The database file is created automatically on first run.

Turso Cloud Sync

Turso provides remote replicas for libSQL databases. Setup:
  1. Create a Turso database:
  2. Get connection details:
  3. Create an auth token:
  4. Configure IronClaw:
How it works:
  • Local file (LIBSQL_PATH) is the primary database
  • Changes sync to the remote replica (LIBSQL_URL)
  • Other instances can read from the remote replica

Configuration Options

Migrations

Migrations run automatically on first connection (idempotent CREATE IF NOT EXISTS).

Limitations

  • Concurrency: SQLite uses file-level locking (fine for single-user, not ideal for high-concurrency)
  • Vector search: Uses JSON instead of native vector types (slower than pgvector)
  • Backups: Copy the .db file (or use Turso cloud backups)

When to Use libSQL

Good for:
  • Personal use / single-user
  • Development / testing
  • Lightweight deployments
  • Portable installations
Use PostgreSQL if:
  • Multiple concurrent users
  • High-throughput workloads
  • Large-scale vector search
  • Production deployments

Switching Backends

To switch from PostgreSQL to libSQL (or vice versa):
  1. Export data (if needed):
  2. Change configuration:
  3. Re-run onboarding:
  4. Migrations run automatically on first connection.
Switching backends creates a fresh database. Export/import data manually if needed.

Environment Variables

PostgreSQL

libSQL

Backups

PostgreSQL

libSQL

Turso cloud: Automatic backups via Turso dashboard.