Skip to main content
A registry is a collection of blocks that can be installed into any Mercur project using the CLI. The official Mercur registry (@mercurjs) provides all the built-in marketplace blocks. You can also create and host your own.

How it works

A registry is a set of JSON files — one per block — served over HTTP. When you run bunx @mercurjs/cli@latest add, the CLI fetches the block’s JSON, resolves its dependencies, and copies the source files into your project.

registry.json

The registry.json file defines your registry and all its blocks:
registry.json

Block properties

File types

Each file in a block has a type that determines where it gets placed in the target project: These map to the aliases defined in the consumer’s blocks.json.

Building

Build your registry into distributable JSON files:
This reads registry.json, resolves all imports for each block, embeds the file contents, and outputs one JSON file per block to the r/ directory. The build step also automatically resolves NPM dependencies from your source imports — you don’t need to list every transitive dependency manually.

Hosting

Serve the built r/ directory over HTTP. Any static hosting works — GitHub Pages, Vercel, Netlify, S3, or your own server. The only requirement is that {name}.json files are accessible at a public URL.

Using custom registries

Add your registry to blocks.json in any Mercur project:
blocks.json
Use {name} as a placeholder for block names. Then install blocks from it:

Authentication

For private registries, you can use headers with environment variables:
blocks.json

Dependencies between blocks

Blocks can depend on other blocks using registryDependencies. When a user installs your block, the CLI automatically resolves and installs all dependencies in the correct order.