Skip to content

Databases and Storage

  • PostgreSQL + pgvector


    Single store for chunks, embeddings, and FTS/BM25 indexes.

  • Neo4j Graph


    Entities and relationships power graph traversal and community queries.

  • Operational Controls


    Connection pools, health checks, and exporters for metrics.

Get started Configuration API

Co-locate Storage

Use the provided Docker Compose to run Postgres and Neo4j locally with sane defaults and persistent volumes outside the repository.

pgvector Index Choice

Choose HNSW for high-recall, read-heavy workloads; IVFFlat for faster build times and stable performance on mid-size corpora.

Neo4j Memory

Set NEO4J_HEAP_INIT, NEO4J_HEAP_MAX, and NEO4J_PAGECACHE environment variables for large graphs to avoid GC thrash.

Services

Service Image Ports Data Volume
Postgres pgvector/pgvector:pg16 ${POSTGRES_PORT:-5432}:5432 ${TRIBRID_DB_DIR}/postgres:/var/lib/postgresql/data
Postgres Exporter prometheuscommunity/postgres-exporter:latest internal n/a
Neo4j neo4j:5.x 7687, 7474 ${TRIBRID_DB_DIR}/neo4j/*
flowchart LR
    Client --> API
    API --> PG[("PostgreSQL + pgvector")]
    API --> NEO[("Neo4j")]
    PG --> EXP["Postgres Exporter"]
    EXP --> PROM["Prometheus"]

Connectivity Checks

import httpx
print(httpx.get("http://localhost:8000/health").json())   # liveness
print(httpx.get("http://localhost:8000/ready").json())    # readiness
curl -sS http://localhost:8000/health | jq .
curl -sS http://localhost:8000/ready | jq .
async function readiness() {
  const health = await (await fetch("/health")).json();
  const ready = await (await fetch("/ready")).json();
  console.log(health, ready);
}

Index Footprint

Use DashboardIndexStatsResponse to view pgvector_index_bytes, bm25_index_bytes, and neo4j_store_bytes per corpus.