Skip to main content
AppFlowy is built with a hybrid architecture that combines Flutter for the frontend and Rust for the backend, providing a powerful, cross-platform collaborative workspace.

System Architecture

AppFlowy follows a client-first architecture where most business logic runs locally on the client, with optional cloud synchronization for collaboration.
┌─────────────────────────────────────────┐
│         Flutter Frontend                │
│  (UI Layer + State Management)          │
└──────────────┬──────────────────────────┘
               │ FFI (dart-ffi)
┌──────────────▼──────────────────────────┐
│          Rust Backend                   │
│  ┌─────────────────────────────────┐   │
│  │      Event Dispatch System      │   │
│  └────────────┬────────────────────┘   │
│  ┌────────────▼────────────────────┐   │
│  │    Core Business Logic          │   │
│  │  • User Management              │   │
│  │  • Folder & Workspace           │   │
│  │  • Document Editor              │   │
│  │  • Database (Grid/Board/Kanban) │   │
│  │  • AI Services                  │   │
│  │  • Storage & Search             │   │
│  └─────────────────────────────────┘   │
└──────────────┬──────────────────────────┘

┌──────────────▼──────────────────────────┐
│      Local Storage (SQLite)             │
│      + AppFlowy Cloud (Optional)        │
└─────────────────────────────────────────┘

Technology Stack

Frontend

  • Flutter (v3.13.19+): Cross-platform UI framework
  • Dart: Programming language for Flutter
  • State Management: BLoC pattern
  • FFI Bridge: dart-ffi for Rust interop

Backend

  • Rust (v1.70+): High-performance systems language
  • SQLite: Local data persistence
  • CRDT: Conflict-free replicated data types (Yrs)
  • Protobuf: Serialization protocol

Core Components

Flutter Frontend

The Flutter frontend is organized into feature-based modules:
  • Workspace: Workspace and page management
  • Document: Rich text editor with collaborative editing
  • Database: Grid, board, calendar, and kanban views
  • AI Chat: AI-powered chat and assistance
  • User: Authentication and user profile
  • Settings: Application configuration

Rust Backend

The Rust backend provides core business logic through modular crates:
ModulePurpose
flowy-coreCentral coordinator and dependency injection
flowy-userUser authentication and profile management
flowy-folderWorkspace and folder hierarchy
flowy-documentDocument editing with CRDT
flowy-database2Database views and data management
flowy-aiAI integration and services
flowy-storageFile storage and management
flowy-searchFull-text search capabilities
dart-ffiFFI bridge to Flutter
lib-dispatchEvent dispatch and routing

Communication Layer

FFI Bridge

AppFlowy uses Foreign Function Interface (FFI) to enable seamless communication between Flutter (Dart) and Rust:
1

Flutter sends event

Flutter code dispatches an event through the FFI layer with a payload
2

Rust receives event

The dart-ffi crate receives the event and routes it through the dispatch system
3

Handler processes request

The appropriate Rust handler processes the request and executes business logic
4

Response sent back

The result is serialized (using Protobuf) and sent back to Flutter via FFI

Event Dispatch System

The event dispatch system (lib-dispatch) provides a type-safe, high-performance request-response mechanism:
// Example event flow
EventEventDispatcherHandlerBusinessLogicResponse
Each module registers its event handlers at startup, creating a centralized routing system.

Data Synchronization

Local-First Architecture

AppFlowy prioritizes local-first data management:
  1. All data is stored locally in SQLite
  2. Changes are applied immediately to the local database
  3. Optional sync to AppFlowy Cloud for collaboration
  4. Conflict resolution using CRDT algorithms

CRDT Integration

For collaborative editing, AppFlowy uses Conflict-free Replicated Data Types (CRDT):
  • Based on Yrs (Yjs implementation in Rust)
  • Enables real-time collaboration without conflicts
  • Supports offline editing with automatic merge on reconnect

Design Principles

Data Privacy First

User data is encrypted and stored locally. Cloud sync is optional and user-controlled.

Native Performance

Rust backend provides native performance for all platforms with minimal overhead.

Cross-Platform

Single codebase supports macOS, Windows, Linux, iOS, and Android.

Extensible

Plugin architecture allows for community-driven features and customization.

Modularity

The architecture emphasizes:
  • Separation of concerns: Clear boundaries between UI, business logic, and data
  • Testability: Each layer can be tested independently
  • Maintainability: Features are organized into self-contained modules
  • Scalability: New features can be added without modifying core systems

Build Targets

AppFlowy compiles to multiple platforms with platform-specific optimizations:
  • macOS: Universal binary (arm64 + x86_64)
  • Windows: x64 executable
  • Linux: x64 and arm64 binaries
The Rust backend is compiled as a static library (.a) for macOS/iOS and a dynamic library (.dll/.so) for Windows/Linux/Android.

Next Steps

Flutter Frontend

Explore the Flutter app structure and state management

Rust Backend

Deep dive into the Rust workspace and core modules

Build docs developers (and LLMs) love