CDC WAL Streaming.
MeltyBase provides ultra-low latency data synchronization by introspecting the Postgres Write-Ahead Log (WAL). This Change Data Capture (CDC) engine eliminates the need for database triggers or constant polling, ensuring your clients stay in sync with zero overhead.
The CDC Engine Architecture
Unlike traditional realtime systems that use NOTIFY/LISTEN or Polling, MeltyBase implements a high-performance Logical Replication consumer built in Go. It connects directly to the Postgres replication stream, decoding binary WAL data into structured JSON events in real-time.
Zero-Trigger Model
Changes are captured from the log, meaning your write latency remains unaffected by the number of subscribers.
Sovereign PubSub
Messages are routed through an internal Redis-backed PubSub mesh, ensuring data never leaves your private infrastructure.
Native Logical Replication
MeltyBase utilizes the pglogrepl protocol to create a stable, low-latency handshake with the Postgres 16 core. It manages replication slots and publication state automatically.
// Internal Replication Handshake
slotName := "melty_realtime";
pluginArgs := []string{"proto_version '1'", "publication_names 'melty_pub'"};
pglogrepl.StartReplication(ctx, conn, slotName, sysident.XLogPos, options);
Real-time Event Payloads
Events are delivered as structured JSON objects containing the action type, table name, and the affected record. Supported actions include INSERT, UPDATE, and DELETE.
{
"table": "public.orders",
"action": "INSERT",
"record": {
"id": "550e8400-e29b-41d4-a716-446655440000",
"status": "completed",
"amount": 299.99
},
"timestamp": "2026-05-03T02:40:00Z"
}
Real-time PII Masking (Sentinel)
Before a change event is broadcast to a client, MeltyBase introspects the payload and automatically masks sensitive fields. This ensures that PII (Personally Identifiable Information) never leaks to unauthorized frontends via the WebSocket stream.
- Sensitive Keys:
email,password,token,secret,key,phone,full_name. - Masking Strategy: Partial redaction (e.g.
u***[email protected]) or total replacement with[REDACTED].
Topic Hierarchy & Routing
MeltyBase utilizes a hierarchical topic structure to route events to the correct projects and tables with surgical precision.
- Table-Specific:
realtime:<project_id>:<table_name> - Project-Wildcard:
realtime:<project_id>:* - Global-Sovereign:
realtime:global:<table_name>(Admin Only)