New to Jamsocket – Y-Sweet, our Yjs server for realtime apps.Learn More

Y-Sweet on Jamsocket

Realtime in no time.

Y-Sweet is the open-source Yjs server with persistence built in.

Integrate with ease

Deploy a collaborative editor in minutes with our Typescript SDK and client-side React hooks.

1

Install Y-Sweet

npm install @y-sweet/sdk
npm install @y-sweet/react

2

Create an API route to auth your users

import { getOrCreateDocAndToken } from '@y-sweet/sdk'

export const POST = async (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
    getOrCreateDocAndToken(process.env.CONNECTION_STRING, docId)
  return NextResponse.json(clientToken)
}

3

Wrap your app in a YDocProvider

import { YDocProvider } from '@y-sweet/react'
import { MyApp } from './my-app'

export default function MyComponent() {
  const docId = 'my-doc-id'
  return (
    <YDocProvider
      docId={docId}
      authEndpoint="/api/auth-doc"
    >
      <MyApp />
    </YDocProvider>
  )
}

4

Use Y-Sweet hooks and Yjs Shared Types to sync document edits

import { useMap } from '@y-sweet/react'

export function MyApp() {
  const items = useMap('colorgrid')

  // edits to the document are automatically synced in the background
  items.set(key, value)
  items.delete(key)
}

Say goodbye to lock in.

Open source and MIT-Licensed.

Storage on your terms.

Every document is automatically persisted when you link your own S3 storage to Y-Sweet.

Presence and multiplayer.

Multiple clients can connect for multiplayer editing. Add presence features like live cursors and live avatars using Y-Sweet's presence hooks.

Open source.

Y-Sweet is completely open-source and is built on top of Yjs, the leading open-source CRDT implementation.

Serverless.

Get up and running in minutes with Y-Sweet on Jamsocket. No need to run your own Y-Sweet server.

Build collaborative apps of all kinds

Check out our demos, ranging from to-do lists to voxel editors.

Voxel Editor Demo

Voxel Editor

Build cool voxel worlds collaboratively.

Text Editor Demo

Text Editor with Quill

A collaborative text editor built on top of the open source Quill package.

To Do List Demo

To Do List

Create and edit items in a collaborative to do list.

Code Editor Demo

Code Editor with CodeMirror

A collaborative code editor built on top of CodeMirror.

Ready to build?

Getting started is simple and quick. Explore documentation, or sign up and start building today.

Jamsocket