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:
Each plugin implements the
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
1
Create event request
2
Dispatch to Rust
3
Handle response
Code Generation
Protobuf definitions are used to generate Dart classes:Application Lifecycle
Initialization Flow
1
main.dart entry
Application starts in
main.dart with runAppFlowy()2
Startup initialization
The
startup/ module initializes core services:- Rust backend initialization
- Dependency injection setup
- Theme and localization
3
Authentication check
Check if user is logged in and load workspace
4
Render UI
Display the main workspace or login screen
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:See
pubspec.yaml for the complete list of dependencies and versions.Development Workflow
1
Install dependencies
2
Generate code
3
Run the app
Next Steps
Rust Backend
Learn about the Rust backend architecture
Building Desktop
Build AppFlowy for desktop platforms