A standalone yjs server with persistence to blob storage.

Overview

y-sweet: a Yjs server with persistence and auth

y-sweet is an open-source server for building realtime applications on top of the Yjs CRDT library.

Features

  • Persists document data to a network filesystem or S3-compatible storage, inspired by Figma’s infrastructure.
  • Scales horizontally with a session backend model.
  • Deploys as a native Linux process, or as a WebAssembly module on Cloudflare's edge.
  • Provides document-level access control via client tokens.
  • Written in Rust with a focus on stability and performance, building on the excellent y-crdt library.

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.

  • @y-sweet/sdk, a TypeScript library for interacting with y-sweet-server from your application backend.
  • @y-sweet/react, a React hooks library for building Yjs applications.
  • A debugger for exploring Yjs document and presence state (WIP).

The goal of the y-sweet stack is to give developers the end-to-end developer ergonomics they would expect from a proprietary state-sync platform, without the lock-in.

y-sweet is MIT-licensed, and was created by Drifting in Space.

Comments
  • try to fix types and tests

    try to fix types and tests

    This makes the tests directory an npm workspace and switches to tsup for building our typescript projects.

    To test this out:

    1. Pull down this branch
    2. Run npm install in the root or any workspace (will trigger an npm install for all workspaces)
    3. Run npm run dev in js-pkg/react and/or js-pkg/sdk
    4. Make some breaking changes
    5. Run npm test from tests

    Tests should fail.

    opened by rolyatmax 7
  • Standardize tokens

    Standardize tokens

    This standardizes token as the name for a type that provides information for connecting to a resource, comprising of "server tokens" for connecting from the server and "client tokens" for connecting to a particular document from the client.

    The fields each token has in common are also standardized.

    Previously, we referred to a ClientToken interchangeably as an "AuthDocResponse" and as a "connection key", which is confusing.

    It also changes field names to one-word names: doc_id -> doc; base_url and endpoint -> url. This way they are idiomatic on both the rust side and JS side.

    This is a breaking change, so I wanted to do it before launching.

    opened by paulgb 2
  • Put fetch handler behind a feature flag

    Put fetch handler behind a feature flag

    Since the fetch handler is exposed externally, anything that imports this as a library will have the fetch handler exposed externally, potentially conflicting with its own fetch handler. This avoids that.

    Also splits out the durable object code into its own module, and makes modules public.

    opened by paulgb 2
  • Implement and test permissions on cloudflare

    Implement and test permissions on cloudflare

    We can't easily inject an environment variable into the worker, so a private key for testing is hard-coded in the config.

    This PR also makes error handling on the Cloudflare worker side more robust.

    opened by paulgb 2
  • Add presence hook and barebones demo to test it

    Add presence hook and barebones demo to test it

    Adds a presence hook. Keeps the existing awareness hook to obtain the raw Awareness value (useful for passing to components like CodeMirror), but adds a usePresence hook that works like we discussed.

    The demo is just there to confirm that it works; feel free to run with it and turn it into something cooler.

    opened by paulgb 2
  • Add prettier config and run it on JS

    Add prettier config and run it on JS

    Also adds a github workflow to ensure that prettier has run.

    We may also want to run eslint in the workflow, but I'll wait for #3 to land for that as I think it fixes an eslint warning.

    opened by paulgb 2
  • Enable https/wss as an option

    Enable https/wss as an option

    We need to return a fully-qualified URL to the client to connect to. The server itself doesn't know by default (or from a request) whether it is behind an encrypting reverse proxy, so it doesn't know whether it should return a ws:// or wss:// URL. The solution is simply to tell the server when we want a wss:// URL instead.

    In the native server, this is invoked by passing --use-https when starting the server. For the cloudflare worker, it's invoked by setting the USE_HTTPS variable to true.

    This also sets the production config (used for staging) so that it uses wss://.

    opened by paulgb 2
  • Allow region to be specified via env vars

    Allow region to be specified via env vars

    • Allow region to be specified via env vars.
    • Remove some panics and add some error context.
    • Fixed an issue where 404s were not being propagated correctly from s3-rust because a feature flag was disabled.
    opened by paulgb 1
  • Allow using without a store

    Allow using without a store

    Currently we require a store to be passed on the cli. For local development, it's sometimes nice to use an ephemeral in-memory store without persisting.

    This PR changes store from a positional to an explicit argument. If it is not passed, document state is not persisted.

    After #56 is merged, which adds a --prod flag, we should probably fail to start with an in-memory store (or at least log an error-level log) if --prod is passed.

    opened by paulgb 1
Owner
drifting in space
Open-source infrastructure for realtime applications.
drifting in space
A language server for lua written in rust

lua-analyzer lua-analyzer is a lsp server for lua. This is mostly for me to learn the lsp protocol and language analysis so suggestions are helpful. T

