Skip to content

Bring projects, wikis, and teams together with AI. AppFlowy is the AI collaborative workspace where you achieve more without losing control of your data. The leading open source Notion alternative.

update some doc

appflowy685643be364c
diff --git a/README.md b/README.md
index 6d9fbfe8e2..ceaac09643 100644
--- a/README.md
+++ b/README.md
@@ -8,13 +8,13 @@
## Documentation
-* [**Getting Started**](doc/getting_started.md)
-* [**Roadmap**](doc/roadmap.md)
-* [**Deep Dive AppFlowy**](doc/architecture.md)
+* [**Getting Started**](doc/GETTING_STARTED.md)
+* [**Roadmap**](doc/ROADMAP.md)
+* [**Deep Dive AppFlowy**](doc/APPFLOWY_SYSTEM_DESIGN.md)
## Contributing
-Read the [Contributing Doc](doc/contribute.md) before you want to contribute.
+Read the [Contributing Doc](doc/CONTRIBUTING.md) before you want to contribute.
## Social Media
* Slack (to be determined)
diff --git a/app_flowy/packages/flowy_sdk/lib/dispatch/error.dart b/app_flowy/packages/flowy_sdk/lib/dispatch/error.dart
new file mode 100644
index 0000000000..ae47d60418
--- /dev/null
+++ b/app_flowy/packages/flowy_sdk/lib/dispatch/error.dart
@@ -0,0 +1,30 @@
+import 'package:flowy_logger/flowy_logger.dart';
+import 'package:flowy_sdk/dispatch/flowy_error.dart';
+import 'package:flowy_sdk/protobuf/ffi_request.pb.dart';
+import 'package:flowy_sdk/protobuf/ffi_response.pb.dart';
+
+class StackTraceError {
+ Object error;
+ StackTrace trace;
+ StackTraceError(
+ this.error,
+ this.trace,
+ );
+
+ FlowyError toFlowyError() {
+ Log.error('${error.runtimeType}\n');
+ Log.error('Stack trace \n $trace');
+ return FlowyError.fromError('${error.runtimeType}. Stack trace: $trace');
+ }
+
+ String toString() {
+ return '${error.runtimeType}. Stack trace: $trace';
+ }
+}
+
+FFIResponse error_response(FFIRequest request, StackTraceError error) {
+ var response = FFIResponse();
+ response.code = FFIStatusCode.Err;
+ response.error = error.toString();
+ return response;
+}
diff --git a/doc/about app flowy.md b/doc/ABOUT_APPFLOWY.md
similarity index 100%
rename from doc/about app flowy.md
rename to doc/ABOUT_APPFLOWY.md
diff --git a/doc/APPFLOWY_SYSTEM_DESIGN.md b/doc/APPFLOWY_SYSTEM_DESIGN.md
new file mode 100644
index 0000000000..e99cb9690c
--- /dev/null
+++ b/doc/APPFLOWY_SYSTEM_DESIGN.md
@@ -0,0 +1,71 @@
+# πŸ₯³ 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.
+
+1. **High Performance.**
+2. **Cross-platform.**
+3. **Reliability**
+4. **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:
+1. User click on the `Widget`(The user interface) that invokes the `Bloc` actions
+2. `Bloc` calls the repositories to perform additional operations to handle the actions.
+3. `Repository` offers the functionalities by combining the event, defined in the `FlowySDK`.
+4. `Events` will be passed in the `FlowySDK` through the [FFI](https://en.wikipedia.org/wiki/Foreign_function_interface) interface.
+5. `Dispatcher` parses the event and generates the specific action scheduled in the `FlowySDK` runtime.
+6. `Dispatcher` find the event handler declared by the modules.
+7. `Handler` consumes the event and generates the response. The response will be returned to the widget through the `FFI`.
+
+The event flow will be discussed in two parts: the frontend implemented in flutter and the FlowySDK implemented in Rust.
+
+#### Frontend
+The Frontend follows the DDD design pattern, you can recap from [**here**](DOMAIN_DRIVEN_DESIGN.md).
+```
+ β”Œβ”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
+ β”‚Widget│──1────▢│Bloc│──2────▢│ Repository A │─3──┐
+ β””β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
+ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”
+ β”‚ Repository B │────┼────▢│ Event β”‚
+ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”˜
+ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
+ β”‚ Repository C β”‚β”€β”€β”€β”€β”˜
+ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
+```
+
+#### FlowySDK
+
+
diff --git a/CONTRIBUTING.md b/doc/CONTRIBUTING.md
similarity index 99%
rename from CONTRIBUTING.md
rename to doc/CONTRIBUTING.md
index a97294257e..630c62a729 100644
--- a/CONTRIBUTING.md
+++ b/doc/CONTRIBUTING.md
@@ -18,7 +18,6 @@ Consult the Table of Contents below, and jump to the desired section.
- [Code of Conduct](#code-of-conduct)
-
## Sign the CLA Agreement
TODO
diff --git a/doc/domain driven design.md b/doc/DOMAIN_DRIVEN_DESIGN.md
similarity index 100%
rename from doc/domain driven design.md
rename to doc/DOMAIN_DRIVEN_DESIGN.md
diff --git a/doc/architecture.md b/doc/architecture.md
deleted file mode 100644
index ddac0254f5..0000000000
--- a/doc/architecture.md
+++ /dev/null
@@ -1,47 +0,0 @@
-# πŸ₯³ AppFlowy System Design
-
-* Goals of the System
-* Some Design Considerations
-* High Level Design
-* Component Design
-
-## 🎯 Goals of the System
-
-
-
-## πŸ€” Some Design Considerations
-
-## πŸ“œ High Level Design
-
-## πŸ“š Component Design
-
-### πŸ“• Component 1
-
-
-### πŸ“— Component 2
-
-
-### πŸ“˜ Flutter Event Flow
-
-
-### πŸ“™ Rust Event Flow
-
-```
- β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”
- β”Œβ”€β–Άβ”‚Service Aβ”‚
- β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
- β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”
- β”Œβ”€β–Άβ”‚Module A │─▢│ Services │─▢│Deps Resolved│─┼─▢│Service Bβ”‚
- β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
- β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”
-β”Œβ”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β” └─▢│Service Cβ”‚
-β”‚ Event │──▢│Runtime │──┼─▢│Module B β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
-β””β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
- β”‚
- β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”
- └─▢│Module C β”‚
- β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
-```
-
-* sync will cause typing lag
-
diff --git a/doc/contribute.md b/doc/contribute.md
deleted file mode 100644
index e0f57bdaf8..0000000000
--- a/doc/contribute.md
+++ /dev/null
@@ -1,12 +0,0 @@
-[WIP]
-* Contributing
- * First steps
- * Opening issues
- * Participating in discussions
- * Finding something to work on
- * Open your PR
- * Review Process
- * Getting more involved
- * Organization membership
- * Contributor
- * Maintainer
\ No newline at end of file
diff --git a/doc/why flutter and rust.md b/doc/why flutter and rust.md
deleted file mode 100644
index 0e3d959cf3..0000000000
--- a/doc/why flutter and rust.md
+++ /dev/null
@@ -1 +0,0 @@
-[WIP]
\ No newline at end of file
diff --git a/scripts/install_rust.sh b/scripts/install_rust.sh
new file mode 100755
index 0000000000..0a778ac670
--- /dev/null
+++ b/scripts/install_rust.sh
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+echo 'install rust'
+sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
+curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain nightly -y
+echo 'export PATH="$$HOME/.cargo/bin:$$PATH"' >> ~/.bash_profile
+source ~/.bash_profile
\ No newline at end of file
diff --git a/scripts/install_tool.sh b/scripts/install_tool.sh
new file mode 100755
index 0000000000..cde07b2403
--- /dev/null
+++ b/scripts/install_tool.sh
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+#targets
+rustup target add x86_64-apple-darwin
+
+#tools
+echo 'install tools'
+rustup component add rustfmt
+cargo install cargo-expand
+cargo install cargo-watch
+cargo install cargo-cache
+
+#protobuf code gen env
+brew install [email protected]
+cargo install --version 2.20.0 protobuf-codegen
\ No newline at end of file