Registry
Reference for the source layout, build pipeline, distribution endpoints, and installation flow behind the CS registry.
File structure
Source code, examples, and preview-only documentation live under registry/. Generated manifests are not edited manually.
registry/
├── cs/
│ ├── ui/ # Installable UI components
│ ├── utils/ # Installable utility functions and types
│ ├── blocks/ # Installable composite blocks
│ ├── examples/ # Usage snippets and API reference metadata
│ └── previews/ # Documentation-only component previews
├── registry.json # Registry item metadata and dependencies
├── scripts/
│ └── build-registry.mjs
├── public/
│ └── r/ # Generated distributable manifests
└── proxy.ts # Authentication for /r/*.jsonRegistry architecture
The build script inlines every declared source file into an installable manifest. It also creates the metadata-only registry index used by the catalog.
registry/cs/* source files + registry.json
|
| pnpm registry:build
v
public/r/{name}.json manifests
|
| authenticated GET /r/{name}.json
v
shadcn CLI in consumer project
|
v
target files + npm and registry dependencies- registry.json
Defines item metadata, output targets, package dependencies, and inter-item registry dependencies. - build-registry.mjs
Recreatespublic/rfrom the root registry metadata and source files. - proxy.ts
Requires a configured registry token for direct manifest access under/r. - previews
Power the documentation preview only; they are not included in installed component manifests.
API endpoints
Use the static /rendpoints in shadcn registry configuration. Direct requests require either an Authorization: Bearerheader or a tokenquery parameter.
| Method | Endpoint | Purpose |
|---|---|---|
| GET | /r/{name}.json | Installable manifest for one registry item, including inline source files and declared dependencies. |
| GET | /r/registry.json | Metadata-only index of all available registry items. |
| GET | /api/r/{name} | Dynamic application route that reads the generated manifest for one item. |
{
"name": "form-input",
"type": "registry:ui",
"title": "Form Input",
"description": "...",
"dependencies": [],
"registryDependencies": ["@cs/form"],
"files": [
{
"path": "registry/cs/ui/form-input.tsx",
"target": "components/cs/form-input.tsx",
"type": "registry:ui",
"content": "..."
}
]
}How it works
Registry consumers configure the @csnamespace once, then install items by name. The shadcn CLI resolves registry dependencies recursively and writes each file to its declared target.
- 1. Define an item
Add source files, output targets, and dependency metadata to
registry.json. - 2. Generate manifests
Run
pnpm registry:buildto recreate the public distribution files. - 3. Request an item
The CLI retrieves its manifest through the configured authenticated
/rURL. - 4. Install targets and dependencies
shadcn writes each target file, installs package dependencies, and resolves registry dependencies such as
@cs/form.
pnpm dlx shadcn@latest add @cs/form-input