fabrik 0.1.8
fabrik: ^0.1.8 copied to clipboard
A CLI to generate scalable, testable, clean Flutter feature scaffolding using DDD layered architecture.
π§± Fabrik CLI #
A powerful CLI tool to generate scalable, testable, and clean Flutter feature scaffolding using DDD layered architecture.
Built with developer experience in mind β generate complete feature folders in seconds.
β¨ Features #
- β Clean architecture structure (Model β Entity β DataSource β Repository β UseCase β BLoC)
- β Barrel files auto-generated
- β
Supports
--output-diror-oto customize output - π οΈ Optional flags like
--with-bloc,--minimalcoming soon
π Installation #
dart pub global activate fabrik
βοΈ Set Up PATH (if needed) #
After activating the CLI, make sure Dartβs global bin directory is in your system PATH.
macOS/Linux
# Add this to your shell config file (~/.zshrc, ~/.bashrc, etc.)
export PATH="$PATH":"$HOME/.pub-cache/bin"
Windows
Locale the dart global bin path and add it to system PATH
C:\Users\<YourUsername>\AppData\Local\Pub\Cache\bin
π§° Usage #
Generate a feature #
fabrik generate feature auth
This will create:
./auth/
|- models/
|- entities/
|- usecases/
|- blocs/
|- repository.dart
|- data_source.dart
|- auth.dart (barrel)
Generate into a specific folder #
fabrik generate feature auth -o app_auth
β‘οΈ Outputs to ./app_auth/
π¦ Output Example #
Inside your feature folder:
lib/features/auth/
|- models/
|- user_model.dart
|- models.dart
|- entities/
|- user.dart
|- entities.dart
|- usecases/
|- login_usecase.dart
|- usecases.dart
|- blocs/
|- auth_bloc.dart
|- auth_event.dart
|- auth_state.dart
|- repository.dart
|- data_source.dart
|- auth.dart
All classes are stubbed with clean and minimal code β ready to be implemented.
π Recommended Utility Packages #
Fabrik scaffolds rely on some essential packages for clean architecture, error handling, and code generation.
To get started, add the following to your pubspec.yaml:
dependencies:
# Core utility package containing Failure & Status classes
flutter_core:
git:
url: https://github.com/abhakhand/flutter_core.git
ref: main
# Functional programming support (Either, Option, etc.)
dartz:
# State management with BLoC
bloc:
flutter_bloc:
equatable:
# Code generation support
json_annotation:
freezed_annotation:
# Dependency injection
get_it: ^7.6.4
injectable: ^2.3.2
dev_dependencies:
build_runner:
freezed:
injectable_generator:
json_serializable:
very_good_analysis:
βοΈ Donβt forget to run #
flutter pub get
dart run build_runner build --delete-conflicting-outputs
π Related #
- mason β powering this scaffolding magic.
- flutter_core β recommended base package for
Failure,Status, and architecture utilities.
π£ Coming Soon #
- β
--minimalflag for model-only scaffolds - β
fabrik initto generate ApiClient, Config, and other architecture utils - β VSCode Extension for Fabrik
- β Web UI at fabriktool.com
Maintainers #
Inspired by real-world Flutter app architecture challenges. Open source. Open to contributions. Built for the Flutter community.