Melos Workspace Setup
Overview
The Remind Tools project uses Melos to manage our Flutter monorepo containing two applications (Trips and Money) along with shared packages.Workspace Structure
Getting Started
Prerequisites
- Flutter SDK 3.24+
- Dart SDK 3.5+
- Melos CLI
Installation
-
Install Melos globally:
-
Bootstrap the workspace:
Available Melos Scripts
Development
melos run trips:dev
- Run Trips app in developmentmelos run money:dev
- Run Money app in developmentmelos get
- Get dependencies for all packagesmelos clean
- Clean build artifacts
Testing
melos test
- Run tests for all packagesmelos test:unit
- Run unit tests onlymelos test:widget
- Run widget tests onlymelos test:integration
- Run integration tests
Code Quality
melos analyze
- Analyze Dart codemelos format
- Check code formattingmelos format:fix
- Fix code formattingmelos fix
- Apply automated fixes
Building
melos run build:all
- Build all apps for all platformsmelos run build:android
- Build Android APKmelos run build:ios
- Build iOS appmelos run build:web
- Build web version
Code Generation
melos run generate
- Run build_runner code generationmelos run generate:watch
- Watch and auto-generate code
Package Dependencies
Each app references shared packages through path dependencies:VS Code Integration
Launch Configurations
The workspace includes pre-configured launch configurations for both apps:- Trips App (debug/release)
- Money App (debug/release)
- All Apps (compound launch)
Settings
Optimized VS Code settings for Flutter development:- Hot reload on save enabled
- Format on save configured
- Dart-specific editor settings
- Build artifacts excluded from search
Clean Architecture
Both apps follow Clean Architecture principles:Presentation Layer
- Flutter UI with BLoC + Riverpod
- Feature-based organization
- Shared UI components
Domain Layer
- Business logic and use cases
- Domain models
- Repository interfaces
Data Layer
- Supabase integration
- API clients
- Local storage
Shared Packages
core
Core utilities and extensions used across all apps:- String, DateTime, Context extensions
- Logging and validation utilities
- App constants and endpoints
- Device and connectivity services
ui_components
Shared UI components and themes:- App themes and colors
- Common widgets (buttons, inputs, cards)
- Loading indicators and animations
- Typography definitions
data_models
Shared data models:- User models and profiles
- Trip-specific models (trips, itineraries, destinations)
- Finance-specific models (transactions, budgets, accounts)
- Common models (response, error, pagination)
services
Shared services:- Authentication service and repository
- Storage services (local and secure)
- API client and interceptors
- Database service (Supabase)
Best Practices
- Package Management: Always use
melos bootstrap
after adding new dependencies - Code Organization: Follow feature-based structure within apps
- Shared Code: Extract common functionality to shared packages
- Testing: Write tests at all levels (unit, widget, integration)
- Documentation: Keep package README files updated
- Version Control: Use conventional commits for clear history
Troubleshooting
Bootstrap Fails
- Ensure Flutter SDK version is 3.24+
- Check Dart SDK version is 3.5+
- Run
melos clean
thenmelos bootstrap
IDE Issues
- Restart IDE after bootstrap
- Ensure Dart/Flutter plugins are installed
- Check workspace settings in
.vscode/settings.json
Package Resolution
- Verify path dependencies in pubspec.yaml
- Check package names match directory names
- Run
melos list
to see recognized packages
Next Steps
- Configure environment variables for each app
- Set up Supabase integration
- Configure MapBox for Trips app
- Set up Gemini AI integration
- Implement CI/CD with Codemagic