AppFlowy-Collab

AppFlowy-Collab is the collaborative data layer that powers AppFlowy clients. It exposes collab, a Rust crate built on top of yrs, packaging CRDT primitives, persistence helpers, and domain objects for documents, databases, folders, importers, plugins, and user state. The crate can be embedded inside desktop, mobile, or cloud services that need to read and apply AppFlowy collaboration updates.

Highlights

Architecture Overview

The AppFlowy runtime connects three domain services—flowy-folder, flowy-database, and flowy-document—through the Collab object supplied by this crate. Core responsibility highlights:

  1. Client code requests domain operations (e.g. create a view, update a document block) via the domain modules in collab.
  2. Collab records the change as a yrs transaction and fires plugin hooks.
  3. Plugins persist the change (e.g. RocksdbDiskPlugin) and optionally sync it to remote services (SupabaseDBPlugin, custom websocket backends).
  4. Collab fans the update out to any other connected clients, keeping local caches and UI layers in sync.

The sequence diagrams in docs/architecture.md walk through common flows—creating, opening, editing, and synchronising documents—and mirror the behaviour of other collab objects such as databases and user awareness.

Module Map

The collab crate organises its API into cohesive modules:

Cargo Features

Enable features when building or testing via cargo build --features plugins.

Getting Started

Prerequisites

Build & Test

# Compile the crate
cargo build

# Run the full test suite
cargo test

# Exercise plugin integration tests
cargo test --features plugins --test plugins

Coverage (optional)

Use the bundled Cargo Make tasks to produce an LCOV report:

cargo make check_grcov          # once, validates tooling
cargo make run_coverage         # runs instrumented tests

The coverage report is written to target/coverage.lcov.

Repository Layout

collab/            # Collab crate source
  src/
    core/          # yrs core wrappers and Collab orchestration
    document/      # document model and text tooling
    database/      # database views, rows, and history
    folder/        # workspace/folder hierarchy
    importer/      # Notion/Markdown import logic
    plugins/       # plugin API and reference implementations
    user/          # user awareness collab objects
  tests/           # integration tests (cargo test)
docs/              # Architecture notes and UML diagrams
resources/         # Architecture images referenced by the README

Further Reading

Contributions are welcome—start by exploring the architecture docs, running the tests, and opening a discussion in the AppFlowy community if you plan to introduce new collab objects or plugins.