archit 0.0.1
archit: ^0.0.1 copied to clipboard
A powerful CLI tool to scaffold Flutter projects with clean architecture.
π¨ Archit CLI #
A powerful command-line tool that scaffolds Flutter projects following Clean Architecture principles β with automatic feature generation, usecase wiring, routing, and dependency injection.
β Prerequisites #
- Flutter SDK installed
- Dart SDK (comes with Flutter)
flutter --version
dart --version
π¦ Installation #
# Activate globally from pub.dev
dart pub global activate archit
# Add Dart's pub cache bin to your PATH (add to ~/.bashrc or ~/.zshrc)
export PATH="$PATH:$HOME/.pub-cache/bin"
source ~/.zshrc
π Usage #
Create a new Flutter project #
cd ~/projects
archit
Use inside an existing Flutter project #
cd my_flutter_app
archit
When run inside an existing Flutter project root, Archit skips project creation and goes straight to the Feature Manager.
π¬ Interactive Flow #
ββββββββββββββββββββββββββββββββββββββββββββββββββββ
β π¨ Archit CLI v1.0.0 β
β Clean Architecture Scaffold Generator β
ββββββββββββββββββββββββββββββββββββββββββββββββββββ
β€ Enter project name: my_shop_app
π± Select project type:
1. Application (app)
2. Package
π₯οΈ Select target platforms:
(comma-separated numbers, e.g: 1,2 β or press Enter for all)
1. Android 2. iOS 3. Web 4. Windows 5. macOS 6. Linux
β‘ Select state management:
1. Provider
2. Riverpod
3. GetX
4. BLoC
βΆ Creating Flutter project...
β Dependencies installed!
β Project "my_shop_app" created successfully!
ββββββββββββββββββββββββββββββββββββββ
π¦ Features
ββββββββββββββββββββββββββββββββββββββ
(No features yet)
ββββββββββββββββββββββββββββββββββββββ
1. β Add new feature
2. πͺ Exit
β Add feature: product
β Feature "product" created and registered in routes & DI!
ββββββββββββββββββββββββββββββββββββββ
π§© Usecases β product
ββββββββββββββββββββββββββββββββββββββ
(No usecases yet)
ββββββββββββββββββββββββββββββββββββββ
1. β Add new usecase
2. β¬
οΈ Back
β Add usecase: get_products
β UseCase "get_products" wired to datasource, repository & DI!
π Generated Project Structure #
Provider / Riverpod / BLoC #
lib/
βββ core/
β βββ constants/
β β βββ app_constants.dart # Base URL, timeouts, app name
β β βββ app_strings.dart # Reusable text strings
β β βββ app_sizes.dart # Padding, radius, icon size tokens
β βββ di/
β β βββ injection_container.dart # GetIt DI β auto-updated on feature/usecase add
β βββ errors/
β β βββ failures.dart # ServerFailure, CacheFailure, NetworkFailure
β β βββ exceptions.dart # ServerException, CacheException
β βββ network/
β β βββ api_client.dart # Dio client with interceptors & auth token support
β β βββ network_info.dart # Internet connectivity check
β βββ routes/
β β βββ app_router.dart # GoRouter β auto-updated when features are added
β βββ theme/
β β βββ app_colors.dart # Full color palette (light/dark/gradients)
β β βββ app_theme.dart # Material 3 light & dark ThemeData
β β βββ app_text_styles.dart # Responsive text styles (ScreenUtil)
β βββ usecases/
β β βββ usecase.dart # Abstract UseCase<Type, Params> base class
β βββ utils/
β βββ extensions.dart # Context, DateTime, String, Number extensions
β βββ validators.dart # Email, password, phone, required validators
β βββ logger.dart # Pretty Logger instance
βββ features/
β βββ product/ # Example feature
β βββ data/
β β βββ datasources/
β β β βββ product_remote_datasource.dart
β β βββ models/
β β β βββ product_model.dart # JSON serialization + fromEntity
β β βββ repositories/
β β βββ product_repository_impl.dart
β βββ domain/
β β βββ entities/
β β β βββ product_entity.dart # Pure Dart, Equatable
β β βββ repositories/
β β β βββ product_repository.dart # Abstract contract
β β βββ usecases/
β β βββ get_products_usecase.dart # Auto-generated β¨
β βββ presentation/
β βββ providers/ # ChangeNotifier (Provider) or StateNotifier (Riverpod)
β βββ screens/ # product_screen.dart
β βββ widgets/
βββ main.dart # Configured per state management
βββ app.dart # MaterialApp.router + ScreenUtil + Theme
GetX #
lib/
βββ core/
β βββ routes/
β β βββ app_routes.dart # Route name constants
β β βββ app_pages.dart # GetPage list β auto-updated
β βββ ...same as above
βββ features/
β βββ product/
β βββ data/ / domain/ # Same as above
β βββ presentation/
β β βββ controllers/
β β β βββ product_controller.dart # GetxController with Rx state
β β βββ screens/
β β βββ widgets/
β βββ bindings/
β βββ product_binding.dart # Auto-generated & registered β¨
π¦ Pre-installed Packages #
| Category | Packages |
|---|---|
| State Management | provider / flutter_riverpod / get / flutter_bloc + bloc |
| Routing | go_router (or GetX built-in) |
| Network | dio |
| Storage | hive, hive_flutter, flutter_secure_storage |
| UI Utilities | flutter_screenutil, google_fonts, flutter_svg, cached_network_image |
| Animations | flutter_animate, shimmer, loading_animation_widget |
| Components | flutter_staggered_grid_view, flutter_rating_bar, google_nav_bar, badges, awesome_dialog |
| Media | image_picker, url_launcher |
| Data | equatable, dartz, intl |
| DI | get_it |
| Logging | logger |
β¨ What Gets Auto-Wired #
When you add a feature:
- β Full Clean Architecture folder structure created
- β Route registered in GoRouter / GetX AppPages
- β DataSource, Repository contract & implementation scaffolded
- β Presentation layer generated (Provider / Riverpod / GetxController / BLoC)
- β GetX Binding created and registered (GetX only)
- β GetIt DI entries added automatically
When you add a usecase:
- β
UseCaseclass created indomain/usecases/ - β Method signature added to repository interface
- β Method implementation added to repository impl
- β Method stub added to remote data source
- β UseCase registered in GetIt injection container
π οΈ Run from Source (without global install) #
cd archit
dart run bin/archit.dart
πΊοΈ Roadmap #
- β Local datasource generation
- β Unit test file scaffolding
- β Model field definition during generation
- β
archit remove feature <name>command