# 🚀 CleanX CLI
Welcome to **CleanX**!
CleanX is a developer-friendly command-line interface (CLI) tool designed to help you streamline the project setup process for your **Flutter** applications. It promotes the use of **Clean Architecture** principles, ensuring code maintainability, scalability, and testability right from the start.
## ✨ Key Features
### 🏗️ Project Initialization (`init` command)
Effortlessly kickstart your Flutter project with a well-structured directory layout and boilerplate code:
- Automatically generate key directories following Clean Architecture principles:
- **Core**, **Features**, **Theme**, **Routes**, etc.
- Create essential boilerplate files for efficient project setup:
- **Network Service Classes** like `DioNetworkService` for seamless API interactions.
- **Storage Service Classes** like `SecureStorageService` for secure data handling.
- **Utility Classes** such as `LoggerService` for better debugging and logging.
- **Base Classes** for controllers, response handlers, and error handling.
- Initial configuration files (e.g., endpoints, environment variables).
- **App Binding** using the **GetX** library for dependency injection.
- Automatically add and fetch required dependencies in your `pubspec.yaml` file.
### ⚡ Feature Addition (`feature` command)
Quickly add new features to your project with a single command:
- Generate a dedicated directory structure for your feature within the `features` directory.
- Boilerplate code tailored to the specific feature:
- **Model Classes** for data structures.
- **Repository Classes** (remote and interface) to handle data fetching.
- **Controller Classes** for business logic and data interaction.
- **Page Classes** for building UI, powered by **GetX** for state management.
- **Widget Classes** for reusable UI components.
- **Binding Classes** for dependency injection using **GetX**.
- Automatically update your `routes/app_pages.dart` file to include new feature routes.
## 🌟 Benefits
- **Clean Architecture**: Promotes a well-organized code structure that's easy to understand and maintain.
- **Efficient Project Setup**: Save time by automating the setup process.
- **Dependency Injection**: Utilize **GetX** for simplified state management and class interactions.
- **Network Requests**: Handle network requests efficiently with **Dio**.
- **Secure Storage**: Safeguard sensitive data like access tokens using **SecureStorage**.
- **Code Reusability**: Base classes encourage reusability and reduce redundancy.
- **Structured Response Handling**: Simplify API response handling using the `BaseResponseHandler`.
## 🛠️ Getting Started
- **Installation**:
```bash
flutter pub global activate
- Initialize a new Flutter project:
cleanx init <project_name>
- Add a new feature:
cleanx feature <feature_name>
📂 CleanX Project Structure
lib
├── core
│ ├── apis
│ │ └── endpoints.dart
│ ├── error
│ │ └── exceptions.dart
│ ├── network
│ │ ├── network_service.dart
│ │ ├── dio_network_service.dart
│ │ ├── request_interceptor.dart
│ │ └── response_interceptor.dart
│ ├── storage
│ │ ├── base_storage.dart
│ │ └── secure_storage_service.dart
│ ├── utils
│ │ ├── logger_service.dart
│ │ ├── extensions.dart
│ │ └── string_constants.dart
│ │ └── color_constants.dart
│ │ └── asset_constants.dart
│ ├── config.dart
│ └── controllers
│ └── base_controller.dart
│ └── widgets
│ └── base_network_widget.dart
├── features
│ ├── <feature_name>
│ │ ├── data
│ │ │ ├── models
│ │ │ │ └── <feature_name>_model.dart
│ │ │ ├── repositories
│ │ │ │ └── <feature_name>_repository_impl.dart
│ │ │ └── datasource
│ │ │ └── <feature_name>_remote_data_source.dart
│ │ ├── domain
│ │ │ └── repositories
│ │ │ └── <feature_name>_repository.dart
│ │ └── presentation
│ │ ├── controllers
│ │ │ └── <feature_name>_controller.dart
│ │ ├── pages
│ │ │ └── <feature_name>_page.dart
│ │ └── widgets
│ │ └── <feature_name>_widget.dart
├── theme
│ └── app_theme.dart
├── routes
│ └── app_pages.dart
├── bindings
│ ├── initial_binding.dart
│ └── <feature_name>_binding.dart
└── main.dart
📖 Explanation:
- lib: Contains the main source code for the application.
- core: Shared components and utilities:
- apis: API endpoints.
- error: Custom exception classes for error handling.
- network: Network requests powered by Dio.
- storage: Secure data storage.
- utils: Helper classes like
LoggerService
. - controllers: Manage application state and logic.
- widgets: Reusable UI components.
- config: Configuration files (endpoints, env variables).
- features: Each feature has its own directory with:
- data: Models, repositories, and data sources.
- domain: Business logic and repository interfaces.
- presentation: UI, controllers, and widgets for the feature.
- theme: Defines the application's styles and themes.
- routes: Manages navigation routes across the app.
- bindings: Configures dependencies using GetX.
- main.dart: Entry point of the application.
This structure promotes separation of concerns, making the codebase easier to manage and maintain.
Happy coding with CleanX! 😊