Skip to main content
This guide covers building AppFlowy for desktop platforms (macOS, Windows, and Linux) from source.

Prerequisites

Before building, ensure you have completed the development environment setup.
All commands should be run from the frontend/ directory.

Quick Start

1

Navigate to frontend

cd AppFlowy/frontend
2

Build for your platform

# For Apple Silicon (M1/M2/M3)
cargo make --profile development-mac-arm64 appflowy-core-dev

# For Intel Macs
cargo make --profile development-mac-x86_64 appflowy-core-dev
3

Run Flutter app

cd appflowy_flutter
flutter run

Build Profiles

AppFlowy uses cargo-make with different build profiles:
ProfileTargetBuild TypeUse Case
development-mac-arm64macOS ARM64DebugDevelopment on Apple Silicon
development-mac-x86_64macOS x86_64DebugDevelopment on Intel Macs
production-mac-arm64macOS ARM64ReleaseProduction builds for Apple Silicon
production-mac-x86_64macOS x86_64ReleaseProduction builds for Intel
production-mac-universalUniversalReleaseUniversal binary (both architectures)
development-windows-x86Windows x64DebugDevelopment on Windows
production-windows-x86Windows x64ReleaseProduction builds for Windows
development-linux-x86_64Linux x64DebugDevelopment on Linux
production-linux-x86_64Linux x64ReleaseProduction builds for Linux

Building the Rust Backend

Development Build

1

Choose architecture

# Apple Silicon (M1/M2/M3)
export ARCH=arm64

# Intel
export ARCH=x86_64
2

Build Rust backend

cargo make --profile development-mac-${ARCH} appflowy-core-dev
This command:
  • Compiles the Rust backend as a static library
  • Copies the library to the Flutter app
  • Generates FFI bindings
macOS builds use staticlib (.a) for better integration with the app bundle.

Production Build

Production builds are optimized with LTO and higher optimization levels:
cargo make --profile production-mac-universal appflowy-core-release

Building the Flutter App

Development Mode

1

Navigate to Flutter directory

cd appflowy_flutter
2

Install dependencies

flutter pub get
3

Generate code

flutter pub run build_runner build --delete-conflicting-outputs
4

Run the app

flutter run -d macos    # macOS
flutter run -d windows  # Windows
flutter run -d linux    # Linux

Release Build

cd appflowy_flutter
flutter build macos --release
The app will be at:
appflowy_flutter/build/macos/Build/Products/Release/AppFlowy.app

Build Configuration

Makefile.toml

The build process is configured in frontend/Makefile.toml:
[env]
RUST_LOG = "info"
CARGO_PROFILE = "dev"
APPFLOWY_VERSION = "0.9.9"
PRODUCT_NAME = "AppFlowy"

Environment Variables

Key environment variables:
VariableDescription
BUILD_FLAGdebug or release
RUST_COMPILE_TARGETTarget triple (e.g., aarch64-apple-darwin)
CRATE_TYPEstaticlib or cdylib
TARGET_OSmacos, windows, or linux
FLUTTER_DESKTOP_FEATURESRust features to enable

Platform-Specific Details

macOS Build Details

Crate Type: Static library (.a)Build Targets:
  • aarch64-apple-darwin (Apple Silicon)
  • x86_64-apple-darwin (Intel)
Universal Binary:To create a universal binary that runs on both architectures:
# Build for both architectures
cargo make --profile production-mac-arm64 appflowy-core-release
cargo make --profile production-mac-x86_64 appflowy-core-release

# Combine with lipo
lipo -create \
  target/aarch64-apple-darwin/release/libdart_ffi.a \
  target/x86_64-apple-darwin/release/libdart_ffi.a \
  -output libdart_ffi.a
Code Signing:For distribution, you’ll need to sign the app:
codesign --deep --force --verify --verbose \
  --sign "Developer ID Application: Your Name" \
  AppFlowy.app

Clean Build

To clean all build artifacts:
# Clean Rust
cd rust-lib
cargo clean

# Clean Flutter
cd ../appflowy_flutter
flutter clean

Troubleshooting

Common build issues and solutions:

Rust Build Fails

# Update Rust toolchain
rustup update

# Ensure target is installed
rustup target add <your-target>

# Clean and rebuild
cargo clean
cargo make --profile <your-profile> appflowy-core-dev

Flutter Build Fails

# Clean Flutter cache
flutter clean
flutter pub get

# Regenerate code
flutter pub run build_runner clean
flutter pub run build_runner build --delete-conflicting-outputs

Library Not Found

# Verify library exists
ls -la appflowy_flutter/packages/appflowy_backend/macos/

# Should contain libdart_ffi.a

Protobuf Errors

# Ensure protoc is installed
protoc --version

# Regenerate protobuf files
cd frontend
cargo make install_flutter_protobuf

Performance Optimization

Build Times

To improve build times:
1

Use incremental compilation

export CARGO_INCREMENTAL=1
2

Use cargo cache

cargo install cargo-cache
3

Parallel jobs

# Set number of parallel jobs
export CARGO_BUILD_JOBS=8

Release Optimization

The production profile uses:
[profile.release]
lto = true              # Link-time optimization
opt-level = 3           # Maximum optimization
codegen-units = 1       # Better optimization, slower build

Next Steps

Building Mobile

Build AppFlowy for iOS and Android

Testing

Learn how to run tests

Contributing

Contribute your changes

Code Style

Follow coding conventions

Build docs developers (and LLMs) love