AFFiNE tackles a problem every developer who’s worked on collaborative editing apps knows well: how to keep multiple users’ changes in sync without losing data or performance. Its approach centers on a native Rust CRDT engine, y-octo, that powers local-first real-time collaboration with strong consistency guarantees. This sets AFFiNE apart from the usual JavaScript-based CRDT solutions, offering performance and robustness benefits that matter for complex document editing.
What AFFiNE does and how it’s built
AFFiNE is an open-source knowledge base designed to run locally with real-time collaboration. It positions itself as an alternative to tools like Notion and Miro but focuses heavily on syncing data across devices and users while maintaining local control of data. At its core, AFFiNE leverages CRDTs (Conflict-free Replicated Data Types) to enable concurrent editing without conflicts or central coordination.
The architecture is built on a stack that blends TypeScript and React on the frontend, with Rust powering key backend components. The CRDT engine, y-octo, is a native Rust implementation based on the Yjs CRDT model but rewritten for thread safety and performance. This is paired with OctoBase, a Rust-based local-first database designed to persist CRDT document states efficiently.
On the frontend, AFFiNE uses React with Jotai for state management and Vite for fast bundling and development. BlockSuite forms the collaborative editor framework, handling the complex editing semantics necessary for block-based documents similar to Notion. For desktop deployments, AFFiNE bundles the app with Electron, enabling cross-platform native experiences. There’s also Docker support for self-hosting the full stack.
The project follows a dual-license model: the MIT-licensed Community Edition (CE) is fully open source, while an Enterprise Edition (EE) exists with additional features like Single Sign-On (SSO) and audit logs.
Why AFFiNE’s Rust-powered CRDT engine matters
The standout technical feature is y-octo, AFFiNE’s CRDT engine written in Rust. While many collaborative editors rely on JavaScript CRDT libraries like Yjs, y-octo rewrites these concepts natively in Rust to achieve thread safety and lower runtime overhead. This is a deliberate tradeoff that prioritizes performance and correctness, especially important in multi-threaded desktop environments.
Rust’s ownership model and concurrency features help prevent subtle bugs common in distributed editing systems. Combined with OctoBase, which efficiently persists CRDT data locally, AFFiNE achieves a solid local-first sync architecture that can work offline and merge changes seamlessly once reconnected.
This architecture means AFFiNE is less dependent on centralized servers or cloud infrastructure for syncing. Users can self-host the backend or run it entirely on their devices, which enhances privacy and control. The tradeoff here is complexity: Rust integration requires additional build tooling and cross-language communication with the frontend, and the Electron app adds some overhead compared to pure web apps.
From a code quality perspective, the project is well-structured, with clear separation between frontend UI components and backend sync logic. The use of modern frontend tools like Jotai and Vite improves developer experience. However, the native Rust components mean contributors need to be comfortable with multi-language tooling.
The editor framework, BlockSuite, handles the heavy lifting of collaborative document manipulation. It supports rich block-level editing, aligning with the mental model of tools like Notion. This modular approach allows AFFiNE to focus on sync and persistence while relying on a battle-tested editing core.
Explore the project
AFFiNE’s repository is organized to separate core components clearly. The frontend React app and the Rust backend modules are distinct, making it easier to navigate code responsibilities. The README points to documentation for self-hosting and deployment.
Here’s the self-hosting snippet from the README:
## Self-Host
Begin with Docker to deploy your own feature-rich, unrestricted version of AFFiNE. Our team is diligently updating to the latest version. For more information on how to self-host AFFiNE, please refer to our documentation.
This suggests Docker is the primary recommended path for deployment, simplifying the setup for users wanting full control over their data. The docs provide detailed instructions on configuration and management.
To get a sense of the codebase, start with the frontend/ directory for the React app, and backend/ or similar folders for Rust CRDT and database modules. The BlockSuite editor integration is a critical piece to understand editing behavior and sync triggers.
Verdict
AFFiNE is relevant for developers and teams looking for a local-first, privacy-conscious collaborative knowledge base with strong real-time sync guarantees. Its Rust-native CRDT engine offers a compelling alternative to typical JavaScript-based solutions, especially for desktop apps requiring thread safety and performance.
The tradeoffs include a steeper development and build complexity due to Rust integration and Electron packaging. It’s not a zero-dependency pure web app, so deployment and contribution require familiarity with multi-language environments.
That said, for projects prioritizing offline-first workflows, data ownership, and robust collaboration, AFFiNE’s architecture and codebase are worth understanding. The open-source Community Edition under MIT makes it accessible to experiment with and extend.
If you’ve been frustrated by syncing bugs or performance bottlenecks in collaborative editors, AFFiNE’s Rust CRDT approach offers a design worth exploring.
Related Articles
- SiYuan: A modular, privacy-first self-hosted knowledge management system with a TypeScript and Go hybrid stack — SiYuan is a self-hosted personal knowledge system blending TypeScript frontend and Go backend, offering block-level refe
- Jan: a local-first desktop app for large language models with Tauri and Rust — Jan is an open-source desktop app that runs large language models locally using Tauri, Node.js, and Rust. It offers priv
- CopilotKit: Building dynamic agentic UIs with the AG-UI protocol — CopilotKit introduces the AG-UI Protocol, enabling AI agents to dynamically render and update UI components in React app
- ToolJet: bridging low-code visual app building with AI-powered internal tools — ToolJet is an open-source low-code platform that combines drag-and-drop app building with AI-powered app generation and
→ GitHub Repo: toeverything/AFFiNE ⭐ 67,976 · TypeScript