Development Setup
Development Setup
Section titled “Development Setup”Set up your development environment for Toss.
Prerequisites
Section titled “Prerequisites”Ensure you have all dependencies installed:
./scripts/setup.shRequired:
- Rust 1.75+
- Flutter 3.24+
- Platform-specific build tools (Xcode, Android SDK, etc.)
First Steps
Section titled “First Steps”1. Clone Repository
Section titled “1. Clone Repository”git clone https://github.com/rennerdo30/toss-share.gitcd toss-share2. Verify FFI Setup
Section titled “2. Verify FFI Setup”Before generating FFI bindings, verify everything is configured:
make verify-ffiThis checks:
- ✅ Rust toolchain
- ✅ Flutter SDK
- ✅ flutter_rust_bridge_codegen
- ✅ Configuration files
- ✅ Rust compilation
3. Generate FFI Bindings
Section titled “3. Generate FFI Bindings”make generate-ffiThis generates:
flutter_app/lib/src/rust/api.dart- Dart bindingsrust_core/src/api/toss_api.h- C header
4. Build the Project
Section titled “4. Build the Project”# Build Rust coremake build-rust
# Build Flutter appmake build-flutter
# Or build everythingmake build5. Run the Application
Section titled “5. Run the Application”# Run Flutter appmake run-flutter
# Or manuallycd flutter_app && flutter runDevelopment Workflow
Section titled “Development Workflow”Daily Development
Section titled “Daily Development”-
Start Development
Terminal window # Verify setupmake verify-ffi# Generate code (if needed)make generate-ffi# Run appmake run-flutter -
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
- Edit Rust code in
-
After Rust API Changes
Terminal window # Regenerate FFI bindingsmake generate-ffi -
Test Changes
Terminal window # Run testsmake test-all# Or individuallymake test-rustmake test-flutter
Code Quality
Section titled “Code Quality”# Format codemake fmt
# Lint codemake lint
# Run all checksmake checkProject Structure
Section titled “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/ # DocumentationCommon Tasks
Section titled “Common Tasks”Generate FFI Bindings
Section titled “Generate FFI Bindings”make generate-ffiRun Tests
Section titled “Run Tests”make test-allBuild for Release
Section titled “Build for Release”make releaseClean Build Artifacts
Section titled “Clean Build Artifacts”make cleanTroubleshooting
Section titled “Troubleshooting”FFI Generation Issues
Section titled “FFI Generation Issues”Problem: flutter_rust_bridge_codegen: command not found
dart pub global activate flutter_rust_bridge_codegenProblem: Rust compilation errors
cd rust_core && cargo check# Fix errors shownBuild Issues
Section titled “Build Issues”Problem: Flutter build fails
cd flutter_appflutter cleanflutter pub getflutter buildProblem: Rust build fails
cd rust_corecargo cleancargo buildNext Steps
Section titled “Next Steps”- Architecture - Understand the system design
- API Reference - API documentation
- Platform Support - Platform-specific details