Flutter GetX CLI
A Dart CLI tool that generates production-ready Flutter + GetX Clean Architecture projects and modules with a single command.
π Generated Project Structure
lib/
βββ main.dart
βββ app/
βββ di.dart # Dependency injection setup
βββ core/
β βββ constants/
β β βββ app_constants.dart
β βββ theme/
β β βββ app_theme.dart
β βββ utils/
β β βββ extensions.dart
β βββ widgets/ # Shared widgets (Loading, Error, Empty)
βββ data/
β βββ entities/
β βββ models/
β βββ providers/
β β βββ base_provider.dart # Dio-based HTTP base class
β βββ repositories/
β β βββ base_repository.dart
β βββ services/
β β βββ network_service.dart # Configured Dio instance
β βββ usecases/
βββ modules/
β βββ splash/ # Generated with every project
β βββ bindings/
β βββ controllers/
β βββ views/
βββ routes/
βββ app_routes.dart # Route name constants
βββ app_pages.dart # GetPage definitions
βββ routes.dart # Barrel export
π Installation
Option 1: Install globally via dart pub global activate
dart pub global activate clean_arch_getx_cli
Option 2: Install from GitHub source
dart pub global activate --source git https://github.com/yusufkrrt/clean_arch_getx_cli
π Usage
Create a new Flutter project
getx_cli create my_app
With custom organization:
getx_cli create my_app --org com.mycompany
Apply to an existing Flutter project (skip flutter create):
getx_cli create my_app --no-flutter
Add a module to an existing project
Run from inside your Flutter project root:
cd my_app
getx_cli module home
getx_cli module user_profile
getx_cli module product_detail
Each module generates:
lib/app/modules/<module_name>/
βββ bindings/<module_name>_binding.dart
βββ controllers/<module_name>_controller.dart
βββ views/<module_name>_view.dart
Routes in app_routes.dart and app_pages.dart are automatically updated.
π¦ Dependencies added to generated projects
| Package | Purpose |
|---|---|
get |
State management, routing, DI |
dio |
HTTP client |
get_storage |
Local key-value storage |
flutter_dotenv |
Environment variables |
π§ Development
# Run from source
dart run bin/getx_cli.dart create my_app
# Compile to exe
dart compile exe bin/getx_cli.dart -o bin/getx_cli.exe
# Analyze
dart analyze