랭킹으로 돌아가기

jamsocket/y-sweet

Rustdocs.jamsocket.com/y-sweet

A realtime CRDT-based document store, backed by S3.

crdtmultiplayeryjs
스타 성장
스타
1k
포크
82
주간 성장
이슈
24
5001k
2023년 8월2024년 7월2025년 7월2026년 7월
아티팩트crates.iocargo add y-sweet
README

Y-Sweet: a realtime CRDT-based document store, backed by object storage

GitHub Repo stars Chat on Discord

Y-Sweet is an open-source document store and realtime sync backend, built on top of the Yjs CRDT library.

Features

  • Persists document data to S3-compatible storage, like Figma.
  • Scales horizontally with a session backend model.
  • Deploys as a native Linux process.
  • Provides document-level access control via client tokens.
  • Written in Rust with a focus on stability and performance.

Y-Sweet stack

The Y-Sweet server can be used by any Yjs app, or you can use our opinionated stack to integrate Yjs and Y-Sweet into a Next.js app.

  • create-y-sweet-app, a command line tool to quickly create a Y-Sweet app.
  • @y-sweet/sdk, a TypeScript library for interacting with y-sweet-server from your application backend.
  • @y-sweet/client, a TypeScript library for syncing documents from a client to a Y-Sweet server.
  • @y-sweet/react, a library of React hooks for connecting to a Y-Sweet server and manipulating Yjs docs.
  • A debugger for exploring Yjs document and presence state.

Y-Sweet is MIT-licensed, and was created by Jamsocket.

Getting started

The easiest way to start a Y-Sweet project is with the create-y-sweet-app command line tool:

npx create-y-sweet-app@latest

For more information, check out our documentation.

Docs

Examples

Explore our collaborative examples to help you get started or play with them live.

Examples using Yjs Editor Bindings

Usage

Check the vanilla js example for more details.

On the client

import * as Y from 'yjs';
import { createYjsProvider } from '@y-sweet/client';

// Create the Yjs doc and link it to the Y-Sweet server:
const doc = new Y.Doc();
const docId = 'my-doc-id';
createYjsProvider(doc, docId, '/api/my-auth-endpoint');

// Now use the doc like a normal Yjs doc!
let mySharedMap = doc.getMap('thing');
mySharedMap.set("foo", 123);

// Update your UI based on `mySharedMap` changes like this, for example:
mySharedMap.observe((event) => {
  event.keysChanged.forEach((key) => {
    // do whatever you want based on the detected change:
    yourUpdateFunction(key, mySharedMap.get(key));
  });
});

On the server

import { DocumentManager } from '@y-sweet/sdk';

// Pass in a CONNECTION_STRING, which you can get from a Y-Sweet service in the Jamsocket dashboard or from running npx y-sweet@latest serve locally
const manager = new DocumentManager(CONNECTION_STRING);

// create an endpoint that auths your user and returns a Y-Sweet client token
export async function POST(request) {
  // in a production app, you'd want to authenticate the user
  // and make sure they have access to the given doc
  const body = await request.json();
  const docId = body.docId;
  const clientToken = await manager.getOrCreateDocAndToken(docId);
  return Response.json(clientToken);
}

Running the Y-Sweet server locally

If you have npm, the fastest way to run a local server is with npx:

npx y-sweet@latest serve

This will download the Y-Sweet server if you do not already have it, and run it.

By default, y-sweet serve does not write data to disk. You can specify a directory to persist data to, like this:

npx y-sweet@latest serve /path/to/data

If the directory starts with s3://, Y-Sweet will treat it as an S3-compatible bucket path. In this case, Y-Sweet will pick up your local AWS credentials from the environment. If you do not have AWS credentials set up, you can set them up with aws configure.

Packages

Server

Package Manager Name Version Path
npm y-sweet npm js-pkg/server
crates.io y-sweet crates.io crates/y-sweet
crates.io y-sweet-core crates.io crates/y-sweet-core

Client

Package Manager Name Version Path
npm @y-sweet/sdk npm js-pkg/sdk
npm @y-sweet/client npm js-pkg/client
npm @y-sweet/react npm js-pkg/react
pypi y-sweet-sdk pypi python/y_sweet_sdk

Hosted Y-Sweet on Jamsocket

You can run Y-Sweet on your own server, or you can run it on Jamsocket. Jamsocket is purpose-built to scale up sync backends like Y-Sweet, and allows you to bring your own storage.

You can try it out for free today by following our quickstart guide.

관련 저장소
toeverything/AFFiNE

There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.

TypeScriptnpmOthereditorcrdt
affine.pro
70.7k5.1k
pubkey/rxdb

The local-first database that runs on every JS runtime and replicates with your existing backend - no vendor, no lock-in - https://rxdb.info/

TypeScriptnpmApache License 2.0databasenosql
rxdb.info
23.3k1.2k
yjs/yjs

Shared data types for building collaborative software

JavaScriptnpmOtheryjscrdt
docs.yjs.dev
22.2k791
amark/gun

An open source cybersecurity protocol for syncing decentralized graph data.

JavaScriptnpmOthermachine-learningartificial-intelligence
gun.eco/docs
19.1k1.2k
automerge/automerge-classic

A JSON-like data structure (a CRDT) that can be modified concurrently by different users, and merged again automatically.

JavaScriptnpmMIT Licensecrdtjavascript
automerge.org
14.7k460
electric-sql/electric

The agent platform built on sync.

TypeScriptnpmApache License 2.0elixirpostgres
electric.ax
10.3k349
berty/berty

Berty is a secure peer-to-peer messaging app that works with or without internet access, cellular data or trust in the network

TypeScriptnpmOtherbertyipfs
berty.tech
9.2k496
orbitdb/orbitdb

Peer-to-Peer Databases for the Decentralized Web

JavaScriptnpmMIT Licensep2pdistributed
8.8k596
supabase/realtime

Broadcast, Presence, and Postgres Changes via WebSockets

ElixirApache License 2.0elixirpostgres
supabase.com/realtime
7.6k451
toeverything/blocksuite

🧩 Content editing tech stack for the web - BlockSuite is a toolkit for building editors and collaborative applications.

TypeScriptnpmMozilla Public License 2.0blockcollaboration
blocksuite.io
5.9k559
loro-dev/loro

Make your JSON data collaborative and version-controlled with CRDTs

Rustcrates.ioMIT Licensecrdtlocal-first
loro.dev
5.9k159
tinyplex/tinybase

A reactive data store & sync engine.

TypeScriptnpmMIT Licensereactjavascript
tinybase.org
5.1k130