Real-time data sync · PostgreSQL → in-memory

Laredo

Your database, live in your application's memory.

Laredo captures a consistent baseline snapshot of your tables, then streams every subsequent change — inserts, updates, deletes, truncates — through pluggable targets: indexed in-memory replicas, HTTP sync, replication fan-out, durable snapshots. The engine owns the hard parts — logical replication, ACK coordination, backpressure, error isolation, TTL, and snapshots — behind clean Go interfaces. This is the living documentation: how it works, the decisions behind it, and how to build, run, and operate it.

Quick start → Architecture Interactive diagrams

Three layers: a zero-opinion core library, optional modules (gRPC, config, metrics), and a pre-built laredo-server.

What it is

Laredo sits between your database and your application's in-memory state. Each pipeline binds a source, a table, optional filters/transforms, and a target. Sources are shared; the engine demuxes changes by table and dispatches to targets, advancing the ACK only once every target on a source confirms durability. The path every row takes:

1 baseline snapshot 2 stream changes 3 filter / transform 4 dispatch by table 5 apply to target ack when durable

How data flows

One PostgreSQL logical-replication slot feeds the engine; the engine fans each change out to the targets bound to that table — an indexed in-memory replica for lookups, an HTTP sync target, a replication fan-out target serving many downstream clients. A change is acknowledged back to the source only after every target has it.

Fan-out to many readers

The fan-out target multiplexes one slot to N clients over gRPC: each client gets a consistent snapshot, then a live journal stream with heartbeats. Clients resume by source position (WAL LSN), so they survive a server redeploy without a full re-sync.

What it gives you

Consistent baselines

A point-in-time snapshot at a known WAL position, then a gapless change stream from exactly there. No missed or duplicated rows across the handoff.

Snapshots ↗

Pluggable targets

Indexed in-memory replicas, compiled domain objects, HTTP sync, replication fan-out — or your own, behind one small interface.

Targets ↗

Replication fan-out

One slot, many in-memory clients over gRPC, with snapshot + journal + cross-instance failover by WAL LSN.

Fan-out ↗

Durable snapshot + diff archive

The snapshot writer materializes a table to object storage as base snapshots plus diffs, indexed by a manifest — for cold and cross-account consumers.

EDR-0001 ↗

ACK & backpressure

The engine advances the source ACK only when every target is durable, and applies backpressure or error isolation per pipeline.

Ordering & delivery ↗

Zero-opinion core

The library has no opinion on config, transport, or logging. Embed it, or run the pre-built laredo-server with HOCON config and gRPC.

Library usage ↗

Find your way around