archit 0.0.1 copy "archit: ^0.0.1" to clipboard
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 --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:

  • βœ… UseCase class created in domain/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
6
likes
0
points
214
downloads

Publisher

verified publisheralfuad.me

Weekly Downloads

A powerful CLI tool to scaffold Flutter projects with clean architecture.

Repository (GitHub)
View/report issues

Topics

#cli #flutter #clean-architecture #scaffold #generator

License

unknown (license)

Dependencies

args, path, yaml

More

Packages that depend on archit