postg-rs
Embedded PostgreSQL for Rust.
postg-rs gives you a SQLite-like developer experience with full PostgreSQL. No containers, no system installs. On first run, it downloads a portable PostgreSQL binary and manages it as a child process.
Supports Spock multi-master replication, pgvector, and Parquet import/export.
Features
- Zero-Install PostgreSQL — auto-downloads portable binaries (Linux x86/ARM, macOS) from GitHub Releases
- Spock Multi-Master — active-active replication with last-write-wins conflict resolution via pgEdge Spock
- pgvector — swap to the
postgresql-pgvectorengine for vector similarity search - Parquet Import/Export — stream data between PostgreSQL and Parquet via zero-copy Arrow and the binary
COPYprotocol #[postg::test]Macro — integration tests with real PostgreSQL, no Docker- Built-in REST API — serve SQL queries over HTTP
- CLI —
shell,query,dump/restore,sync
Quick Start
[]
= { = "https://github.com/oonid/postg-rs.git" }
Library Usage
use ;
use Postg;
async
Testing
The #[postg::test] macro spins up an ephemeral PostgreSQL instance per test:
async
Engine selection:
async
CLI
# Install
Basic
Backup & Restore
# SQL
# Parquet
Spock Replication
# Node A
# Node B
Platform Support
| Platform | Architecture | Status |
|---|---|---|
| Linux | x86_64 | ✅ |
| Linux | aarch64 | ✅ |
| macOS | x86_64 / Apple Silicon | ✅ |
| Windows | — | ❌ |
Development
See DEVELOPMENT.md for architecture, project structure, testing, and build instructions.