mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2025-11-02 02:53:59 +00:00
4.9 KiB
4.9 KiB
🥳 AppFlowy - Event Driven System
- Goals of the System
- Some Design Considerations
- High Level Design
- Component Design
🎯 Goals of the System
The AppFlowy project is an attempt to build a high performance application. Here are the top-level requirements for out system.
- High Performance.
- Cross-platform.
- Reliability
- Safety
🤔 Some Design Considerations
📜 High Level Design
📚 Component Design
📙 Event Dispatch
Frontend FLowySDK
│ ┌─────────┐
│ ┌7─▶│Handler A│
│ │ └─────────┘
│ ┌─────────┐ │ ┌─────────┐
┌──────┐ ┌────┐ ┌──────────────┐ │ ┌───▶│Module A │──┼──▶│Handler B│
│Widget│─1─▶│Bloc│─2─▶│ Repository A │─3─┐ │ │ └─────────┘ │ └─────────┘
└──────┘ └────┘ └──────────────┘ │ │ │ │ ┌─────────┐
┌──────────────┐ │ ┌───────┐ ┌─┴──┐ ┌───────────┐ │ ┌─────────┐ └──▶│Handler C│
│ Repository B │───┼───▶│ Event │─4─▶│FFI │─5──▶│Dispatcher │─6─┼───▶│Module B │ └─────────┘
└──────────────┘ │ └───────┘ └─┬──┘ └───────────┘ │ └─────────┘
┌──────────────┐ │ │ │
│ Repository C │───┘ │ │ ┌─────────┐
└──────────────┘ │ └───▶│Module C │
│ └─────────┘
│
│
Here are the event flow:
- User click on the
Widget(The user interface) that invokes theBlocactions Bloccalls the repositories to perform additional operations to handle the actions.Repositoryoffers the functionalities by combining the event, defined in theFlowySDK.Eventswill be passed in theFlowySDKthrough the FFI interface.Dispatcherparses the event and generates the specific action scheduled in theFlowySDKruntime.Dispatcherfind the event handler declared by the modules.Handlerconsumes the event and generates the response. The response will be returned to the widget through theFFI.
The event flow will be discussed in two parts: the frontend implemented in flutter and the FlowySDK implemented in Rust.
FlowySDK
Frontend
The Frontend follows the DDD design pattern, you can recap from here.
┌──────┐ ┌────┐ ┌──────────────┐
│Widget│──1────▶│Bloc│──2────▶│ Repository A │─3──┐
└──────┘ └────┘ └──────────────┘ │
┌──────────────┐ │ ┌───────┐
│ Repository B │────┼────▶│ Event │
└──────────────┘ │ └───────┘
┌──────────────┐ │
│ Repository C │────┘
└──────────────┘