Capítulo 105 de 108

Registry Directory

Core Idea

An opt-in, official directory of open-source registries; being listed lets users add your namespace (@acme) by name instead of pasting a full URL template. Not required to use owner/repo/item GitHub addressing.

Key Concepts

  • Registry index: List of registries the CLI auto-checks when running shadcn add/shadcn search, adding matches to components.json automatically. Full list at https://ui.shadcn.com/r/registries.json.
  • Flat registry requirement: Submitted registries must be flat (no nested items) — /registry.json and /component-name.json files live at the registry root.
  • No content in files: For directory submission, the files array (if present) must NOT include a content property (content is fetched separately).

Code Examples

{
  "$schema": "https://ui.shadcn.com/schema/registry.json",
  "name": "acme",
  "homepage": "https://acme.com",
  "items": [
    { "name": "login-form", "type": "registry:component", "title": "Login Form", "description": "A login form component.", "files": [{ "path": "registry/new-york/auth/login-form.tsx", "type": "registry:component" }] }
  ]
}
  • O que demonstra: formato válido pra submissão ao índice, flat e sem content inline.

Reference Tables

RequirementDetail
Open sourcemust be publicly accessible
Valid schemaconforms to registry-json spec
Flat structureno nested item files
No content in filescontent fetched separately

Anti-patterns

  • Submitting a nested/include-based registry directly: the directory requires flat structure; resolve/flatten via shadcn build before submission if needed.
  • Assuming directory listing is required for GitHub addressing: owner/repo/item addresses work without any submission — the directory is only for @namespace shortcuts.

Key Takeaways

  1. Submission process: add entry to apps/v4/registry/directory.json in the shadcn-ui/ui repo → run pnpm validate:registries → open a PR.
  2. Listing is purely for UX convenience (@acme instead of full URL); it changes nothing about how the registry itself must be built.

Connects To

  • registry-namespace (ch104): namespaces work identically whether listed in the index or configured manually.
  • registry-json (ch107): schema the submitted registry must satisfy.