devforge 1.4.0
devforge: ^1.4.0 copied to clipboard
CLI tool to generate Flutter/Dart boilerplate code.
devforge #
๐ A powerful CLI for generating Flutter/Dart boilerplate code
Stop writing the same utility files over and overโlet devforge handle the heavy lifting!
๐ Documentation #
| Document | Description |
|---|---|
| doc/COMMANDS.md | Full command reference with examples |
| doc/CONFIGURATION.md | User and project configuration (devforge.yaml) |
| doc/ARCHITECTURE.md | Project structure and execution flow |
| doc/CONTRIBUTING.md | How to contribute and add generators/commands |
| doc/README.md | Documentation index |
๐ Table of contents #
- Project Goals
- Features
- Requirements
- Installation
- Usage
- Configuration
- Output structure
- Project Structure
- Architecture
- Coding Guidelines
- Future Features
- Development
- License
๐ฏ Project Goals #
| Goal | Description |
|---|---|
| โก Simple commands | Provide straightforward commands for common Flutter code generation workflows |
| ๐ Reduce repetition | Cut down repetitive setup and manual file creation |
| ๐ Dual modes | Support both direct commands and interactive menu-driven generation |
โจ Features #
devforge offers both direct command execution and an interactive mode to quickly scaffold necessary services and utilities:
| Icon | Feature | Description |
|---|---|---|
| ๐ | ApiClient Service | Creates api_client.dart with Dio-based API setup + logger_interceptor.dart |
| ๐ฆ | Assets Utility | Creates assets_utils.dart with static paths for all resources in assets/ |
| ๐ | FCM Service | Generates fcm_service.dart for Firebase Cloud Messaging setup |
| ๐ | Refresh Token Service | Scaffolds refresh_token.dart for token refresh logic |
| ๐พ | Local Storage Service | Creates SharedPreferencesService or GetStorageService |
| ๐๏ธ | Sqflite Service | Creates sqflite_service.dart for local SQLite storage |
| ๐ | Pagination Utilities | Creates controller + paging_list_view.dart / paging_custom_scroll_view.dart |
| ๐งฉ | BLoC Boilerplate | Creates bloc folder with bloc.dart, state.dart, event.dart |
| ๐ฎ | GetX Boilerplate | Creates GetX folder with controller.dart, bindings.dart, screen.dart |
| ๐ผ๏ธ | App Icon Generator | Generates app icons for all supported platforms |
| ๐ | Localization | Extract strings, generate locale keys and translation files |
| ๐ฉบ | Flutter doctor | Run environment and dependency checks |
| ๐งน | Cache cleaning | Flutter clean and optional pub cache clean |
| ๐ฆ | Flavor builds | Build APK, AppBundle, iOS, or IPA with optional flavor |
| ๐๏ธ | Interactive Mode | Use devforge run for a friendly menu-driven experience |
๐ Requirements #
| Requirement | Details |
|---|---|
| ๐ฏ Dart SDK | >=3.0.0 <4.0.0 |
| ๐ฆ Flutter/Dart project | Generated files are placed under lib/ |
| ๐ PATH | Ensure ~/.pub-cache/bin (or equivalent) is in your PATH |
๐ Installation #
1๏ธโฃ Activate the package #
Activate devforge globally using the Dart package manager:
dart pub global activate devforge
2๏ธโฃ Verify installation #
devforge --help
# or
devforge -h
3๏ธโฃ Check version #
devforge --version
# or
devforge -v
๐จโ๐ป Usage #
There are two primary ways to use DevForge: interactive mode and direct commands.
1๏ธโฃ Interactive mode (devforge run) #
For generating multiple files at once or for a guided experience, use the run command:
devforge run
This launches an interactive multi-select menu and lets you choose which services you want to generate:
? Select what you have to generate:
[ ] Generate ApiClient
[ ] Generate AssetsUtils
[ ] Generate FcmService
[ ] Generate RefreshToken service
[ ] Generate Local Storage Service
[ ] Generate SqfliteService
[ ] Generate Pagination Service
[ ] Generate BLoC folder
[ ] Generate Getx folder
[ ] Generate App icons
[ ] Generate Localization (locale keys + translation files)
[ ] Run Flutter doctor
[ ] Clean (Flutter + optional pub cache)
[ ] Build (APK / AppBundle / iOS / IPA with optional flavor)
2๏ธโฃ Direct commands #
Use these commands for quick, single-purpose generation:
| Command | Description | Output file(s) / effect |
|---|---|---|
devforge generate_config |
Generates a devforge.yaml configuration file in the current project. |
devforge.yaml in the project root |
devforge userInfo |
Opens an interactive prompt to update your stored name (used in generated file comments). | Updates user name stored in DevForge config |
devforge show_user_name |
Prints your currently saved user name. | Outputs the saved name in the terminal |
devforge api_client |
Generates a boilerplate service for handling API calls. | lib/api_client.dart, lib/logger_interceptor.dart |
devforge assets |
Scans the assets/ folder and generates the assets utility file. |
lib/assets_utils.dart |
devforge fcm |
Generates a boilerplate service for handling FCM. | lib/fcm_service.dart |
devforge refresh |
Generates the service for managing refresh token logic. | lib/refresh_token.dart |
devforge local_storage |
Interactively chooses and generates either shared_preferences or get_storage service. | lib/shared_preferences_service.dart or lib/get_storage_service.dart |
devforge sqflite |
Generates a sqflite singleton service. |
lib/sqflite_service.dart |
devforge pagination |
Generates a controller and reusable widgets for paginated lists. | lib/pagination_controller.dart, lib/paging_list_view.dart, lib/paging_custom_scroll_view.dart |
devforge bloc |
Generates a BLoC directory with bloc.dart, state.dart, and event.dart. |
BLoC folder (path chosen interactively) |
devforge getx |
Generates a GetX directory with controllers, bindings, and views. | GetX folder (path chosen interactively) |
devforge app-icon |
Generates app icons of different sizes in platform-specific folders. | Platform-specific icon assets |
devforge localize |
Extracts strings, generates locale keys and translation files. | lib/locale_keys.dart, lib/en.dart, etc., lib/localization_service.dart |
devforge doctor |
Runs Flutter doctor to check environment and dependencies. | Terminal output from flutter doctor -v |
devforge clean |
Cleans Flutter build/cache; optionally cleans Dart pub cache. | Interactive choice, then runs flutter clean (and optionally dart pub cache clean) |
devforge build |
Builds APK, AppBundle, iOS, or IPA with optional flavor. | Interactive menu for target and flavor, then runs flutter build |
If you pass --help with no command, youโll see the full list of supported commands.
๐ ๏ธ Configuration #
DevForge stores your author name and can generate a project-level configuration file.
| Action | Command |
|---|---|
| ๐ค Update name | devforge userInfo |
| ๐๏ธ Show saved name | devforge show_user_name |
| โ๏ธ Generate config | devforge generate_config |
โน๏ธ On first run, DevForge prompts for your name (used in generated file comments).
โ๏ธgenerate_configcreatesdevforge.yamlin the current directory for customizing generators.
๐ Output structure #
Generated files are placed in the lib/ directory or in a subfolder you specify:
- ๐ Service files (API client, FCM, storage, sqflite, pagination) โ created under
lib/by default - ๐ Folder-based generators (BLoC / GetX) โ you choose the target path interactively
- ๐ App icons โ generated in platform-specific asset folders (Android/iOS)
- ๐ Flutter project detection โ Generator commands check for a Flutter project (e.g.
pubspec.yamlwith Flutter SDK) before running.
๐ Project Structure #
devforge/
โโโ bin/
โ โโโ devforge.dart # CLI entrypoint
โโโ lib/
โ โโโ generators/ # Code generators
โ โ โโโ api_client_generator.dart
โ โ โโโ assets_generator.dart
โ โ โโโ bloc_generator.dart
โ โ โโโ fcm_generator.dart
โ โ โโโ getx_generator.dart
โ โ โโโ app_storage_generator.dart
โ โ โโโ pagination_generator.dart
โ โ โโโ app_icon_generator.dart
โ โ โโโ yaml_generator.dart
โ โ โโโ localization/
โ โโโ commands/ # Process-based commands
โ โ โโโ doctor_command.dart
โ โ โโโ clean_command.dart
โ โ โโโ build_command.dart
โ โโโ templates/ # Dart code templates
โ โ โโโ api_client_template.dart
โ โ โโโ bloc_template.dart
โ โ โโโ ...
โ โโโ utils/ # Shared utilities
โ โโโ user_config.dart
โ โโโ devforge_config.dart
โ โโโ colors.dart
โ โโโ console_log.dart
โ โโโ version_checker.dart
โ โโโ process_runner.dart
โ โโโ flutter_project_detector.dart
โ โโโ spinner.dart
โโโ test/
โโโ devforge_test.dart
๐๏ธ Architecture #
| Rule | Description |
|---|---|
| 1๏ธโฃ | Each generator lives in its own file under lib/generators |
| 2๏ธโฃ | Generators expose a single async function (e.g. generateApiClientService()) |
| 3๏ธโฃ | Templates use string interpolation in lib/templates |
| 4๏ธโฃ | CLI arguments parsed with the args package |
| 5๏ธโฃ | Terminal output goes through console_log.dart |
| 6๏ธโฃ | Colors defined in colors.dart |
| 7๏ธโฃ | Shell execution (flutter/dart) goes through process_runner.dart |
| 8๏ธโฃ | Flutter project detection via flutter_project_detector.dart before generators |
| 9๏ธโฃ | Main entrypoint is bin/devforge.dart |
๐ Coding Guidelines #
- โ Follow Dart best practices
- โ Keep functions small and modular
- โ
Use
async/awaitfor file generation - โ Print helpful CLI messages
- โ Fail gracefully with meaningful errors
๐ฎ Future Features #
| Status | Feature |
|---|---|
| ๐ | Additional flavor presets (e.g. dev/staging/prod templates) |
| ๐ | More progress spinners in heavy generators |
| ๐ | Optional config file for default paths |
๐งโ๐ป Development #
If you want to contribute to DevForge:
| Step | Command |
|---|---|
| 1๏ธโฃ Clone | git clone https://github.com/prathamesh-mali/devforge.git && cd devforge |
| 2๏ธโฃ Dependencies | dart pub get |
| 3๏ธโฃ Run locally | dart run bin/devforge.dart --help |
| 4๏ธโฃ Run tests | dart test |
๐ License #
MIT License. See LICENSE for details.