PostgreSQL-based search engine with Meilisearch-compatible API.
- Meilisearch API Compatible - Drop-in replacement for Meilisearch
- PostgreSQL Backend - Use your existing PostgreSQL database
- Full-Text Search - Powered by PostgreSQL
tsvectorandtsquery - Typo Tolerance - Fuzzy search using
pg_trgmextension - Built-in Dashboard - Web UI for managing indexes and testing search
- Zero Config - Works out of the box with sensible defaults
One-line installation:
curl -sSL https://raw.githubusercontent.com/datamaker/pgsearch/main/docker-compose.yml -o docker-compose.yml && docker compose up -dOpen http://localhost:7700 in your browser.
# Download and start
wget https://raw.githubusercontent.com/datamaker/pgsearch/main/docker-compose.yml
docker compose up -ddocker run -d \
--name pgsearch \
-p 7700:7700 \
-e DB_HOST=your-postgres-host \
-e DB_USER=postgres \
-e DB_PASSWORD=yourpassword \
-e DB_NAME=pgsearch \
datamaker/pgsearch:latestgit clone https://github.com/datamaker/pgsearch.git
cd pgsearch
npm install
npm run migrate
npm run devcurl -X POST http://localhost:7700/indexes \
-H 'Content-Type: application/json' \
-d '{"uid": "movies", "primaryKey": "id"}'curl -X POST http://localhost:7700/indexes/movies/documents \
-H 'Content-Type: application/json' \
-d '[
{"id": 1, "title": "Inception", "genre": "Sci-Fi"},
{"id": 2, "title": "Interstellar", "genre": "Sci-Fi"}
]'curl -X POST http://localhost:7700/indexes/movies/search \
-H 'Content-Type: application/json' \
-d '{"q": "incep"}'Built-in web UI at http://localhost:7700
- Indexes - Create, view, delete indexes
- Documents - Add, view, delete documents
- Settings - Configure searchable/filterable attributes
- Search - Test search with filters and highlighting
| Method | Endpoint | Description |
|---|---|---|
| GET/POST | /indexes |
List/Create indexes |
| GET/PATCH/DELETE | /indexes/:uid |
Get/Update/Delete index |
| GET/POST/DELETE | /indexes/:uid/documents |
Manage documents |
| POST | /indexes/:uid/search |
Search documents |
| GET/PATCH/DELETE | /indexes/:uid/settings |
Manage settings |
| Variable | Default | Description |
|---|---|---|
PORT |
7700 | Server port |
DB_HOST |
localhost | PostgreSQL host |
DB_PORT |
5432 | PostgreSQL port |
DB_USER |
postgres | Database user |
DB_PASSWORD |
- | Database password |
DB_NAME |
pgsearch | Database name |
Authentication is fully off by default. When the OIDC environment variables below are absent, PgSearch runs in open mode and every endpoint is accessible without credentials (backwards compatible).
To enable it, configure an OIDC identity provider:
| Variable | Default | Description |
|---|---|---|
OIDC_ISSUER |
- | OIDC issuer URL (discovery via /.well-known/openid-configuration) |
OIDC_CLIENT_ID |
pgsearch |
OIDC client ID |
OIDC_CLIENT_SECRET |
- | OIDC client secret |
PGSEARCH_PUBLIC_URL |
- | Public base URL of this instance (used for the OIDC redirect_uri) |
PGSEARCH_ADMIN_EMAILS |
- | Comma-separated emails that get the admin role on login |
PGSEARCH_SESSION_SECRET |
random per boot | Secret for signing session cookies. Set it, or sessions reset on restart |
Auth is enabled when OIDC_ISSUER, OIDC_CLIENT_SECRET, and PGSEARCH_PUBLIC_URL are all set. Register PGSEARCH_PUBLIC_URL + /auth/oidc/callback as the redirect URI in your IdP.
Users are provisioned automatically on first SSO login (JIT):
- admin — full read/write access, plus member and API key management in the dashboard. Assigned when the email is in
PGSEARCH_ADMIN_EMAILS, or when it is the very first user. - member — read/search-only via the dashboard and session cookie. Write requests return
403.
Admins can promote/demote members and deactivate accounts in the dashboard's Members page (self-demotion/deactivation is blocked to prevent lockout).
For programmatic access (SDKs, servers), admins can create API keys in the dashboard's API Keys page. Keys are shown once at creation and only a SHA-256 hash is stored. Use them Meilisearch-style:
curl http://localhost:7700/indexes/movies/search \
-H 'Authorization: Bearer <your-api-key>' \
-H 'Content-Type: application/json' \
-d '{"q": "wonder"}'API keys have full read/write access.
| Feature | Status |
|---|---|
| Indexes CRUD | ✅ |
| Documents CRUD | ✅ |
| Search | ✅ |
| Filters | ✅ |
| Facets | ✅ |
| Highlighting | ✅ |
| Settings | ✅ |
| Typo tolerance | ✅ |
| API Keys | ❌ |
| Geo search | ❌ |
- Node.js 20+ / TypeScript
- Fastify
- PostgreSQL 16+ with pg_trgm
Contributions are welcome! Please feel free to submit a Pull Request.
MIT License - see LICENSE for details.