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
--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 app_flow_cli.yaml

// pass your config to remove the folders & files
app_flow_cli --clean --config app_flow_cli.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. This 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 (app_flow_cli.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.

License

This package is available under the MIT License.

Libraries

app_flow_cli
Support for doing something awesome.