Easy Init CLI
π Overview
Easy Init CLI is a powerful command-line tool designed to streamline the initialization of Flutter projects. It automatically sets up your project with a well-structured, scalable, and testable architecture, saving you time on boilerplate setup.
Currently, it supports TDD + Clean Architecture, a robust pattern favoured by many professional Flutter developers for its separation of concerns and testability.
β¨ Key Features
- Automated Project Setup: Instantly generate a complete project structure.
- Clean Architecture: Follows industry-standard TDD + Clean Architecture principles.
- Feature Generation: Easily add new features (like Authentication) with a single command.
- Dependency Management: Automatically adds necessary dependencies and dev-dependencies.
- Customizable: Generated code is a starting point you can tailor to your needs.
π¦ Installation
Install the package globally from the command line:
dart pub global activate easy_init_cli
π οΈ Usage Guide
1. Create a New Project
Generate a new Flutter project with a custom organization domain:
easy create project
Follow the prompts to enter your project name and organization domain (e.g., com.example).
2. Initialize Architecture
Navigate to your project directory:
cd <your_project_name>
Initialize the project structure:
easy init
You will be prompted to select an architecture. Currently, TDD + Clean Architecture is the supported pattern.
3. Create a Feature
Generate a new feature module following Clean Architecture principles:
easy create feature
Or specify the feature name directly:
easy create feature:<feature_name>
Note: If you name your feature
authorauthentication, the CLI will automatically include authentication-related screen files.
4. Run Build Runner
Simplify running the build_runner for code generation:
easy build
5. Update CLI
Keep your CLI up to date with the latest features and fixes:
easy update
ποΈ Architecture
TDD + Clean Architecture
This architecture separates the code into three main layers: Data, Domain, and Presentation, ensuring independence and testability.
Project Structure
lib/
βββ app.dart # Main application widget
βββ app_runner.dart # Application runner configuration
βββ main.dart # Application entry point
βββ common/ # Reusable components, utilities, and shared logic across features
β βββ widgets/ # Common UI components
βββ core/ # Core functionalities, infrastructure, and cross-cutting concerns
β βββ api_endpoints/ # API endpoint definitions
β βββ base_usecase/ # Base use case definitions
β βββ config/ # Application configuration
β βββ dependency_injection/ # Dependency injection setup
β βββ extensions/ # Dart extensions
β βββ failures/ # Custom failure classes for error handling
β βββ network/ # Network client and handling
β βββ routes/ # Application routing definitions
β βββ services/ # Core services
β βββ theme/ # Application theme and colors
βββ features/ # Feature-specific modules, each following clean architecture
βββ <feature_name>/
βββ data/ # Data layer (repositories implementation, data sources, models)
β βββ data_sources/ # Remote and local data sources
β βββ models/ # Data transfer objects (DTOs)
β βββ repositories_impl/# Repository implementations
βββ domain/ # Domain layer (entities, repository interfaces, use cases)
β βββ entities/ # Core business entities
β βββ repositories/ # Repository interfaces
β βββ usecases/ # Business logic (use cases)
βββ presentation/ # Presentation layer (UI, blocs, widgets)
βββ blocs/ # BLoC for state management
βββ screens/ # Screens/Pages
βββ widgets/ # UI components specific to the feature
For a deep dive into this architecture, we recommend Reso Coder's Flutter Clean Architecture Course.
Note: A "Number Trivia" feature is generated by default to demonstrate the architecture's flow. You can use this as a reference or remove it when you start building your core features.
π€ Contributing
Contributions are welcome! If you find a bug or have a feature request, please open an issue.
- Fork the repository.
- Create your feature branch (
git checkout -b feature/my-feature). - Commit your changes (
git commit -m 'Add some feature'). - Push to the branch (
git push origin feature/my-feature). - Open a Pull Request.
π License
This project is licensed under the BSD 3-Clause License - see the LICENSE file for details.
Libraries
- commands/command_list
- commands/create_feature/create_feature
- commands/create_project/create_project
- commands/create_services/create_services
- commands/init/init
- commands/run_build_runner/run_build_runner
- commands/update/update
- core/config/config
- core/generator
- core/structure/common_file_contents/auth_content
- core/structure/common_file_contents/common_file_contents_export
- core/structure/common_file_contents/misc_content
- core/structure/common_file_contents/network_content
- core/structure/common_file_contents/theme_content
- core/structure/common_file_contents/widget_content
- core/structure/export_structure
- core/structure/models/structure
- core/structure/mvc_getx/file_contents/core_file_contents
- core/structure/mvc_getx/file_contents/mvc_file_contents
- core/structure/mvc_getx/file_contents/mvc_trivia_content
- core/structure/mvc_getx/mvc_getx_structure
- core/structure/tdd_clean_structure/file_contents/file_contents
- core/structure/tdd_clean_structure/file_contents/number_trivia_content
- core/structure/tdd_clean_structure/file_contents/rest_api_file_contents
- core/structure/tdd_clean_structure/file_contents/tdd_common_content
- core/structure/tdd_clean_structure/tdd_clean_structure
- core/version
- easy_init_logo
- functions/config_manager
- functions/create
- functions/find_current_architecture
- interfaces/args_mixin
- interfaces/command
- interfaces/logging
- utils/shell_utils
- utils/user_input