A production-ready Flutter monorepo powered by Melos. Built with modular feature packages, clean architecture, and shared infrastructure for scalable app development.
- 🏗️ Clean Architecture — Domain, Data, and Presentation layers with clear separation of concerns
- 📦 Modular Structure — Independent feature packages for better scalability and team collaboration
- 🔧 Melos Powered — Efficient monorepo management with automated scripts
- 🎯 BLoC Pattern — Predictable state management across all features
- 💉 Dependency Injection — Clean and testable code with GetIt
- 🧪 Test Ready — Pre-configured testing setup for unit, widget, and integration tests
- 🚀 Production Ready — Battle-tested architecture patterns used in real-world apps
flutter_modular_clean_architecture/
├── app/
│ └── root/ # Main application entry point
├── packages/
│ ├── core/ # Shared infrastructure
│ │ ├── core_network/ # API client, interceptors, error handling
│ │ ├── core_ui/ # Shared widgets, themes, design system
│ │ ├── core_utils/ # Common utilities and extensions
│ │ └── core_storage/ # Local storage abstractions
│ └── features/ # Feature modules
│ ├── feature_auth/ # Authentication feature
│ ├── feature_home/ # Home feature
│ └── feature_*/ # Other features...
├── scripts/ # Automation scripts
├── docs/ # Documentation
├── melos.yaml # Melos configuration
└── pubspec.yaml # Root pubspec
This project follows Clean Architecture principles with a Feature-First approach:
┌─────────────────────────────────────────────────────────────┐
│ Presentation Layer │
│ (BLoC, Pages, Widgets) │
├─────────────────────────────────────────────────────────────┤
│ Domain Layer │
│ (Entities, Use Cases, Repositories) │
├─────────────────────────────────────────────────────────────┤
│ Data Layer │
│ (Repository Impl, Data Sources, Models/DTOs) │
└─────────────────────────────────────────────────────────────┘
| Layer | Responsibility |
|---|---|
| Presentation | UI components, state management (BLoC), user interaction handling |
| Domain | Business logic, use cases, entity definitions, repository contracts |
| Data | API calls, local storage, data mapping, repository implementations |
- Flutter SDK (>=3.0.0)
- Dart SDK (>=3.0.0)
- Melos (
dart pub global activate melos)
-
Clone the repository
git clone https://github.com/yunusemrealpak/flutter_modular_clean_architecture.git cd flutter_modular_clean_architecture -
Bootstrap the project
melos bootstrap
-
Run the app
cd app/root flutter run
| Command | Description |
|---|---|
melos bootstrap |
Install dependencies for all packages |
melos clean |
Clean all packages |
melos analyze |
Run static analysis on all packages |
melos test |
Run tests across all packages |
melos build_runner |
Run build_runner for code generation |
melos format |
Format code in all packages |
-
Create a new package under
packages/features/:./scripts/create_feature.sh feature_profile
-
The script will generate:
feature_profile/ ├── lib/ │ ├── src/ │ │ ├── data/ │ │ │ ├── datasources/ │ │ │ ├── models/ │ │ │ └── repositories/ │ │ ├── domain/ │ │ │ ├── entities/ │ │ │ ├── repositories/ │ │ │ └── usecases/ │ │ └── presentation/ │ │ ├── bloc/ │ │ ├── pages/ │ │ └── widgets/ │ └── feature_profile.dart ├── test/ └── pubspec.yaml -
Register the feature in the main app's dependency injection
Run all tests:
melos testRun tests with coverage:
melos test -- --coverageRun tests for a specific package:
cd packages/features/feature_auth
flutter testThis project is licensed under the MIT License - see the LICENSE file for details.
Made with ❤️ by Yunus Emre Alpak