This guide documents how the shadcn-templ registry works: the registry.json catalog, the endpoints the server exposes, and how to test a registry with the CLI. If you serve the same JSON shapes from your own server, the shadcn-templ CLI can install from it.
Note: shadcn-templ has no pendant of the shadcn build command or include composition. The registry is a single flat registry.json, served verbatim, and the item endpoints are built from it at request time.
Requirements
You are free to serve your registry as you see fit. The only requirement is that your registry catalog and registry items must conform to the registry schema specification and registry-item schema specification.
Your registry can be any server, as long as it supports serving JSON over HTTP.
registry.json
The registry.json is the entry point for the registry. It contains the registry’s name, homepage, and defines all the items present in the registry.
It is served verbatim at /r/registry.json. The CLI fetches it to resolve --all and to list component names.
Here’s an excerpt of the shadcn-templ registry.json file:
This registry.json file must conform to the registry schema specification.
Serve your registry
The registry is served from these endpoints:
The {style} segment is shadcn-templ’s base prefixed onto a style name: base-vega, base-nova, base-maia, base-lyra, base-mira, base-luma, base-sera, base-rhea.
Test your registry
After your registry is being served, test it with the same CLI commands that other developers will use.
Using --registry
Point the CLI at the registry base URL. The SHADCN_TEMPL_REGISTRY environment variable works the same way, below the flag.
Initialize a project
Add an item
To test the install flow, run add from a project where you want to install the item.
Apply a preset
Using URL
Item URLs work directly, bypassing the configured style resolution.
Guidelines
Here are some guidelines to follow when adding items to a registry.
- The item
nameis kebab-case and must be unique for your registry. In the shadcn-templ registry it doubles as the docs slug. - It is recommended to add a proper
titleanddescriptionto your registry item. This helps LLMs understand the component and its purpose. - Make sure to list all registry dependencies in
registryDependencies. A registry dependency is an item name such asbutton, or the URL of a registry item. - For every file, specify the
pathandtypeof the file. The install path is derived frompathand the consumer’scomponents.jsonaliases.