@cbnsndwch/zero-sources

Home

A collection of utilities and custom change sources for @rocicorp/zero

Zero Sources is a comprehensive TypeScript-based infrastructure for building real-time data synchronization systems using Rocicorp Zero. This monorepo provides reusable libraries, change source implementations, and demo applications for streaming MongoDB changes to Zero clients.

What is Zero Sources?

Zero Sources implements a distributed three-container architecture:

  1. Change Source Servers: Stream MongoDB changes to Zero protocol
  2. Zero Cache Servers: Handle client synchronization and caching
  3. Demo Applications: Showcase real-time capabilities

Key Features

  • MongoDB Change Streaming: Real-time change detection and propagation
  • Discriminated Union Support: Handle polymorphic MongoDB collections
  • Watermark Management: Multiple storage backends (ZQLite, NATS KV)
  • WebSocket Gateway: Real-time bidirectional communication
  • Dynamic Schema Configuration: Application-agnostic change sources
  • TypeScript-First: Full type safety across the stack

Getting Started

Architecture Overview

Zero Sources uses a schema-first design where you define your data structures using Zero's TableSchema, then configure change sources to stream MongoDB changes matching those schemas.

// Define your schema
export const messageSchema = createTableSchema({
    tableName: 'message',
    columns: {
        id: { type: 'string' },
        content: { type: 'string' },
        createdAt: { type: 'number' }
    },
    primaryKey: ['id']
});

// Stream changes automatically
const changeSource = new MongoDBChangeSource(schema);
changeSource.streamChanges();

Community & Support

  • GitHub: rocicorp/zero-sources
  • Issues: Report bugs and request features
  • Discussions: Ask questions and share ideas

Ready to get started? Check out our installation guide or dive into the quick start tutorial.

How was this page?