Development Setup¶
Set up your development environment for Toss.
Prerequisites¶
Ensure you have all dependencies installed:
Required: - Rust 1.75+ - Flutter 3.24+ - Platform-specific build tools (Xcode, Android SDK, etc.)
First Steps¶
1. Clone Repository¶
2. Verify FFI Setup¶
Before generating FFI bindings, verify everything is configured:
This checks: - ✅ Rust toolchain - ✅ Flutter SDK - ✅ flutter_rust_bridge_codegen - ✅ Configuration files - ✅ Rust compilation
3. Generate FFI Bindings¶
This generates:
- flutter_app/lib/src/rust/api.dart - Dart bindings
- rust_core/src/api/toss_api.h - C header
4. Build the Project¶
# Build Rust core
make build-rust
# Build Flutter app
make build-flutter
# Or build everything
make build
5. Run the Application¶
Development Workflow¶
Daily Development¶
-
Start Development
-
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 -
After Rust API Changes
-
Test Changes
Code Quality¶
Project Structure¶
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
Common Tasks¶
Generate FFI Bindings¶
Run Tests¶
Build for Release¶
Clean Build Artifacts¶
Troubleshooting¶
FFI Generation Issues¶
Problem: flutter_rust_bridge_codegen: command not found
Problem: Rust compilation errors
Build Issues¶
Problem: Flutter build fails
Problem: Rust build fails
Next Steps¶
- Architecture - Understand the system design
- API Reference - API documentation
- Platform Support - Platform-specific details