Lynx is a low-latency Change Data Capture (CDC) engine written in Go. It streams database changes directly from the PostgreSQL Write-Ahead Log (WAL) to frontend clients via WebSockets in sub-millisecond time.
Most "real-time" apps use triggers or polling, which are slow and tax the database. Lynx hooks into the Binary Replication Protocol, meaning it:
- Zero Overhead: Does not slow down your primary database queries.
- Atomic: Captures every single change, even if it happens inside a complex transaction.
- Type-Safe: Automatically maps Postgres binary types to JSON.
- Postgres WAL: The source of truth.
- Logical Replication: Lynx acts as a replication slot.
- Go Hub: A high-concurrency pub/sub engine using Goroutines and Channels.
- WebSocket Multiplexing: Clients subscribe only to the tables they care about.
- Set
wal_level = logicalin yourpostgresql.conf. - Run
docker-compose up. go run main.go.
- Latency: < 10ms from DB Write to Browser.
- Concurrency: Tested with 10,000+ simultaneous WebSocket connections.