Project Structure
The Flutter app is located infrontend/appflowy_flutter/ with the following structure:
Key Directories
/lib/core/
Core application infrastructure:
- config: App configuration and environment variables
- helpers: Utility functions and helpers
- notification: Notification handling from Rust backend
/lib/features/
Feature-based modules organized by domain:
workspace
Workspace management, sidebar, and navigation
settings
User settings, preferences, and account management
view_management
View creation, deletion, and organization
shared_section
Shared workspaces and collaboration features
/lib/plugins/
The plugin system enables extensible document types:
| Plugin | Description |
|---|---|
document | Rich text editor with blocks and formatting |
database | Grid, board, calendar, and kanban views |
ai_chat | AI-powered chat interface |
blank | Blank page template |
database_document | Database with embedded document |
Plugin interface and registers itself with the plugin system.
/lib/shared/
Reusable components and utilities:
- widgets: Common UI components (buttons, dialogs, inputs)
- bloc: Shared BLoC state management classes
- models: Shared data models
- styles: Theme and styling constants
/lib/mobile/
Mobile-specific implementations:
- application: Mobile app state management
- presentation: Mobile-optimized screens and widgets
State Management
AppFlowy uses the BLoC (Business Logic Component) pattern for state management:BLoC Pattern Benefits
Separation of Concerns
Business logic is separated from UI, making code more maintainable
Testability
BLoCs can be easily unit tested without UI dependencies
Reusability
Business logic can be shared across different widgets
Predictability
State changes follow a unidirectional data flow
FFI Integration
The Flutter app communicates with the Rust backend through FFI:Package Structure
Event Dispatch
Code Generation
Protobuf definitions are used to generate Dart classes:Application Lifecycle
Initialization Flow
Startup initialization
The
startup/ module initializes core services:- Rust backend initialization
- Dependency injection setup
- Theme and localization
Main Entry Point
Dependency Injection
AppFlowy uses the GetIt service locator for dependency injection:Platform-Specific Code
Desktop vs Mobile
AppFlowy provides different UI implementations for desktop and mobile:- Desktop
- Mobile
Responsive Design
The app uses responsive layouts that adapt to screen size:Testing
Test Structure
Running Tests
Dependencies
Key Flutter packages used in AppFlowy:| Package | Purpose |
|---|---|
flutter_bloc | State management with BLoC pattern |
get_it | Service locator for dependency injection |
ffi | Foreign function interface to Rust |
freezed | Code generation for immutable classes |
protobuf | Protocol buffer serialization |
flutter_localizations | Internationalization support |
provider | Simple dependency injection |
go_router | Declarative routing |
See
pubspec.yaml for the complete list of dependencies and versions.Development Workflow
Next Steps
Rust Backend
Learn about the Rust backend architecture
Building Desktop
Build AppFlowy for desktop platforms