Menu
Libraries |
Category

syncrostate

  • Purpose: SyncroState brings Svelte 5 reactivity to multiplayer applications by leveraging Yjs for real-time collaboration. It provides a reactive and type-safe way to manage synchronized state that feels like regular Svelte state.

  • Target Audience: Developers building real-time collaborative applications with Svelte 5, especially those needing seamless state synchronization across clients.

  • Key Features:

    • Powered by Yjs for conflict-free collaboration
    • Type-safe with full TypeScript support
    • Works like regular Svelte state with fine-grained reactivity
    • Supports primitives, arrays, objects, dates, enums, and sets
    • Provider-agnostic (works with Liveblocks, PartyKit, or any Yjs provider)
    • Local persistence and undo/redo support
    • Bindable state with bind:value
  • Svelte Support: Designed specifically for Svelte 5, offering a natural API that integrates with Svelte's reactivity system.

  • How It Works:

    • Uses proxy-based state trees to intercept mutations
    • Validates changes against schema and updates Yjs documents
    • Handles remote updates through Yjs observers
    • Maintains type safety and reactivity at all levels
  • Notable Details:

    • Schema-first approach for defining collaborative state
    • Supports waiting for sync completion with getState().synced
    • Optimized for batch updates to avoid partial state changes
    • Provides access to underlying Yjs types and undo/redo functionality
  • Roadmap:

    • Future plans include support for Set/Map types, recursive types, nested documents, and awareness sharing.

For more details, visit the [GitHub repository](https://github.com/your-repo-link fa-solid fa-up-right-from-square).

crdtsveltesveltehacksveltekityjs

Comments