Skip to content

Latest commit

 

History

242 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Y-CRDT JNI

CI License: Apache 2 Javadoc

Java bindings for y-crdt (yrs), providing CRDTs for collaborative editing on the JVM.

Installation

Releases are published to Maven Central under the net.carcdr namespace. In-development -SNAPSHOT versions are published to GitHub Packages.

Released versions (Maven Central)

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.
}

Snapshot versions (GitHub Packages)

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>'
}

Usage

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.

Modules

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)

JNI vs Panama

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 available

Documentation

Development

Requires 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 + checkstyle

See .claude/CLAUDE.md for development guidelines and per-module PLAN.md files for roadmaps.

License

Apache License v2.0 -- see LICENSE.

Acknowledgments

About

No description, website, or topics provided.

Resources

Stars

4 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages