{"id":19562684,"url":"https://github.com/jamsocket/y-sweet","last_synced_at":"2025-05-14T13:09:38.969Z","repository":{"id":185468010,"uuid":"667457002","full_name":"jamsocket/y-sweet","owner":"jamsocket","description":"A realtime CRDT-based document store, backed by S3.","archived":false,"fork":false,"pushed_at":"2025-04-25T16:01:05.000Z","size":3072,"stargazers_count":807,"open_issues_count":21,"forks_count":44,"subscribers_count":8,"default_branch":"main","last_synced_at":"2025-05-11T18:47:17.146Z","etag":null,"topics":["crdt","multiplayer","yjs"],"latest_commit_sha":null,"homepage":"https://docs.jamsocket.com/y-sweet","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jamsocket.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-07-17T14:44:25.000Z","updated_at":"2025-05-11T15:59:42.000Z","dependencies_parsed_at":null,"dependency_job_id":"bf0c4a1a-359e-4a1b-a6d6-55b442c4a138","html_url":"https://github.com/jamsocket/y-sweet","commit_stats":{"total_commits":443,"total_committers":13,"mean_commits":34.07692307692308,"dds":0.2257336343115124,"last_synced_commit":"68b9d120abe97c4b335aa98593ac22c08d5eaba1"},"previous_names":["drifting-in-space/y-sweet","jamsocket/y-sweet"],"tags_count":29,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamsocket%2Fy-sweet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamsocket%2Fy-sweet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamsocket%2Fy-sweet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamsocket%2Fy-sweet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jamsocket","download_url":"https://codeload.github.com/jamsocket/y-sweet/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253617961,"owners_count":21936896,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["crdt","multiplayer","yjs"],"created_at":"2024-11-11T05:15:21.996Z","updated_at":"2025-05-14T13:09:33.939Z","avatar_url":"https://github.com/jamsocket.png","language":"Rust","funding_links":[],"categories":["Rust","⚙️ Development Tools \u0026 Libraries"],"sub_categories":["Database Solutions"],"readme":"\u003cimg src=\"https://raw.githubusercontent.com/jamsocket/y-sweet/main/logo.svg\" /\u003e\n\n# Y-Sweet: a realtime CRDT-based document store, backed by object storage\n\n[![GitHub Repo stars](https://img.shields.io/github/stars/jamsocket/y-sweet?style=social)](https://github.com/jamsocket/y-sweet)\n[![Chat on Discord](https://img.shields.io/discord/939641163265232947?color=404eed\u0026label=discord)](https://discord.gg/N5sEpsuhh9)\n\n**Y-Sweet** is an open-source document store and realtime sync backend, built on top of the [Yjs](https://github.com/yjs/yjs) CRDT library.\n\n## Features\n\n- Persists document data to S3-compatible storage, [like Figma](https://digest.browsertech.com/archive/browsertech-digest-figma-is-a-file-editor/).\n- Scales horizontally with a [session backend](https://jamsocket.com/blog/session-backends) model.\n- Deploys as a native Linux process.\n- Provides document-level access control via client tokens.\n- Written in Rust with a focus on stability and performance.\n\n## Y-Sweet stack\n\nThe 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.\n\n- `create-y-sweet-app`, a command line tool to quickly create a Y-Sweet app.\n- `@y-sweet/sdk`, a TypeScript library for interacting with `y-sweet-server` from your application backend.\n- `@y-sweet/client`, a TypeScript library for syncing documents from a client to a Y-Sweet server.\n- `@y-sweet/react`, a library of React hooks for connecting to a Y-Sweet server and manipulating Yjs docs.\n- A [debugger](https://docs.jamsocket.com/y-sweet/features/debugger) for exploring Yjs document and presence state.\n\nY-Sweet is MIT-licensed, and was created by [Jamsocket](https://jamsocket.com).\n\n## Getting started\n\nThe easiest way to start a Y-Sweet project is with the `create-y-sweet-app` command line tool:\n\n```sh\nnpx create-y-sweet-app@latest\n```\n\nFor more information, check out our [documentation](https://docs.jamsocket.com/y-sweet).\n\n## Docs\n\n- [API docs](https://docs.jamsocket.com/y-sweet)\n    - [TypeScript client](https://docs.jamsocket.com/y-sweet/reference/client)\n    - [React hooks](https://docs.jamsocket.com/y-sweet/reference/react)\n    - [Document management SDK](https://docs.jamsocket.com/y-sweet/reference/sdk)\n- [Y-Sweet on Jamsocket (managed service) docs](https://docs.jamsocket.com/y-sweet/quickstart)\n- [Self Hosting and Running Locally](https://github.com/jamsocket/y-sweet/blob/main/docs/running.md)\n\n## Examples\n\nExplore our [collaborative examples](https://github.com/jamsocket/y-sweet/tree/main/examples) to help you get started or [play with them live](https://demos.y-sweet.dev/).\n\n### Examples using Yjs Editor Bindings\n- CodeMirror Editor - [see code](https://github.com/jamsocket/y-sweet/tree/main/examples/nextjs/src/app/(demos)/code-editor) | [see live](https://demos.y-sweet.dev/code-editor)\n- Monaco Editor - [see code](https://github.com/jamsocket/y-sweet/tree/main/examples/nextjs/src/app/(demos)/monaco) | [see live](https://demos.y-sweet.dev/monaco)\n- BlockNote - [see code](https://github.com/jamsocket/y-sweet/tree/main/examples/nextjs/src/app/(demos)/blocknote) | [see live](https://demos.y-sweet.dev/blocknote)\n- Quill Editor - [see code](https://github.com/jamsocket/y-sweet/tree/main/examples/nextjs/src/app/(demos)/text-editor) | [see live](https://demos.y-sweet.dev/text-editor)\n- Slate Rich Text Editor - [see code](https://github.com/jamsocket/y-sweet/tree/main/examples/nextjs/src/app/(demos)/slate) | [see live](https://demos.y-sweet.dev/slate)\n\n## Usage\n\nCheck the [vanilla js example](/examples/vanilla/) for more details.\n\n### On the client\n``` js\nimport * as Y from 'yjs';\nimport { createYjsProvider } from '@y-sweet/client';\n\n// Create the Yjs doc and link it to the Y-Sweet server:\nconst doc = new Y.Doc();\nconst docId = 'my-doc-id';\ncreateYjsProvider(doc, docId, '/api/my-auth-endpoint');\n\n// Now use the doc like a normal Yjs doc!\nlet mySharedMap = doc.getMap('thing');\nmySharedMap.set(\"foo\", 123);\n\n// Update your UI based on `mySharedMap` changes like this, for example:\nmySharedMap.observe((event) =\u003e {\n  event.keysChanged.forEach((key) =\u003e {\n    // do whatever you want based on the detected change:\n    yourUpdateFunction(key, mySharedMap.get(key));\n  });\n});\n```\n\n### On the server\n``` js\nimport { DocumentManager } from '@y-sweet/sdk';\n\n// 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\nconst manager = new DocumentManager(CONNECTION_STRING);\n\n// create an endpoint that auths your user and returns a Y-Sweet client token\nexport async function POST(request) {\n  // in a production app, you'd want to authenticate the user\n  // and make sure they have access to the given doc\n  const body = await request.json();\n  const docId = body.docId;\n  const clientToken = await manager.getOrCreateDocAndToken(docId);\n  return Response.json(clientToken);\n}\n```\n\n#### Running the Y-Sweet server locally\n\nIf you have `npm`, the fastest way to run a local server is with `npx`:\n\n```bash\nnpx y-sweet@latest serve\n```\n\nThis will download the Y-Sweet server if you do not already have it, and run it.\n\nBy default, `y-sweet serve` does not write data to disk. You can specify a directory to persist data to, like this:\n\n```bash\nnpx y-sweet@latest serve /path/to/data\n```\n\nIf 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`.\n\n## Packages\n\n### Server\n\n| Package Manager | Name | Version | Path |\n| --- | ---- | ---- | ---- |\n| npm | `y-sweet` | [![npm](https://img.shields.io/npm/v/y-sweet)](https://www.npmjs.com/package/y-sweet) | `js-pkg/server`\n| crates.io | `y-sweet` | [![crates.io](https://img.shields.io/crates/v/y-sweet.svg)](https://crates.io/crates/y-sweet) | `crates/y-sweet` |\n| crates.io | `y-sweet-core` | [![crates.io](https://img.shields.io/crates/v/y-sweet-core.svg)](https://crates.io/crates/y-sweet-core) | `crates/y-sweet-core` |\n\n### Client\n\n| Package Manager | Name | Version | Path |\n| --- | ---- | ---- | ---- |\n| npm | `@y-sweet/sdk` | [![npm](https://img.shields.io/npm/v/@y-sweet/sdk)](https://www.npmjs.com/package/@y-sweet/sdk) | `js-pkg/sdk` |\n| npm | `@y-sweet/client` | [![npm](https://img.shields.io/npm/v/@y-sweet/client)](https://www.npmjs.com/package/@y-sweet/client) | `js-pkg/client` |\n| npm | `@y-sweet/react` | [![npm](https://img.shields.io/npm/v/@y-sweet/react)](https://www.npmjs.com/package/@y-sweet/react) | `js-pkg/react` |\n| pypi | `y-sweet-sdk` | [![pypi](https://img.shields.io/pypi/v/y-sweet-sdk)](https://pypi.org/project/y-sweet-sdk/) | `python/y_sweet_sdk` |\n\n## Hosted Y-Sweet on Jamsocket\n\nYou can run Y-Sweet on your own server, or you can run it on [Jamsocket](https://jamsocket.com/y-sweet). Jamsocket is purpose-built to scale up sync backends like Y-Sweet, and allows you to bring your own storage.\n\nYou can try it out for free today by following our [quickstart](https://docs.jamsocket.com/y-sweet/quickstart) guide.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjamsocket%2Fy-sweet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjamsocket%2Fy-sweet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjamsocket%2Fy-sweet/lists"}