Java
Java modules for Cloudflare R2 and D1, local storage, JDBC, and framework integrations.
Java documentation →R2D1 / MODULAR JAVA PERSISTENCE
Choose one DocumentStore for complete documents and one IndexStore for indexed lookup. R2D1 keeps the collection API the same across the supported backends and integrations.
Latest stable: 1.8.0
Use the Java library from Maven Central or the TypeScript package with Node.js and Cloudflare Workers.
Java modules for Cloudflare R2 and D1, local storage, JDBC, and framework integrations.
Java documentation →A TypeScript package for Node.js and Cloudflare Workers with Java-compatible storage contracts.
TypeScript overview →R2D1 combines one DocumentStore with one IndexStore. Select one backend from each column, follow its setup guide, and then use the shared collection API.
Authoritative serialized content, reads by identifier, and the document list.
Document identifiers and explicitly indexed fields for filtering and sorting.
Once the two backends are configured, every pairing uses the same annotations, collection lifecycle, mutation methods, and indexed query builder.
@Document("users")
record User(@Id String id, @Index String country, @Index long score) {}
R2D1 database = R2D1.builder()
.collectionFactory(new PersistenceCollectionFactory(
documentStore, indexStore, documentCodec, indexStore::initialize))
.build();
R2D1Collection<User> users = database.collection(User.class);
users.put(new User("user-123", "NZ", 42));
Page<User> page = users.query()
.where("country").eq("NZ")
.sortBy("score", SortDirection.DESC)
.limit(20)
.fetch();The complete setup, adapter choices, and lifecycle rules are covered in Getting Started.
R2D1 1.8.0 includes the Quarkus extension alongside the core API, storage adapters, Micronaut, and Spring Boot integrations.
dev.nexcraft:r2d1Common collection API plus the R2 DocumentStore and D1 IndexStore adapters.
Module setup →dev.nexcraft:r2d1-jdbcH2, HSQLDB, and local SQLite indexes behind an application-owned DataSource.
JDBC setup →dev.nexcraft:r2d1-filesystemCanonical local document files with atomic replacement and explicit executor ownership.
Filesystem setup →dev.nexcraft:r2d1-micronautMicronaut 5 bean configuration around the same framework-neutral collection API.
Micronaut setup →dev.nexcraft:r2d1-spring-boot-starterSpring Boot 4 starter with separately published auto-configuration on Maven Central.
Spring Boot setup →dev.nexcraft:r2d1-quarkusQuarkus 3.39.5 extension with CDI configuration and application-owned resources, included in R2D1 1.8.0.
Quarkus setup →Set up one document store, one index store, define the metadata, and open the collection.