Skip to content

App Scaffold

The app command scaffolds a new Flutter application inside the monorepo workspace. It generates all the boilerplate needed for a fully configured app: Dart source files, Fastlane configuration, launcher icons, splash screens, flavorizr config, and IDE run configurations.

Usage

bash
# Create a new app
dart run monorepo_toolkit app create --name my_app --org com.example

# With a custom domain for bundle identifiers
dart run monorepo_toolkit app create --name my_app --org com.example --domain example.com

Flags

FlagAbbrDefaultDescription
--name-nrequiredApp name in snake_case (e.g., my_app)
--org-ocom.exampleOrganization identifier (e.g., com.banuacoder)
--domain-dderived from orgDomain for bundle identifiers (e.g., banuacoder.com)

The app name must be lowercase with underscores only (^[a-z][a-z0-9_]*$).

How it works

The command uses a two-tier strategy:

  1. Mason brick (preferred) -- If the app_scaffold Mason brick is installed, it uses Mason to generate the app. This produces the most complete output with all Fastlane files, CI configs, and platform-specific setup.

  2. Built-in templates (fallback) -- If Mason is not available, the command falls back to built-in Dart templates that generate the core source files.

Generated structure

The scaffolded app is created at apps/<name>/ with:

apps/my_app/
  lib/
    main.dart              # Entry point per flavor
    main_development.dart
    main_staging.dart
    main_production.dart
    bootstrap.dart         # App initialization
    app.dart               # Root widget
    di/
      injector.dart        # Dependency injection setup
  fastlane/
    Fastfile               # Build and deploy lanes
    Appfile                # App metadata
    Matchfile              # Code signing config
    Gemfile                # Ruby dependencies
  pubspec.yaml

Post-scaffolding steps

After the command completes, follow these steps:

bash
# 1. Resolve workspace dependencies
dart pub get

# 2. Generate injectable, auto_route, and other code
melos run build

# 3. Generate platform directories (Android/iOS)
flutter create apps/my_app --org com.example

# 4. Apply flavor configuration
melos run flavor:generate -- --app my_app

Mason brick installation

To use the Mason-based scaffolding (recommended), install the brick first:

bash
# From mason.yaml (if configured in the workspace)
mason add app_scaffold

# From a git repository
mason add app_scaffold --git-url https://github.com/banua-coder/archipelago

# Globally
mason add -g app_scaffold

If Mason is not installed at all, install it with:

bash
dart pub global activate mason_cli

When to use this

Use app create when adding a new host application to the workspace. Common scenarios:

  • Adding a second app variant (e.g., app_widgetbook alongside template_app)
  • Setting up a white-label app for a different brand
  • Creating a standalone demo app for a specific feature

Built by Banua Coder