app_flow_cli 1.0.2 copy "app_flow_cli: ^1.0.2" to clipboard
app_flow_cli: ^1.0.2 copied to clipboard

AppFlow CLI is a Dart-based command-line tool designed to automate the creation, management, and cleanup of scalable Flutter project structures for a flutter project.

Repo stars Last Commit Repo PRs Repo issues Contributors License
Coverage Status

๐Ÿงฑ AppFlow CLI โ€“ Flutter Project Structure Generator #

AppFlow CLI is a command-line tool built with Dart to help Flutter developers generate and manage scalable project structures using a simple configuration file.

It's perfect for bootstrapping projects with a clean, modular architecture โ€” ideal for solo devs and teams alike.

Pub Version License Pub points Pub Likes Pub popularity


Using the default project structure

Using your own project structure config

โœจ Features #

  • ๐Ÿš€ Generate folder/file structures using YAML config
  • โž• Add new modules or features on demand
  • โ™ป๏ธ Overwrite existing files with a flag
  • ๐Ÿงน Clean/remove previously generated structures

๐Ÿ“ฆ Installation #

dart pub global activate app_flow_cli 

Or install a specific version using:

dart pub global activate app_flow_cli <version>

If you haven't already, you might need to set up your path.

When that is not possible (eg: CI environments), run very_good commands via:

dart pub global run app_flow_cli [options] // e.g dart pub global run app_flow_cli --add structure

Usage #

app_flow_cli [options]

Options #

Option Description
--config <path> Path to the YAML/JSON config file
--add <module> Add a module/feature to the structure
--overwrite Overwrite existing files
--clean Remove previously generated structure
--rm Removes a module
status Show all files & folders generated by AppFlow
--help Display usage information

Example #

Using the default structure.

// generate the default structure
app_flow_cli --add structure

Removing the default structure.

app_flow_cli --clean

Using your own structure.

// pass your own config structure to generate
app_flow_cli --add structure --config appflow.yaml

// pass your config to remove the folders & files
app_flow_cli --clean --config appflow.yaml

Default Structure #

When using the default structure, three key files will be generated:

  1. home.dart: This file serves as the entry point for your app's main screen. It will typically display the primary content for your app.
  2. splash.dart: A splash screen that is shown when the app is launched. It provides a smooth transition into the app.
  3. router.dart: This file manages routing setup, defining routes and handling navigation across the app.
  4. main.dart: This is the main file. The file is overriden only if the --overwrite option is set when you run app_flow_cli --add structure. For example, app_flow_cli --add structure --overwrite.

These files are automatically generated when you run app_flow_cli --add structure and provide a solid starting point for your app's UI and navigation flow.

Configuration Example (appflow.yaml) #

A basic config:

folders:
  # Main application code
  - lib/src/app/             # App-wide configuration
  - lib/src/app/config/      # Environment configurations (dev, staging, prod)"
  - lib/src/app/constants/   # App constants (strings, routes, enums)"
  - lib/src/app/di/          # Dependency injection setup"
  - lib/src/app/theme/       # App theme data"
  
  # Core functionality
  - lib/src/core/            # Core functionality"
  - lib/src/core/errors/     # Error handling classes"
  - lib/src/core/network/    # Network clients and interceptors"
  - lib/src/core/utils/      # Utilities (validators, extensions, formatters)"
  - lib/src/core/widgets/    # Reusable app-wide widgets"
  
  # Feature modules
  - lib/src/features/auth/        # Example feature: Authentication"
  - lib/src/features/auth/data/    # Data layer"
  - lib/src/features/auth/data/datasources/  # Local/remote data sources"
  - lib/src/features/auth/data/models/       # Data transfer objects"
  - lib/src/features/auth/data/repositories/ # Repository implementations"
  - lib/src/features/auth/domain/  # Domain layer"
  - lib/src/features/auth/domain/entities/     # Business logic entities"
  - lib/src/features/auth/domain/repositories/ # Repository interfaces"
  - lib/src/features/auth/domain/usecases/     # Business logic use cases"
  - lib/src/features/auth/presentation/    # UI layer"
  - lib/src/features/auth/presentation/bloc/        # State management"
  - lib/src/features/auth/presentation/pages/       # Full screens/views"
  - lib/src/features/auth/presentation/widgets/     # Feature-specific widgets"
  
  # Routing configuration
  - lib/src/routes/          # Routing configuration"
  
  # Localization
  - lib/l10n/                # Localization files"
  
  # Static files
  - assets/icons/               # App icons"
  - assets/images/              # Images"
  - assets/fonts/               # Custom fonts"
  - assets/translations/        # JSON translation files"
  
  # Testing
  - test/                    # Test files"
  - test/features/            # Feature tests"
  - test/mock/                # Mock classes"
  - test/test_helpers/        # Testing utilities"
  
  # Other
  - integration_test/        # Integration tests"
  - scripts/                 # Build/deployment scripts"

files:   
  "lib/src/routes/app_pages.dart": |
    // Route definitions
    class AppPages {
      static const initial = '/';
    }
    
  "lib/src/routes/app_router.dart": |
    // Router implementation
    class AppRouter {}
    
  "lib/l10n/app_en.arb": |
    // Localization files
    {
      "appTitle": "My App",
      "@appTitle": {
        "description": "The title of the application"
      }
    }
    
  "lib/firebase_options.dart": |
    // Firebase configuration (if used)
    class FirebaseOptions {}
        
  ".gitignore": |
    # Version control ignore
    /build/
    
  "README.md": |
    # Project documentation
    ## My Flutter App
    A developer community application.

Adding new directories in lib #

To add a new directory, run:

app_flow_cli --add features:auth

This will create a new auth directory inside the lib/features folder, and replicate the folder structure defined in your project's configuration or using the default structure. You can add multiple directories at once by separating them with commas, e.g.,

app_flow_cli --add features:auth,product

This command will create both auth and product directories inside lib/features, each following the project's predefined structure.

Removing directories in lib #

To remove directory, run:

app_flow_cli --rm features:auth

This will delete the auth folder, including any subfolders and files inside it.

License #

This package is available under the MIT License.

1
likes
140
points
37
downloads

Publisher

verified publisherpermanentlink.co.za

Weekly Downloads

AppFlow CLI is a Dart-based command-line tool designed to automate the creation, management, and cleanup of scalable Flutter project structures for a flutter project.

Repository (GitHub)

Topics

#cli #codegen #testing #structure #folders

Documentation

API reference

License

MIT (license)

Dependencies

args, console, flutter, path, yaml

More

Packages that depend on app_flow_cli