registry.json
Theregistry.json file is only required if you’re using the shadcn-svelte CLI to build your registry.
If you’re using a different build system, you can skip this step as long as your build system produces valid JSON files that conform to the registry-item schema specification.
Add a registry item
Build your registry
Serve your registry
You can serve your registry by running the dev server.http://localhost:5173/r/[NAME].json eg. http://localhost:5173/r/hello-world.json.
Publish your registry
To make your registry available to other developers, you can publish it by deploying your project to a public URL.Adding Auth
Theshadcn-svelte CLI does not offer a built-in way to add auth to your registry. We recommend handling authorization on your registry server.
A common simple approach is to use a token query parameter to authenticate requests to your registry. e.g. http://localhost:5173/r/hello-world.json?token=[SECURE_TOKEN_HERE].
Use the secure token to authenticate requests and return a 401 Unauthorized response if the token is invalid. The shadcn-svelte CLI will handle the 401 response and display a message to the user.
Note: Make sure to encrypt and expire tokens.
Guidelines
Here are some guidelines to follow when building components for a registry.- The following properties are required for the block definition:
name,description,typeandfiles. - Make sure to list all registry dependencies in
registryDependencies. A registry dependency is the name of the component in the registry eg.input,button,card, etc or a URL to a registry item eg.http://localhost:5173/r/editor.json - Ideally, place your files within a registry item in
components,hooks,libdirectories.
Install using the CLI
To install a registry item using theshadcn-svelte CLI, use the add command followed by the URL of the registry item.