cleany 1.0.16 copy "cleany: ^1.0.16" to clipboard
cleany: ^1.0.16 copied to clipboard

A CLI tool to generate Clean Architecture feature structure for Flutter projects

πŸš€ Cleany β€” Flutter Clean Architecture Generator #

Pub Version Platform

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:

  1. πŸ” Search: Press the Windows key, type "Environment Variables", and hit Enter.
  2. πŸ–±οΈ Navigate: Click the Environment Variables... button at the bottom right of the window.
  3. πŸ“‚ Edit Path: In the top section (User variables), find the variable named Path, click on it, and select Edit....
  4. βž• Add the Path: Click New and paste the exact path below:
%USERPROFILE%\AppData\Local\Pub\Cache\bin

  1. πŸ”„ 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.
  2. βœ… Verify: Type cleany -h in 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.

7
likes
140
points
290
downloads

Publisher

unverified uploader

Weekly Downloads

A CLI tool to generate Clean Architecture feature structure for Flutter projects

Homepage
Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

args, path, yaml, yaml_edit

More

Packages that depend on cleany