Warning:
This document has not been updated for a while. If you find any outdated information, please feel free to open an issue or submit a PR.
Note For developing & building desktop client app, please refer to building-desktop-client-app.md
AFFiNE client has both Node.js & Rust toolchains.
We suggest develop our product under node.js LTS(Long-term support) version
install Node LTS version
Up to now, the major node.js version is 18.x
install fnm
fnm use
Please follow the official guide at https://www.rust-lang.org/tools/install.
This setup requires modern yarn (currently 4.x
), run this if your yarn version is 1.x
Reference: Yarn installation doc
corepack enable
corepack prepare yarn@stable --activate
# install dependencies
yarn install
git clone https://github.com/toeverything/AFFiNE
In our codebase, we use symbolic links. Due to the security design of Windows, the creation of symbolic links requires administrator privileges. This is part of the security policy settings of Windows, and more information can be found at Security Policy Settings for Creating Symbolic Links.
For detailed guidance on enabling this feature, please refer to the official documentation: Enable Developer Mode on Windows.
Once Developer Mode is enabled, execute the following command with administrator privileges:
# Enable symbolic links
git config --global core.symlinks true
# Clone the repository, also need to be run with administrator privileges
git clone https://github.com/toeverything/AFFiNE
Run the following script. It will build the native module at /packages/frontend/native
and build Node.js binding using NAPI.rs.
This could take a while if you build it for the first time.
Note: use strip
from system instead of binutils
if you are running MacOS. see problem here
yarn workspace @affine/native build
yarn workspace @affine/storage build
Adding test cases is strongly encouraged when you contribute new features and bug fixes.
We use Playwright for E2E test, and vitest for unit test.
To test locally, please make sure browser binaries are already installed via npx playwright install
.
Also make sure you have built the @affine/core
workspace before running E2E tests.
yarn test
# there are `affine-local`, `affine-migration`, `affine-local`, `affine-prototype` e2e tests,
# which are run under different situations.
cd tests/affine-local
yarn e2e