null 61 Dec 11, 2022
Locast to Emby/Plex/Channels server

This application provides an interface between locast.org and Media Servers like Plex Media Server (PMS) and Emby by acting like an HDHomerun or an m3u tuner and an XMLTV provider.

Wouter de Bie 51 Sep 10, 2022
Björn - The AS207960 ACME server

Björn - The AS207960 ACME server Björn is not a full CA upon to itself, but contains many of the building blocks of a complete ACME CA. Components Bjö

AS207960 / Glauca 5 Feb 17, 2022
Rust 版本的 UnblockNeteaseMusic/server ,以效能、穩定性及可維護性為目標。

【開發中】unm-server-rust Rust 版本的 UnblockNeteaseMusic/server ,以效能、穩定性及可維護性為目標。 安裝 最新版本 下載二進位檔案 前往 Actions 分頁找到 “Build binaries for UNM“,點開後可從 Artifacts 中

Unblock Netease Music 维护小组 123 Dec 26, 2022
Automatically download minecraft server jars in one line

MCDL Automatically download minecraft server jars in one line (or one click) Installation Download (Windows, Linux) Install via cargo: cargo install m

Isaac Hirschfeld 1 Oct 26, 2021
Unofficial Bitwarden compatible server written in Rust, formerly known as bitwarden_rs

Alternative implementation of the Bitwarden server API written in Rust and compatible with upstream Bitwarden clients*, perfect for self-hosted deploy

Daniel García 21.5k Jan 8, 2023
Axum server starter template

Axum Starter Template A template to get started with Axum Features Tracing and bunyan formatting SQLx support (with testing) Server as library Example

Jordan 2 Jan 15, 2022
A language server implementation for the WGSL shading language

wgsl-analyzer wgsl-analyzer is a language server plugin for the WGSL Shading language. It comes with a VS Code plugin located in ./editors/code, but d

null 155 Jan 2, 2023
A small in-house bot of the TTC Discord Server

Welcome to The Terminal cafe Support Bot Repository Hello, hope you are having a nice day. This is the official repository for The Terminal Cafe Suppo

null 5 Jul 4, 2022
Lightweight tool for simple deployment (server+client)

deploy Lightweight tool for simple deployment (server+client) Usage You first need a key value pair: deploy generate-keys Public-Key: Used on the serv

Jan-Mirko Otter 0 Dec 27, 2021
A server to continously poll nearly always-on sites to verify that your internet connectivity stays up

Dead Router A server to continously poll nearly always-on sites to verify that your internet connectivity stays up! If one or more of the servers stop

null 0 Feb 5, 2022
Proxmox Backup Server and Client

Build & Release Notes rustup Toolchain We normally want to build with the rustc Debian package. To do that you can set the following rustup configurat

Read-Only Proxmox Projects Repository Clone. 26 Dec 26, 2022
xrd a next-gen server controller for TrackMania Forever and Nations ESWC

xrd is a next-gen server controller for TrackMania Forever and Nations ESWC that is designed to be hassle-free and easily updatable (with a bus factor of 0).

Autumn Leaf 6 Mar 26, 2022
The missing link to modern server controlling for TrackMania Forever.

xrd (XASeCo Replacing Daemon) xrd is a next-gen server controller for TrackMania Forever and Nations ESWC that is designed to be hassle-free and easil

Autumn Leaf 6 Mar 26, 2022
Rust implementation for Wlroots (Sway, Wayfire, Hikari, River, etc.) of Gnome Screenshot and Idle DBUS Server, which Upwork uses to capture the screen as proof of work.

?? upwork-wlroots-bridge ?? Rust Implementation for Wlroots (Sway, Wayfire, Hikari, River, etc.) of Gnome Screenshot and Idle DBUS Server (with extra

Daniel Moretti V. 4 Jan 2, 2023
Basic ActivityPub Server (in Rust)

Basic ActivityPub Server (in Rust) This is a deep-dive on this blog post: https://blog.joinmastodon.org/2018/06/how-to-implement-a-basic-activitypub-s

Mat 10 Nov 24, 2022
A rust(serenity) based discord bot for the hacksquad discord server

A Discord Bot for Hacksquad How to Deploy? Requirements Docker Docker Compose Steps To Run Copy the docker-compose.yml and .env.example files to your

HackSquad 5 Jan 4, 2023
A Github webhook server to help with CI/CD written in Rust.

This application will automatically updates local GitHub repositories and triggers a command once the update is complete. This can be extremely useful

Luca 9 Apr 4, 2023
Erlang Language Platform. LSP server and CLI.

Erlang Language Platform (ELP) Description ELP integrates Erlang into modern IDEs via the language server protocol. ELP was inspired by rust-analyzer.

WhatsApp 31 Aug 7, 2023