Overview

Send and subscribe to real-time events with zero setup.

Litebase Streams are real-time, append-only event channels. They let you push events from one part of your system and receive them instantly elsewhere — without polling, brokers, or queue infrastructure.

Streams are ideal for reactive systems, background workflows, cross-service coordination, and real-time dashboards. Every event is immutable, timestamped, and tied to a transaction.

Why Streams?

Modern apps are built around change: user actions, model updates, data pipeline events. Traditional systems often force you to choose between performance, durability, and observability.

Streams solve that with a clean, composable model:

  • Publish an event to capture something that happened
  • Subscribe to those events and react in real time
  • Replay the past to debug, reprocess, or backfill data

Core Properties

Append-only

Streams are immutable logs. Events are never updated or deleted — they are only appended. This ensures:

  • Causal ordering
  • Deterministic replay
  • Durable audit trails

Real-time delivery

Subscribers receive events the moment they’re committed. No polling. No delays.

Litebase uses push-based transports like SSE, WebSocket, or webhook-style fan-out.

Replayable

All events are timestamped and versioned. You can replay:

  • From the beginning
  • From any point in time
  • From a known transaction

This makes it easy to recover from failure or reprocess data with new logic.

Unified timeline

Every stream event is part of the same global timeline as your storage writes. This means:

  • You can correlate events with versioned state
  • You can snapshot or rewind the entire system
  • You can build workflows that mix reads, writes, and events safely

Event Structure

Every stream event includes:

  • stream: the name of the channel
  • time: when the event was committed
  • tx: the transaction ID (shared with related writes)
  • data: your custom event payload

Example:

{
  "time": "2025-04-05T12:00:00Z",
  "tx": "tx_7a29d1a3",
  "stream": "payment.success",
  "data": {
    "order_id": "ord_123",
    "amount": 49.00
  }
}

Composable Behavior

Streams are lightweight but powerful. You can use them to:

  • Drive async workflows
  • Trigger downstream services
  • Coordinate distributed agents
  • Update UIs as data changes

And because they’re versioned and replayable, you can always catch up or start over.