A Flutter monorepo with Melos
pub publish and version bumps. Melos manages this Dart/Flutter monorepo: one repo, many packages, commands that run across all of them at once.
Splitting into packages
packages/ ) and declare them at the root. Each keeps its own pubspec.yaml ; the app references the others as path dependencies , and Melos links everything locally:
feature_auth depends on core_api , never the other way around. The dependency graph is explicit, verifiable, and breaks the build the moment you violate it.
The melos.yaml file
melos exec runs a command in each package; filters like --dir-exists=test or --diff target a subset — for example only the packages changed since the main branch, which speeds CI up considerably.
Bootstrap and linking
melos bootstrap (or melos bs ) is the key command: it installs the dependencies of every package and resolves the path dependencies between them. No more manual flutter pub get package by package, no more drifting versions. You run it after every git clone and after any pubspec.yaml change. The Melos documentation describes every filter and hook.
Versioning and CI
melos version reads the history, computes the bump for each touched package, updates the CHANGELOG.md files, and propagates the new versions to dependent packages. A fix: in core_api bumps core_api and everything that depends on it, consistently.
- ›
melos bootstrap→ install and link everything - ›
melos run analyze→ static analysis everywhere - ›
melos run test→ tests across the whole graph - ›
melos version→ bumps + changelogs from commits
bootstrap , then analyze , then test — often restricted to the changed packages via --diff=origin/main so you don't replay the whole graph on every push.
A monorepo isn't just a tidy folder layout: it's the promise that a cross-cutting change stays one commit, one build, one review . Melos keeps that promise for Flutter.