Feature Folder CLI Plus π
A powerful Dart CLI tool that generates clean, scalable folder structures following the feature-first architecture pattern. Stop wasting time creating repetitive boilerplate - generate complete feature modules in seconds!
π Quick Start
1. Install
dart pub global activate feature_folder_cli_plus
2. Generate a feature
ff generate -n auth -t bloc
That's it! Your complete auth feature folder is ready. β
β¨ What's New in V2.0
| Before (v1.x) | Now (v2.0) |
|---|---|
| β Required Mason dependency | β Zero external dependencies |
| β Network calls to fetch templates | β Instant offline generation |
| β Breaks when Mason updates | β Self-contained & stable |
π¦ Installation
dart pub global activate feature_folder_cli_plus
Note: Make sure Dart's bin directory is in your PATH.
Usually:~/.pub-cache/bin(macOS/Linux) or%LOCALAPPDATA%\Pub\Cache\bin(Windows)
π οΈ Usage
ff generate -n <name> -t <type> [-p <path>]
| Flag | Description | Required |
|---|---|---|
-n |
Feature name (e.g., auth, home, profile) |
β |
-t |
State management type | β |
-p |
Custom path inside lib/ folder |
β |
Supported State Management Types
| Type | Flag | Package Required |
|---|---|---|
| BLoC | -t bloc |
flutter_bloc |
| Cubit | -t cubit |
flutter_bloc |
| Provider | -t provider |
provider |
| GetX | -t getx |
get |
π Examples
Basic Usage
# Generate a BLoC feature in lib/
ff generate -n auth -t bloc
# Generate a Cubit feature in lib/
ff generate -n home -t cubit
# Generate a Provider feature in lib/
ff generate -n profile -t provider
# Generate a GetX feature in lib/
ff generate -n settings -t getx
With Custom Path
# Generate inside lib/features/
ff generate -n auth -t bloc -p features
# Generate inside lib/modules/
ff generate -n payment -t cubit -p modules
π Generated Structure
BLoC / Cubit
lib/
βββ auth/
βββ index.dart
βββ domain/
β βββ index.dart
β βββ models/
β β βββ auth_model.dart
β β βββ index.dart
β βββ repository/
β β βββ auth_repository.dart β Abstract class
β β βββ index.dart
β βββ services/
β βββ auth_service.dart β Implements repository
β βββ index.dart
βββ logic/
β βββ index.dart
β βββ auth_bloc/
β βββ auth_bloc.dart
β βββ auth_event.dart
β βββ auth_state.dart
βββ screens/
β βββ auth_screen.dart
β βββ index.dart
βββ widgets/
βββ auth_component.dart
βββ index.dart
Provider / GetX
lib/
βββ auth/
βββ index.dart
βββ domain/
β βββ index.dart
β βββ models/
β βββ repository/ β Abstract class
β βββ services/ β Implements repository
βββ providers/
β βββ auth_provider.dart (Provider)
β βββ auth_controller.dart (GetX)
β βββ auth_binding.dart (GetX only)
β βββ index.dart
βββ screens/
β βββ auth_screen.dart
βββ widgets/
βββ auth_component.dart
ποΈ Architecture Pattern
This CLI follows the Repository Pattern with clean separation:
βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β UI Layer β
β (screens/ & widgets/) β
βββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββ
β
βββββββββββββββββββββββΌββββββββββββββββββββββββββββββββ
β Logic Layer β
β (bloc/ cubit/ provider/ controller/) β
βββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββ
β
βββββββββββββββββββββββΌββββββββββββββββββββββββββββββββ
β Domain Layer β
β βββββββββββββββ βββββββββββββββ βββββββββββββββ β
β β Models β β Repository β β Services β β
β β (data) β β (abstract) ββββ (implement) β β
β βββββββββββββββ βββββββββββββββ βββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
- Repository: Abstract class defining the contract
- Service: Concrete implementation of the repository
- This enables easy testing and dependency injection!
π‘ Pro Tips
-
Use barrel files: Each folder has an
index.dartfor clean imports// Instead of this: import 'package:app/auth/domain/models/auth_model.dart'; import 'package:app/auth/domain/repository/auth_repository.dart'; // Just do this: import 'package:app/auth/index.dart'; -
Consistent naming: The CLI automatically converts your feature name to lowercase
ff generate -n UserProfile -t bloc # Creates "userprofile" folder ff generate -n user_profile -t bloc # Creates "user_profile" folder β -
Organize by feature: Use the
-pflag to group related featuresff generate -n login -t bloc -p auth ff generate -n register -t bloc -p auth ff generate -n forgot_password -t bloc -p auth
π€ Contributing
Contributions are welcome! Feel free to open issues or submit PRs.
π License
This project is licensed under the MIT License - see the LICENSE file for details.
Made with β€οΈ by bazl-E
Libraries
- commands/generate
- feature_folder_cli
- functions/bloc
- functions/cubit
- functions/getx
- functions/index
- functions/provider
- generators/feature_generator
- generators/index
- templates/bloc_templates
- templates/cubit_templates
- templates/getx_templates
- templates/index
- templates/provider_templates
- utils/directory
- utils/files
- utils/logs