Skip to content

Development Setup

Set up your development environment for Toss.

Ensure you have all dependencies installed:

Terminal window
./scripts/setup.sh

Required:

  • Rust 1.75+
  • Flutter 3.24+
  • Platform-specific build tools (Xcode, Android SDK, etc.)
Terminal window
git clone https://github.com/rennerdo30/toss-share.git
cd toss-share

Before generating FFI bindings, verify everything is configured:

Terminal window
make verify-ffi

This checks:

  • ✅ Rust toolchain
  • ✅ Flutter SDK
  • ✅ flutter_rust_bridge_codegen
  • ✅ Configuration files
  • ✅ Rust compilation
Terminal window
make generate-ffi

This generates:

  • flutter_app/lib/src/rust/api.dart - Dart bindings
  • rust_core/src/api/toss_api.h - C header
Terminal window
# Build Rust core
make build-rust
# Build Flutter app
make build-flutter
# Or build everything
make build
Terminal window
# Run Flutter app
make run-flutter
# Or manually
cd flutter_app && flutter run
  1. Start Development

    Terminal window
    # Verify setup
    make verify-ffi
    # Generate code (if needed)
    make generate-ffi
    # Run app
    make run-flutter
  2. Make Changes

    • Edit Rust code in rust_core/src/
    • Edit Flutter code in flutter_app/lib/
    • Update FFI API in rust_core/src/api/mod.rs
  3. After Rust API Changes

    Terminal window
    # Regenerate FFI bindings
    make generate-ffi
  4. Test Changes

    Terminal window
    # Run tests
    make test-all
    # Or individually
    make test-rust
    make test-flutter
Terminal window
# Format code
make fmt
# Lint code
make lint
# Run all checks
make check
toss/
├── rust_core/ # Rust core library
│ └── src/
│ ├── api/ # FFI API (mod.rs)
│ ├── clipboard/ # Clipboard operations
│ ├── crypto/ # Encryption
│ ├── network/ # Networking (P2P, Relay)
│ └── storage/ # SQLite storage
├── flutter_app/ # Flutter application
│ └── lib/
│ ├── src/
│ │ ├── core/ # Services, providers
│ │ └── features/ # UI screens
│ └── rust/ # Generated FFI bindings
├── relay_server/ # Relay server (optional)
└── docs/ # Documentation
Terminal window
make generate-ffi
Terminal window
make test-all
Terminal window
make release
Terminal window
make clean

Problem: flutter_rust_bridge_codegen: command not found

Terminal window
dart pub global activate flutter_rust_bridge_codegen

Problem: Rust compilation errors

Terminal window
cd rust_core && cargo check
# Fix errors shown

Problem: Flutter build fails

Terminal window
cd flutter_app
flutter clean
flutter pub get
flutter build

Problem: Rust build fails

Terminal window
cd rust_core
cargo clean
cargo build