Skip to content

flutter_modular_monorepo Free

A comprehensive Flutter monorepo template with modular architecture, dual-GetIt DI, FeatureSDK self-registration, two-phase initialization, and build-time dependency stripping. Generates a full Dart workspace with Melos, Fastlane, and CI/CD workflows.

Version: 3.0.0

Variables

VariableTypeDefaultDescription
appNamestringMyAppThe name of your application
organizationstringMyCompanyThe name of your organization
domainstringcomYour organization's top-level domain
prefixstringAppPrefix for project components (e.g., 'App' for AppButton)
prefixCasingenum (upperCase, pascalCase)pascalCaseCasing style for the prefix
gitProviderenum (github, gitlab)githubGit provider for CI/CD workflows
networkLibraryenum (dio, http)dioHTTP client library
isUsingWebSocketbooleanfalseInclude WebSocket SDK
websocketLibraryenum (dart, phoenix)dartWebSocket library (if using WebSocket)
isUsingFirebasebooleanfalseUsing Firebase
analyticsVendorsarraynoneAnalytics vendors to include (firebase, appsflyer, mixpanel, moengage, none)
monitoringVendorsarraynoneMonitoring vendors to include (crashlytics, sentry, newrelic, grafana, none)
isUsingFeatureFlagsbooleanfalseInclude Feature Flags SDK
featureFlagVendorenumnoneFeature flag vendor implementation: flagr, remote_config, launch_darkly, custom
stateManagementenum (bloc, cubit, provider, riverpod)blocState management solution (4 variants: bloc, cubit, provider, riverpod)
includeGeneratedbooleanfalseInclude generated files in Git
includeIntegrationTestbooleantrueInclude integration tests
integrationTestFrameworkenum (patrol, maestro, none)patrolIntegration test framework
initializeGitRepobooleantrueInitialize a Git repository
userTierstringfreeUser subscription tier (injected by CLI, not prompted)

Usage

Interactive

bash
archipelago generate flutter_modular_monorepo

Non-interactive (CI)

bash
archipelago generate flutter_modular_monorepo --config my_config.json

Generation Phases

The brick orchestrates 10+ sub-bricks in a specific order:

  1. Phase 1: Core Utilities — shared_dependencies, shared_app_config, flutter_l10n, core_infrastructure_package, app_lints, app_utilities
  2. Phase 1.5: Assets & UI Kit — flutter_asset (with prefix), flutter_ui_kit
  3. Phase 2: Tooling — monorepo_toolkit, asset_generator
  4. Phase 3: Infrastructure SDKs — network_sdk, websocket_sdk (optional), analytics_sdk + per-vendor bricks (optional), feature_flag_sdk (optional), monitoring_sdk + per-vendor bricks (optional)
  5. Pro Tooling (Pro/Enterprise only) — coverage_manager, size_guard, asset_optimizer
  6. Enterprise Tooling (Enterprise only) — affected, ui_kit_generator
  7. Phase 5: Starter Features (always) — introduction_sdk, auth_sdk, home_sdk, paywall_sdk
  8. Phase 6: Git Init (optional)
  9. Phase 6.5: Environment Files — .env files for each flavor
  10. Phase 7: Platform Initialization — flutter create in temp dir + Gradle/iOS patching
  11. Phase 8: Bootstrap — dart pub get + melos bootstrap
  12. Phase 8.5: Platform Setup — flavorizr, native splash, launcher icons. flavorizr's instructions: list runs android:flavorizrGradle (emits android/app/flavorizr.gradle.kts with the product flavors) immediately before android:buildGradle (which only appends the apply from("flavorizr.gradle.kts") line referencing it) — listing only the latter leaves a dangling reference and Android builds fail before compiling anything (Archipelago-28cz).
  13. Phase 9: Slang Translations — dart run slang for all packages with slang.yaml
  14. Phase 10: Code Generationmelos run build (build_runner). The build script chains build:select (all non-app packages, topologically ordered) and build:app (the host app itself, which build:select deliberately --ignore=s) so the single documented command covers the whole workspace, including injector.config.dart and app_router.gr.dart for the host app (Archipelago-ytsg). build:select and build:app remain independently runnable for iterative, package-only loops.

Vendor Multi-Select

Analytics and monitoring vendors are selected via Mason type: array multi-select. Boolean flags are derived in pre_gen.dart:

? Which analytics vendors do you want?
❯ ◉ firebase
  ◯ appsflyer
  ◯ mixpanel
  ◯ moengage
  ◯ none

Only selected vendor bricks are generated. Selecting "none" or leaving empty skips the entire SDK.

Generated Structure

├── .claude/commands/          # Claude Code slash commands
├── .github/workflows/         # CI/CD workflows (if GitHub)
├── CLAUDE.md                  # AI coding assistant context
├── apps/
│   ├── {app_name}/
│   │   ├── android/           # Generated via flutter create + Gradle patching
│   │   ├── ios/               # Generated via flutter create + iOS patching
│   │   ├── fastlane/          # iOS/Android build automation
│   │   ├── launcher/          # App icons per flavor
│   │   ├── splash/            # Splash screen assets
│   │   ├── lib/
│   │   │   ├── app.dart
│   │   │   ├── bootstrap.dart
│   │   │   ├── main_development.dart
│   │   │   ├── main_staging.dart
│   │   │   ├── main_production.dart
│   │   │   ├── di/injector.dart
│   │   │   ├── host/
│   │   │   │   ├── host_app_widget.dart
│   │   │   │   └── initializers/
│   │   │   └── router/app_router.dart
│   │   ├── flavorizr.yaml
│   │   ├── flutter_launcher_icons-*.yaml
│   │   └── flutter_native_splash.yaml
│   └── {app_name}_widgetbook/  # Widgetbook app (all platforms)
├── shared/
│   ├── feature_sdk/           # FeatureSDK base + registry
│   ├── locale_core/           # Slang-based i18n (generated by flutter_l10n)
│   ├── dependencies/          # Centralized dependencies
│   ├── app_config/            # Environment/flavor config
│   └── router_registry/       # Route registration
├── features/
│   ├── auth/                  # auth_api + auth_impl (with per-feature slang)
│   ├── home/                  # home_api + home_impl (with per-feature slang)
│   ├── introduction/          # Onboarding feature
│   └── paywall/               # paywall_api + paywall_impl
├── infrastructure/            # Infrastructure SDKs + vendor impls
├── packages/                  # UI Kit, shared packages
├── utilities/                 # Utility packages
├── devtools/                  # Monorepo toolkit + asset generator
├── build_prepare.yaml         # Build-time dependency stripping
├── flavors.yaml               # Flavor configuration
├── pubspec.yaml               # Workspace root with melos scripts
└── analysis_options.yaml

Key Architecture Patterns

  • Dual-GetIt — Global scope (SDKs, infra) + local scope per feature (repos, usecases)
  • FeatureSDK self-registration — Features register routes and DI without app knowing about them
  • Two-phase init — Pre-launch (blocking: DI, routes) + Post-launch (non-blocking: analytics, flags)
  • build_prepare — Swap debug → noop dependencies at build time
  • Per-feature slang — Each feature module can have its own translations with scoped translate_var

Note: userTier is injected automatically by the CLI based on the authenticated user's subscription tier and is not included in interactive prompts.

Built by Banua Coder