Skip to main content
Catalogs share dependency versions across the packages in a monorepo. Rather than repeating the same versions in each workspace package, you define them once in the root package.json and reference them throughout your project.

Overview

Instead of each workspace package specifying its own versions, you:
  1. Define version catalogs in the root package.json
  2. Reference those versions with the catalog: protocol
  3. Update every package at once by changing the version in one place
This matters most in large monorepos where dozens of packages depend on the same versions of key dependencies.

How to Use Catalogs

Directory Structure Example

Consider a monorepo with the following structure:

1. Define Catalogs in Root package.json

In your root-level package.json, add a catalog or catalogs field within the workspaces object:
package.json
catalog and catalogs also work at the top level of package.json.

2. Reference Catalog Versions in Workspace Packages

In your workspace packages, use the catalog: protocol to reference versions:
packages/app/package.json
packages/ui/package.json
catalog: references work in dependencies, devDependencies, optionalDependencies, peerDependencies, and as the value of a root overrides rule. A catalog reference behaves exactly as if the catalog’s range were written inline.

3. Run Bun Install

Run bun install to install all dependencies according to the catalog versions.

Catalog vs Catalogs

Bun supports two ways to define catalogs:
  1. catalog (singular): A single default catalog for commonly used dependencies
    package.json
    Reference with catalog::
    packages/app/package.json
  2. catalogs (plural): Multiple named catalogs for grouping dependencies
    package.json
    Reference with catalog:<name>:
    packages/app/package.json

Benefits of Using Catalogs

  • Consistency: All packages use the same version of critical dependencies
  • Maintenance: Update a dependency version in one place instead of across multiple package.json files
  • Clarity: Makes it obvious which dependencies are standardized across your monorepo
  • Simplicity: No extra version resolution strategies or external tools

Real-World Example

A larger example, for a React application: Root package.json
package.json
packages/app/package.json
packages/ui/package.json
packages/utils/package.json

Updating Versions

To update versions across all packages, change the version in the root package.json:
package.json
Then run bun install to update all packages.

Adding to the catalog with bun add

bun add --catalog (or --catalog=<name>) adds the entry to the root catalog and writes "catalog:" to the current package. An existing catalog entry is reused unless you pass an explicit version. See bun add --catalog.
terminal
Even without the flag, bun add react (no version) writes "catalog:" when the default catalog already lists react. Pass a version to write a concrete range instead.

Lockfile Integration

Bun’s lockfile tracks catalog versions, so installs are consistent across environments. The lockfile includes:
  • The catalog definitions from your package.json
  • The resolution of each cataloged dependency
bun.lock(excerpt)

Limitations and Edge Cases

  • Catalog references must match a dependency defined in either catalog or one of the named catalogs
  • Empty strings and whitespace in catalog names are ignored (treated as default catalog)
  • catalog:default is the same as catalog:. The default catalog can be defined as either catalog or catalogs.default, but a package listed in both is an error
  • Invalid dependency versions in catalogs fail to resolve during bun install
  • catalog: only works in the root and workspace package.json files. Inside a published package it fails to resolve — publish with bun publish or bun pm pack, which replace it with the real range (see Publishing)

Publishing

When you run bun publish or bun pm pack, Bun replaces catalog: references in your package.json with the resolved version numbers. The published package includes regular semver strings and no longer depends on your catalog definitions.