$ show AppFlowy-IO/AppFlowy
AppFlowy is an open-source AI workspace application (Notion alternative) with a Rust backend and Flutter frontend. The system provides document editing, database views (grid/board/calendar), AI chat and completion, cloud sync, collaboration, file storage, and search. It employs a modular, event-driven architecture using a custom plugin system (lib-dispatch) and protobuf code generation. The backend is split into many small crates with clear trait abstractions for cloud services, storage, and field types. Notable strengths include a well-structured database type-option system, a priority task scheduler, and support for local AI via Ollama. Weaknesses include a complex dependency graph, custom build tools, and some duplicate test infrastructure. Overall, it is a high-quality, actively developed product with strong engineering practices.
The LLM identified 4 files worth highlighting for reuse:
Implements the core event dispatch framework (AFPlugin, AFPluginState, AFPluginHandler) used throughout AppFlowy. The plugin system allows decoupled modules to register event handlers with state injection. It is self-contained, uses generic trait objects, and could be extracted to any Rust application needing a lightweight, extensible event bus.
Provides AES-256-GCM encryption with PBKDF2 key derivation, packaged as a reusable utility crate. The module exposes simple encrypt/decrypt functions on bytes, independent of AppFlowy data structures. It could be lifted into any project needing symmetric encryption with a password-derived key, demonstrating clean separation of cryptographic concerns.
A pragmatic SQLite wrapper with connection pooling, pragma customization (WAL mode, busy timeout), upsert helpers, and a migration framework. The `upsert` implementation and `KVStorePreferences` pattern are generic and reusable. The crate is well-encapsulated and could power any Rust application needing robust local SQLite storage.
Houses the `#[ProtoBuf]` derive macro that automatically implements protobuf serialization/deserialization for Rust structs from their field attributes. The macro is tightly scoped, well-tested, and produces efficient serialization code. Any Rust project using protobuf could adapt this macro to reduce boilerplate, though it is somewhat specific to AppFlowy's protobuf conventions.