selfhost.directory

The index of self-hostable projects — ranked, categorized and served with live updates.
Own your data and stop giving it to big tech.

PgStack logo

Self-host PgStack

v2.2.0

Creates search and audit replicas for your Postgres database

ReleaseOpen SourceAGPL-3.0
Updated9 hours ago
LanguageGo
Setup difficultyModerate
Stars
1 537
Port
54321 (Postgres-compatible SQL endpoint)
Requires
PostgreSQL
Docker
ghcr.io/pgstack-io/pgstack
Install with Docker

What is PgStack?

PgStack links to a Postgres database through logical replication and builds two read-only replicas. One replica focuses on search, offering keyword, semantic, and combined ranking with optional OpenAI embeddings. The other replica records every row change with before and after snapshots for auditing. The software runs in one Docker container and serves a Postgres-compatible SQL interface on port 54321. A YAML file controls which tables and columns are indexed. The core is AGPL-3.0 licensed, while a paid cloud edition provides a web dashboard, team features, managed embeddings, autoscaling, and hardened security.

Should you self-host PgStack?

PgStack scores 54/100 on selfhost.directory (how scoring works) and ranks #23 of 41 in Search Engines. It has 1 537 GitHub stars.

It shipped 5 stable releases in the past year. The latest, v2.2.0, came out on 23 October 2026. New versions land roughly every 7 days.

Setup is moderate: expect some configuration beyond a single command. An official Docker image is available. It is AGPL-3.0-licensed and written mostly in Go.

Its closest alternative on selfhost.directory is SearXNG (86/100, 38 940 stars). It scores higher overall, so compare the two before you pick. See PgStack vs SearXNG side by side.

Features

  • ARM64 Support
  • Audit Trail
  • BM25 keyword search
  • Hybrid SearchRequires OPENAI_API_KEY
  • Logical replication
  • Postgres wire protocol
  • SCRAM authentication
  • Search replica
  • Semantic SearchRequires OPENAI_API_KEY
  • YAML Configuration

PgStack README

How to install PgStack

Install PgStack with Docker

PostgreSQL with wal_level=logical
Environment variables
DATABASE_URL, OPENAI_API_KEY, PGSTACK_PASSWORD

docker run --rm --name pgstack -p 54321:54321 -e DATABASE_URL='postgres://postgres:postgres@host.docker.internal:5432/postgres' ghcr.io/pgstack-io/pgstack:latest

Requires source Postgres with wal_level=logical

How to configure PgStack

  • DATABASE_URLSource Postgres connection URL

    Source Postgres connection URL

  • OPENAI_API_KEYEmbedding generation for semantic and hybrid search

    Embedding generation for semantic and hybrid search

  • PGSTACK_PASSWORDSCRAM authentication for the SQL endpoint

    SCRAM authentication for the SQL endpoint

PgStack releases & version history

FAQ

Why use PgStack instead of building this myself?

Companies like Facebook, AngelList, LinkedIn, Gusto, and Airbnb have built similar systems, often investing significant time and millions of dollars. PgStack provides this as a managed capability.

How do I query my data?

Connect to your provisioned PgStack database with any Postgres client. Query audit history or search data with relevance ranking and filters using SQL.

Do I need to migrate my database or install extensions?

No database migration or search/audit extensions are needed. PgStack uses read-only access so your existing database and application stay in place.

Where is my data stored?

Your existing Postgres remains the source of truth. Audit history and searchable data are stored separately in PgStack's isolated infrastructure and accessed through a Postgres-compatible database.

How does PgStack connect to Postgres?

PgStack connects via read-only access using Postgres's built-in logical replication, without inserting, updating, or deleting records. Setup requires permissions to configure replication.

More in Data Management

Rate this project

Click to rate — no account needed.

0 comments

Posting as guest
Loading comments…