stream-db

Connect a durable stream to TanStack DB collections for reactive queries.

1.7k|64|Updated Dec 4, 2025
One-click install
npx skills add https://github.com/durable-streams/durable-streams --skill stream-db
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: stream-db
Source: https://github.com/durable-streams/durable-streams/tree/main/packages/state/skills/stream-db
Command: npx skills add https://github.com/durable-streams/durable-streams --skill stream-db

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Stream-backed reactive database synchronization between a durable stream and TanStack DB, enabling reactive queries, optimistic actions, and robust transaction handling in modern web apps.

Core Features & Use Cases

  • Reactive queries via TanStack DB collections synced from streams
  • Optimistic actions with server confirmation using awaitTxId
  • Lightweight, lazy initialization with preload and cleanup via close

Quick Start

Create a StreamDB instance with a defined state schema and call preload() to connect and load initial data.

Frequently Asked Questions about stream-db

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I sync a durable stream to TanStack DB collections for reactive queries?

You can sync a durable stream to TanStack DB collections by creating a StreamDB instance with a defined state schema, which establishes a reactive state layer for live queries. Calling preload() connects the stream and loads initial data.

How do optimistic mutations work with server confirmation in a reactive database?

Optimistic mutations in a reactive database apply local changes immediately while awaiting server confirmation using the awaitTxId mechanism. This ensures data consistency once the durable stream confirms the transaction.

How do I initialize and clean up a stream-backed reactive database connection?

Initialize the stream-backed reactive database by calling preload() for lazy loading and connecting to the durable stream. Proper lifecycle management requires calling close() to clean up the connection when done.

Can I use stream-backed reactive state for real-time collaborative tools?

Yes, connecting a durable stream to TanStack DB collections provides a reactive state layer ideal for real-time collaborative tools. It supports live-tailing and optimistic updates required for interactive multi-user workflows.

Does TanStack DB support live-tailing from durable streams for AI-powered workflows?

TanStack DB supports live-tailing from durable streams through StreamDB integration, enabling reactive queries for AI-powered workflows. This provides continuous data synchronization and optimistic actions with server confirmation.

What is the best way to handle transaction IDs for optimistic updates in a reactive state layer?

The best way to handle transaction IDs for optimistic updates is using the awaitTxId mechanism within the reactive state layer. This tracks server confirmation from the durable stream to validate local mutations.