Learn how to run, customize, publish, and consume this shadcn registry docs kit.
This project is a complete starting point for publishing a shadcn-compatible registry with documentation. It gives you a Next.js and Fumadocs site, generated registry JSON routes, install commands, component previews, source-code views, and a content structure that can grow with your design system.
Use it in two ways:
/r/*.json endpoints with the shadcn CLI.Install dependencies from the repository root:
bun installRun the docs app:
bun run devThe docs app runs on port 4000 by default. Open:
http://localhost:4000Build the app before publishing:
bun run buildMost day-to-day work happens in apps/docs.
apps/docs
├── content/docs # MDX documentation pages
├── registry.json # Generated registry output
├── registry/__index__.tsx # Generated preview/source index
├── src/app # Next.js routes
├── src/components # Docs-site components
├── src/lib # Registry helpers and site config
└── src/registry/new-york-v4 # Source files published by the registryThe important split is:
content/docs explains each item to humans.src/registry defines what the shadcn CLI can install.registry.json and registry/__index__.tsx are generated output.Every documented item has a matching install command. The command points at a JSON endpoint under /r.
npx shadcn@latest add https://components.sudarshandhakal.com.np/r/button.jsonFor local development, use your local server URL:
npx shadcn@latest add http://localhost:4000/r/button.jsonThe command downloads the registry item, follows its registry dependencies, and writes the target files into the consuming app.
This template is organized around common registry item types:
registry:style for shared style payloads.registry:ui for reusable UI primitives like Button, Card, and Badge.registry:component for composed app components.registry:block for larger page sections.registry:hook for React hooks.registry:lib for utility functions.registry:page for full page templates.registry:file for standalone config or support files.registry:font for font metadata.Each type has its own docs section and route, so users can browse by the shape of the thing they want to install.
Create the component source file under:
apps/docs/src/registry/new-york-v4/uiThen register it in apps/docs/src/registry/registry-ui.ts:
{
name: "alert",
type: "registry:ui",
dependencies: ["class-variance-authority"],
files: [
{
path: "ui/alert.tsx",
type: "registry:ui",
},
],
}Add a matching docs page:
apps/docs/content/docs/ui/alert.mdxA typical docs page includes:
title and description.Use registry:component when an item is built from smaller UI pieces.
Put source files in:
apps/docs/src/registry/new-york-v4/componentsRegister dependencies by registry item name:
{
name: "project-card",
type: "registry:component",
registryDependencies: ["card", "badge", "button"],
files: [
{
path: "components/project-card.tsx",
type: "registry:component",
},
],
}Registry dependencies let shadcn install the required local building blocks automatically.
Use the matching registry file for each category:
src/registry/registry-hooks.ts
src/registry/registry-libs.ts
src/registry/registry-files.ts
src/registry/registry-fonts.ts
src/registry/registry-blocks.ts
src/registry/registry-pages.tsUse matching docs folders:
content/docs/hooks
content/docs/lib
content/docs/files
content/docs/fonts
content/docs/blocks
content/docs/pagesKeep the registry item name and MDX file name aligned. For example, use-mobile should have an install route at /r/use-mobile.json and a docs page at /docs/hooks/use-mobile.
Use this structure for installable items:
---
title: Item Name
description: A short sentence explaining what the item does.
---
## Installation
<CodeTabs>
<TabsList>
<TabsTrigger value="cli">Command</TabsTrigger>
<TabsTrigger value="manual">Manual</TabsTrigger>
</TabsList>
<TabsContent value="cli">
<CodeBlockCommand command="npx shadcn@latest add https://components.sudarshandhakal.com.np/r/item-name.json" />
</TabsContent>
<TabsContent value="manual">
<Steps className="mb-0 pt-2">
<Step>Install the required dependencies.</Step>
<CodeBlockCommand command="npm install package-name" />
<Step>Copy and paste the following code into your project.</Step>
<ComponentSource name="item-name" title="components/item-name.tsx" />
<Step>Update the import paths to match your project setup.</Step>
</Steps>
</TabsContent>
</CodeTabs>
## Usage
```tsx
import { ItemName } from "@/components/item-name"
The docs app provides reusable MDX components such as `CodeTabs`, `CodeBlockCommand`, `ComponentPreview`, `ComponentSource`, `RegistrySource`, `Steps`, `Step`, and `ApiRefTable`.
## Rebuild Registry Output
Whenever you edit registry definitions or registry source files, regenerate the registry output:
```bash
bun run --cwd apps/docs registry:buildThe build script updates:
apps/docs/registry.json
apps/docs/registry/__index__.tsxThe full production build also runs this step:
bun run --cwd apps/docs buildEdit apps/docs/src/lib/config.ts to update the site name, description, public URL, GitHub link, and top navigation.
The top navigation is generated from registered registry item types, so adding a new type to the registry can automatically make its docs section visible when that type has a route mapping.
This app is configured for static export. After building, deploy the generated output with any static host that supports Next.js export output.
Before deploying, update these values to your real production URL:
apps/docs/src/lib/config.tsapps/docs/src/registry/index.tscontent/docsOnce deployed, users can install from your production registry endpoints:
npx shadcn@latest add https://your-site.com/r/button.jsonIf a docs page does not show up, run:
bun run --cwd apps/docs types:checkThis regenerates the Fumadocs source and checks TypeScript.
If an install command returns old data, rebuild the registry:
bun run --cwd apps/docs registry:buildIf a manual source block is empty, confirm the item exists in src/registry and that the registered files path points to a real file under src/registry/new-york-v4.
If imports look wrong after installation, check the rewrite logic in apps/docs/src/lib/registry.ts and the target values in the registry item files.