@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 runbunx @mercurjs/cli@latest add, the CLI fetches the block’s JSON, resolves its dependencies, and copies the source files into your project.
registry.json
Theregistry.json file defines your registry and all its blocks:
registry.json
Block properties
File types
Each file in a block has atype 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: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 builtr/ 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 toblocks.json in any Mercur project:
blocks.json
{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 usingregistryDependencies. When a user installs your block, the CLI automatically resolves and installs all dependencies in the correct order.