Java bindings for y-crdt (yrs), providing CRDTs for collaborative editing on the JVM.
Releases are published to Maven Central under the net.carcdr namespace. In-development -SNAPSHOT versions are published to GitHub Packages.
Pull a single module:
// Core interfaces (required)
implementation 'net.carcdr:ycrdt-core:<version>'
// JNI implementation (recommended) - Java 21+
implementation 'net.carcdr:ycrdt-jni:<version>'Or import the BOM and omit individual version numbers to keep all modules aligned:
dependencies {
implementation platform('net.carcdr:ycrdt-bom:<version>')
implementation 'net.carcdr:ycrdt-core'
implementation 'net.carcdr:ycrdt-jni'
implementation 'net.carcdr:yhocuspocus'
// etc.
}Snapshots are published to GitHub Packages on every push to main. To consume them, add the GitHub Packages Maven repository and credentials (a GitHub personal access token with read:packages scope):
repositories {
mavenCentral()
maven {
name = 'GitHubPackages'
url = uri('https://maven.pkg.github.com/edpaget/y-crdt-jni')
credentials {
username = System.getenv('GITHUB_ACTOR') ?: findProperty('gpr.user')
password = System.getenv('GITHUB_TOKEN') ?: findProperty('gpr.key')
}
}
}
dependencies {
// See each module's `version.properties` for the current -SNAPSHOT version,
// or resolve via Gradle's `+` qualifier: 'net.carcdr:ycrdt-core:0.+-SNAPSHOT'
implementation 'net.carcdr:ycrdt-core:<snapshot-version>'
implementation 'net.carcdr:ycrdt-jni:<snapshot-version>'
}import net.carcdr.ycrdt.*;
YBinding binding = YBindingFactory.auto();
try (YDoc doc = binding.createDoc()) {
try (YText text = doc.getText("myText")) {
text.push("Hello, ");
text.push("World!");
System.out.println(text.toString()); // "Hello, World!"
}
// Sync state to another document
byte[] update = doc.encodeStateAsUpdate();
try (YDoc doc2 = binding.createDoc()) {
doc2.applyUpdate(update);
}
}See ycrdt-jni/README.md for more examples.
| Module | Description |
|---|---|
| ycrdt-core | Interfaces: YDoc, YText, YArray, YMap. No native deps. |
| ycrdt-jni | JNI implementation (Rust). Java 21+. |
| ycrdt-panama | Panama FFM implementation. Java 22+. Experimental. |
| yprosemirror | ProseMirror <-> Y-CRDT sync |
| yhocuspocus | Collaborative editing server (transport-agnostic) |
| yhocuspocus-websocket | WebSocket transport (Jetty 12) |
| yhocuspocus-spring-websocket | WebSocket transport (Spring) |
| yhocuspocus-redis | Redis extension for yhocuspocus |
| examples | Full-stack example apps (React + Tiptap + Java) |
| ycrdt-jni | ycrdt-panama | |
|---|---|---|
| Java | 21+ | 22+ |
| Native access | JNI (Rust) | Panama FFM (yffi) |
| JVM args | None | --enable-native-access=ALL-UNNAMED |
| XML types | Yes | Not yet |
| Maturity | More mature | Experimental |
YBinding jni = YBindingFactory.jni(); // explicit JNI
YBinding panama = YBindingFactory.panama(); // explicit Panama
YBinding auto = YBindingFactory.auto(); // first availableRequires Java 21+ and Rust 1.70+ (for building from source). Gradle wrapper included.
./gradlew build # build all modules
./gradlew test # run all tests
./gradlew check # tests + checkstyleSee .claude/CLAUDE.md for development guidelines and per-module PLAN.md files for roadmaps.
Apache License v2.0 -- see LICENSE.
- y-crdt -- Rust CRDT implementation
- jni-rs -- Rust JNI bindings
- Hocuspocus -- inspiration for yhocuspocus