flutter-clean-cli
v1.0.6
Published
CLI to scaffold Flutter projects with clean architecture — BLoC, injectable, freezed, FCM
Downloads
384
Maintainers
Readme
flutter-arch-gen
CLI to scaffold Flutter projects with clean architecture — shared API, BLoC, injectable, freezed.
No files to copy. No git. No cloud. Just install once and use anywhere.
Install
# Global install (recommended)
npm install -g flutter-arch-gen
# Or use without installing via npx
npx flutter-arch-gen setupUsage
1. Setup a new Flutter project
flutter create my_new_app
cd my_new_app
flutter-arch-gen setupThat's it. One command does everything:
| Step | Action |
|------|--------|
| 1 | Creates all folders (shared, features, assets) |
| 2 | Writes all template files with correct package imports |
| 3 | Updates pubspec.yaml (deps + fonts + assets) |
| 4 | Runs flutter pub get |
| 5 | Runs build_runner (freezed · injectable · json_serializable) |
2. Add a new feature
Run from inside your Flutter project:
flutter-arch-gen feature auth
flutter-arch-gen feature user_profile
flutter-arch-gen feature dashboardGenerates full clean architecture for the feature:
lib/features/auth/
├── domain/
│ ├── models/ auth_response.dart (freezed model)
│ ├── repositories/ auth_repository.dart (abstract interface)
│ └── services/ auth_service.dart (implements repo)
├── bloc/
│ ├── auth_bloc.dart
│ ├── auth_event.dart
│ └── auth_state.dart
└── screen/
└── auth_screen.dartWhat gets generated by setup
lib/
├── firebase_options.dart
├── main.dart
├── Injectable/
│ ├── injection.dart
│ └── injection.config.dart
├── shared/
│ ├── api/
│ │ ├── endpoint/ api_endpoints.dart
│ │ └── network/ network.dart, env_config.dart,
│ │ api_exceptions.dart, connectivity_cubit/
│ ├── bloc_observer/ app_bloc_observer.dart
│ ├── constants/ colors.dart, result.dart
│ ├── helper/enum/ api_fetch_status.dart
│ ├── routes/ routes.dart, route_generator.dart, navigator.dart
│ ├── themes/ app_theme.dart, font_palette.dart (Manrope)
│ ├── utils/auth/ auth_utils.dart
│ └── widget/ appbar, buttons, text_fields, loading,
│ padding, and 13 stub widgets
└── features/
└── home/ Full working home feature as reference pattern
├── bloc/
├── dashboard/
│ ├── models/
│ ├── repositories/
│ └── services/
└── view/
assets/
├── fonts/ (Manrope declared — add .ttf files)
├── icons/
├── images/
└── animations/pubspec.yaml dependencies injected
dependencies:
freezed_annotation: ^2.4.4
json_annotation: ^4.9.0
get_it: ^9.0.5
injectable: ^2.6.0
dio: ^5.7.0
connectivity_plus: ^6.1.1
flutter_bloc: ^8.1.6
firebase_core: ^3.8.1
shared_preferences: ^2.3.3
dev_dependencies:
build_runner: ^2.4.13
freezed: ^2.5.7
json_serializable: ^6.9.5
injectable_generator: ^2.7.0After setup — checklist
- Copy Manrope
.ttffonts intoassets/fonts/ - Update
lib/firebase_options.dartwith your Firebase config - Fill in
lib/shared/routes/files
Architecture pattern (per feature)
domain/models/ → Freezed data model (fromJson)
domain/repositories/ → Abstract interface (contract)
domain/services/ → Implements repository using Dio
bloc/ → BLoC: event → state (freezed)
screen/ → UI: BlocProvider + BlocBuilderHomeRepository is abstract. HomeService implements it and is registered
via @LazySingleton(as: HomeRepository). GetIt resolves it automatically.
License
MIT
