cleany 1.0.16
cleany: ^1.0.16 copied to clipboard
A CLI tool to generate Clean Architecture feature structure for Flutter projects
π Cleany β Flutter Clean Architecture Generator #
Stop writing boilerplate. Start building features.
Cleany is more than just a feature generatorβitβs a complete automation toolkit designed to bootstrap full Flutter projects using Clean Architecture and Cubit state management.
Setting up a scalable architecture from scratch takes hours. Wiring Dependency Injection, configuring routers, and creating layers of Data, Domain, and Presentation for every single feature is exhausting. Cleany does all of this in seconds.
β¨ Why Choose Cleany? #
- β‘ Zero Config: Run a command and start coding your business logic immediately.
- π‘οΈ Safe & Smart: Built-in collision detection ensures you never accidentally overwrite existing code or create import loops.
- π Cross-Platform: Works flawlessly on Windows, macOS, and Linux.
- π¦ Modern Stack: Automatically installs and configures the industry's best tools:
go_router,get_it,flutter_bloc,dio,supabase_flutter, and more.
π οΈ Installation #
Activate the package globally via Dart:
dart pub global activate cleany
πͺ Windows Users: Fixing the "Not on your path" Warning #
If you see a warning stating that the executable was installed in a directory:
Warning: Pub installs executables into C:\Users\user_name\AppData\Local\Pub\Cache\bin, which is not on your path.
You can fix that by adding that directory to your system's "Path" environment variable.
A web search for "configure windows path" will show you how.
Activated cleany x.x.x.
don't worry! This just means Windows doesn't know where to find the cleany command yet.
Fix it in 5 easy steps:
- π Search: Press the Windows key, type "Environment Variables", and hit Enter.
- π±οΈ Navigate: Click the Environment Variables... button at the bottom right of the window.
- π Edit Path: In the top section (User variables), find the variable named Path, click on it, and select Edit....
- β Add the Path: Click New and paste the exact path below:
%USERPROFILE%\AppData\Local\Pub\Cache\bin
- π Save & Restart: Click OK on all open windows to save. Crucial: Close your current terminal (VS Code, CMD, or PowerShell) and open a new one.
- β
Verify: Type
cleany -hin your new terminal. If you see the help menu, you are ready to go!
π How Cleany Works #
For the best experience, start with a fresh Flutter project.
π§± 1. Core Structure Automation (cleany -c) #
Run this once at the beginning of your project. It generates all foundational components of a scalable Flutter application, including:
- Error handling & Network configuration (
dio) - Navigation (
go_router) - Theming & Constants
- Dependency Injection (
get_it&injectable)
Automatic Dependency Management: Cleany doesn't just create folders; it automatically finds the latest compatible versions of essential packages and injects them into your pubspec.yaml. No manual editing requiredβeverything is wired automatically.
π± 2. Screen Feature Generation (cleany -s <name>) #
Need a new page? Cleany generates a complete module containing Data, Domain, and Presentation layers.
But it doesn't stop thereβit automatically updates your app_router.dart and configure_dependencies.dart so your feature is functional immediately.
π§© 3. Widget & Sub-Feature Generation (cleany -w <name>) #
Perfect for standalone, reusable UI modules that still need clean architecture (like a complex custom card or a bottom sheet).
Need to nest it? Use the -f flag to create a sub-feature inside an existing parent feature!
cleany -w header -f profile β Generates the header feature safely inside lib/features/profile/sub/header.
π Usage & Commands #
| Command | Description | Example |
|---|---|---|
cleany -h |
Show help and usage information. | cleany -h |
cleany -c |
Initialize Core: Builds the entire core folder structure and installs all dependencies. (Run this first in a fresh project) | cleany -c |
cleany -s <name> |
Create Screen Feature: Generates a full feature with routing & DI. | cleany -s auth |
cleany -w <name> |
Create Widget Feature: Generates a standalone feature intended as a reusable widget. | cleany -w custom_button |
cleany -w <name> -f <parent> |
Create Sub-Feature: Generates a widget feature nested inside an existing parent feature. | cleany -w user_card -f auth |
π¦ What gets generated? #
π Feature Structure (cleany -s & cleany -w) #
Whether it's a screen or a widget, Cleany enforces a strict, scalable structure:
lib/features/feature_name/
βββ data/
β βββ datasources/ (remote_data_source.dart)
β βββ models/ (model.dart)
β βββ repositories/ (repository_data.dart)
βββ domain/
β βββ entities/ (entity.dart)
β βββ repositories/ (repository_domain.dart)
β βββ use_cases/ (use_case.dart)
βββ presentation/
β βββ cubit/ (cubit.dart, state.dart)
β βββ pages/ (feature_screen.dart / feature_widget.dart)
β βββ widgets/ (widget.dart) // Only for -s (Screen)
βββ di/ (feature_di.dart)
ποΈ Core Structure (cleany -c) #
A rock-solid foundation for any enterprise-level app:
lib/core/
βββ common/
βββ constants/
β βββ app_colors.dart
β βββ app_images.dart
β βββ app_enums.dart
β βββ app_icons.dart
βββ di/
β βββ configure_dependencies.dart
β βββ third_part.dart
βββ errors/
β βββ failure.dart
β βββ network_exceptions.dart
βββ extensions/
β βββ context_extensions.dart
β βββ string_extensions.dart
β βββ color_extensions.dart
β βββ font_extensions.dart
βββ navigation/
β βββ app_router.dart
β βββ routers.dart
βββ network/
β βββ dio_client.dart
β βββ api_endpoints.dart
βββ services/
β βββ local_keys_service.dart
β βββ app_device_utils.dart
βββ theme/
β βββ app_theme.dart
β βββ app_text_theme.dart
βββ utils/
β βββ validators.dart
β βββ formatters.dart
βββ widgets/
β βββ loading_widget.dart
βββ setup.dart
β€οΈ Contributions & Issues #
Found a bug or have a feature request? Feel free to open an issue or contribute to the repository! Let's build the ultimate Flutter architecture tool together.