How to Use Hako with Monorepos
Configure hako to detect and run multiple workspace services in isolation.
This guide shows how to use hako with monorepos to manage multiple workspace services in isolated environments.
Assumptions
- Project is a monorepo using workspaces (pnpm, yarn, npm, or bun).
- Workspace packages contain development scripts.
Steps
-
Prepare the root package.json Ensure the root
package.jsondoes not have adevorstartscript. This triggers hako's monorepo fallback detection. -
Configure workspace packages Ensure each workspace package you want hako to manage has a
scripts.devorscripts.startentry. -
Initialize the environment Run the following command to create a new worktree. Hako auto-detects the workspaces and generates a multi-service
hako.yml.hako new feature-branch --start -
Verify detected services Check that all intended services are running and healthy.
hako status feature-branch -
View per-service logs Inspect the output of a specific workspace service.
hako logs feature-branch web
Port allocation
Each detected service is assigned its own unique port variable based on the package name (e.g., PORT_WEB, PORT_API).
Manual adjustments
If auto-detection includes unwanted packages or misses services, edit the generated hako.yml to add or remove entries from the services section.
Fallback detection
If you are using Lerna without native package manager workspaces, hako reads the packages field in lerna.json as a fallback.
See also
- Auto-detection Reference for full detection rules and supported package managers.
How to Set Up Bare Process Mode
Configure hako to manage development processes directly without Docker.
How to Configure Lifecycle Hooks
Automate tasks at lifecycle events with hako hooks.
ops.origin: Masakiro Corp.