Workspaces and Monorepos in Package Managers

https://news.ycombinator.com/rss Hits: 4
Summary

I’ve never needed workspaces. Never used a monorepo either. I’ve also never worked in a massive team. The projects I work on are small enough that a single package per repo works fine, and when I need to coordinate changes across packages, publishing isn’t that painful. But every major package manager now has workspaces or something like them. In JavaScript: Yarn, npm, pnpm, Bun. In other ecosystems: Cargo (Rust), uv (Python), go.work (Go), Composer (PHP), pub (Dart), Mix (Elixir). Even Bundler and NuGet have workarounds. When every ecosystem independently arrives at the same shape, something structural is going on. So I wanted to understand why. The basic problem: you have two packages in your repo, and one depends on the other. Without workspaces, you’d have to publish the dependency every time you change it, or manually symlink it and deal with links that persist invisibly across your system, break in subtle ways, and behave differently than published packages. Workspaces let the package manager wire up local dependencies automatically during install. You edit one package, the other sees the changes immediately. When you publish, normal version resolution takes over. Common use cases People often associate workspaces with monorepos, but you don’t need a massive codebase to benefit. Common cases: A library and its plugins An app with local utilities that won’t be published separately A package tested against an example app Cloning a dependency locally to debug an issue Workspaces solve “these packages are developed together.” Monorepos solve “all our code lives in one place.” They overlap but aren’t the same thing. Coordinating changes across multiple repos is painful (separate PRs, separate CI, separate release schedules), which is why monorepos became attractive. Workspaces make monorepos practical by handling the dependency wiring. How they work in practice npm (v7+) uses a workspaces field in the root package.json: { "workspaces": ["packages/*"] } Running npm ...

First seen: 2026-01-24 01:49

Last seen: 2026-01-24 04:50