Building Modular Monorepos with Melos
May 28, 2025



Summary
Summary
Summary
Summary
The article guides readers through creating a modular Flutter monorepo using Melos, covering setup, structure, dependency management, build tasks, and CI integration. It also highlights how Vibe Studio accelerates Flutter development with an AI-powered, no-code interface.
The article guides readers through creating a modular Flutter monorepo using Melos, covering setup, structure, dependency management, build tasks, and CI integration. It also highlights how Vibe Studio accelerates Flutter development with an AI-powered, no-code interface.
The article guides readers through creating a modular Flutter monorepo using Melos, covering setup, structure, dependency management, build tasks, and CI integration. It also highlights how Vibe Studio accelerates Flutter development with an AI-powered, no-code interface.
The article guides readers through creating a modular Flutter monorepo using Melos, covering setup, structure, dependency management, build tasks, and CI integration. It also highlights how Vibe Studio accelerates Flutter development with an AI-powered, no-code interface.
Key insights:
Key insights:
Key insights:
Key insights:
Melos Overview: Melos helps manage Flutter monorepos with modular code sharing, versioning, and CI-friendly workflows.
Repository Structure: Organize packages by feature area, ensuring clear modular boundaries and shared dependencies.
Automated Versioning: Melos versioning synchronizes semver updates across all packages, respecting interdependencies.
Build & Testing Scripts: Define and run common tasks, like tests or builds, across all modules for consistent results.
CI Integration: Incorporate Melos into your CI pipeline to automate formatting, linting, and testing.
Vibe Studio Synergy: Vibe Studio leverages Steve’s AI to simplify app creation, making Flutter monorepo management even easier.
Introduction
Managing multiple Flutter packages and applications in a single repository can quickly become complex. A modular monorepo approach helps you share code, enforce consistent tooling, and simplify CI/CD pipelines. Melos is a community tool designed to orchestrate and automate workflows in mono repositories, making it an ideal choice for any Flutter team that wants to scale. In this tutorial, you’ll learn how to build and manage a Flutter melos monorepo with clear package boundaries, shared dependencies, and repeatable tasks.
Setting up Melos in Your Repository
First, install Melos globally:
dart pub global activate melos
Or add it as a dev dependency in a new tool/melos.dart directory. At the root of your repo, create a melos.yaml file:
name: my_flutter_monorepo
packages:
- packages/*
- apps/*
scripts:
bootstrap:
run: melos exec -- flutter pub get
format:
run
This configuration tells Melos to treat every folder under packages/ and apps/ as an individual Dart or Flutter package. You also define custom scripts, like melos bootstrap, that invoke a pub get in every package.
Organizing Packages and Modules
A recommended layout:
core
: Business logic, models, utilities.ui_components
: Reusable widgets and themes.network
: API clients and data sources.app_mobile
&app_web
: Platform-specific apps importing shared packages.
Inside each package’s pubspec.yaml, reference other modules by relative path:
dependencies:
flutter:
sdk: flutter
core:
path: ../packages/core
ui_components:
path
This ensures strong modular boundaries, and Melos will handle linking.
Managing Dependencies and Versioning
Monorepos often share versions across all packages. You can use Melos versioning strategies to bump versions consistently:
scripts:
version:
run: melos version --no-publish --yes
Running melos version prompts you to select semver bumps and updates each pubspec.yaml. After that, run melos bootstrap to sync dependencies. When you’re ready to publish to pub.dev, use:
melos publish
Melos publishes each package in the correct order, respecting inter-package dependencies.
Running Build Scripts and Tasks
Melos lets you run any CLI command across all or selected packages. For example, run tests everywhere:
melos exec -- sh -c "flutter test"
Or build a common package:
cd packages/network
flutter pub run build_runner build --delete-conflicting-outputs
You can also define these as scripts in melos.yaml for convenience:
scripts:
test:
run: melos exec -- flutter test
gen:
run
Invoke them with melos run test or melos run gen.
Continuous Integration with Melos
Integrate Melos into your CI pipeline to standardize checks:
melos bootstrap
to install dependencies.melos run format -- --set-exit-if-changed
to enforce formatting.melos run analyze
to catch static errors.melos run test
for unit tests.
Sample GitHub Actions step:
- name: Install dependencies
run: dart pub global activate melos
- name: Bootstrap
run: melos bootstrap
- name: Format check
run: melos run format -- --set-exit-if-changed
- name: Analyze
run: melos run analyze
- name: Test
run: melos run test
Vibe Studio

Vibe Studio, powered by Steve’s advanced AI agents, is a revolutionary no-code, conversational platform that empowers users to quickly and efficiently create full-stack Flutter applications integrated seamlessly with Firebase backend services. Ideal for solo founders, startups, and agile engineering teams, Vibe Studio allows users to visually manage and deploy Flutter apps, greatly accelerating the development process. The intuitive conversational interface simplifies complex development tasks, making app creation accessible even for non-coders.
Conclusion
Using a Flutter melos monorepo empowers you to maintain modular, scalable codebases, unify tooling, and streamline publishing. Whether you’re managing a handful of packages or dozens, Melos helps automate repetitive tasks and enforce consistency. Embrace this structure for cleaner code sharing and faster iteration cycles.
Introduction
Managing multiple Flutter packages and applications in a single repository can quickly become complex. A modular monorepo approach helps you share code, enforce consistent tooling, and simplify CI/CD pipelines. Melos is a community tool designed to orchestrate and automate workflows in mono repositories, making it an ideal choice for any Flutter team that wants to scale. In this tutorial, you’ll learn how to build and manage a Flutter melos monorepo with clear package boundaries, shared dependencies, and repeatable tasks.
Setting up Melos in Your Repository
First, install Melos globally:
dart pub global activate melos
Or add it as a dev dependency in a new tool/melos.dart directory. At the root of your repo, create a melos.yaml file:
name: my_flutter_monorepo
packages:
- packages/*
- apps/*
scripts:
bootstrap:
run: melos exec -- flutter pub get
format:
run
This configuration tells Melos to treat every folder under packages/ and apps/ as an individual Dart or Flutter package. You also define custom scripts, like melos bootstrap, that invoke a pub get in every package.
Organizing Packages and Modules
A recommended layout:
core
: Business logic, models, utilities.ui_components
: Reusable widgets and themes.network
: API clients and data sources.app_mobile
&app_web
: Platform-specific apps importing shared packages.
Inside each package’s pubspec.yaml, reference other modules by relative path:
dependencies:
flutter:
sdk: flutter
core:
path: ../packages/core
ui_components:
path
This ensures strong modular boundaries, and Melos will handle linking.
Managing Dependencies and Versioning
Monorepos often share versions across all packages. You can use Melos versioning strategies to bump versions consistently:
scripts:
version:
run: melos version --no-publish --yes
Running melos version prompts you to select semver bumps and updates each pubspec.yaml. After that, run melos bootstrap to sync dependencies. When you’re ready to publish to pub.dev, use:
melos publish
Melos publishes each package in the correct order, respecting inter-package dependencies.
Running Build Scripts and Tasks
Melos lets you run any CLI command across all or selected packages. For example, run tests everywhere:
melos exec -- sh -c "flutter test"
Or build a common package:
cd packages/network
flutter pub run build_runner build --delete-conflicting-outputs
You can also define these as scripts in melos.yaml for convenience:
scripts:
test:
run: melos exec -- flutter test
gen:
run
Invoke them with melos run test or melos run gen.
Continuous Integration with Melos
Integrate Melos into your CI pipeline to standardize checks:
melos bootstrap
to install dependencies.melos run format -- --set-exit-if-changed
to enforce formatting.melos run analyze
to catch static errors.melos run test
for unit tests.
Sample GitHub Actions step:
- name: Install dependencies
run: dart pub global activate melos
- name: Bootstrap
run: melos bootstrap
- name: Format check
run: melos run format -- --set-exit-if-changed
- name: Analyze
run: melos run analyze
- name: Test
run: melos run test
Vibe Studio

Vibe Studio, powered by Steve’s advanced AI agents, is a revolutionary no-code, conversational platform that empowers users to quickly and efficiently create full-stack Flutter applications integrated seamlessly with Firebase backend services. Ideal for solo founders, startups, and agile engineering teams, Vibe Studio allows users to visually manage and deploy Flutter apps, greatly accelerating the development process. The intuitive conversational interface simplifies complex development tasks, making app creation accessible even for non-coders.
Conclusion
Using a Flutter melos monorepo empowers you to maintain modular, scalable codebases, unify tooling, and streamline publishing. Whether you’re managing a handful of packages or dozens, Melos helps automate repetitive tasks and enforce consistency. Embrace this structure for cleaner code sharing and faster iteration cycles.
Power Up Your Flutter Projects
Power Up Your Flutter Projects
Power Up Your Flutter Projects
Power Up Your Flutter Projects
Vibe Studio uses Steve’s AI to streamline your modular Flutter workflows and accelerate your app development. Explore Vibe Studio today!
Vibe Studio uses Steve’s AI to streamline your modular Flutter workflows and accelerate your app development. Explore Vibe Studio today!
Vibe Studio uses Steve’s AI to streamline your modular Flutter workflows and accelerate your app development. Explore Vibe Studio today!
Vibe Studio uses Steve’s AI to streamline your modular Flutter workflows and accelerate your app development. Explore Vibe Studio today!
Join a growing community of builders today
Join a growing
community
of builders today
Join a growing
community
of builders today










© Steve • All Rights Reserved 2025


© Steve • All Rights Reserved 2025


© Steve • All Rights Reserved 2025


© Steve • All Rights Reserved 2025