Registry
A registry is any HTTP endpoint that serves schema-valid JSON - a Next.js public/r folder, a static host, or your own API. The Cubix docs site itself ships the official catalog from public/r.
- Catalog -
registry.jsonlists every item. - Items - one JSON file per component, for example
button.json. - CLI -
cubix-ui add,view,search, andbuildspeak this format.
Catalog schema
The catalog is the registry entry point. Cubix uses https://cubixflow.ir/schema/registry.json:
{
"$schema": "https://cubixflow.ir/schema/registry.json",
"name": "cubix",
"homepage": "https://cubixflow.ir",
"items": [
{
"name": "button",
"type": "registry:ui",
"title": "Button",
"description": "Displays a button or a component that looks like a button.",
"dependencies": ["@base-ui/react"],
"registryDependencies": [],
"files": [
{
"path": "components/cubix/button.tsx",
"type": "registry:ui"
}
]
}
]
}Required fields: name and items. Each catalog entry summarizes one item; the CLI fetches the full item, source included, from /r/[name].json.
Item schema
Each component is a registry item. Schema: https://cubixflow.ir/schema/registry-item.json.
{
"$schema": "https://cubixflow.ir/schema/registry-item.json",
"name": "button",
"type": "registry:ui",
"title": "Button",
"description": "Displays a button or a component that looks like a button.",
"dependencies": ["@base-ui/react"],
"registryDependencies": [],
"files": [
{
"path": "components/cubix/button.tsx",
"type": "registry:ui",
"target": "components/cubix/button.tsx"
}
]
}| Field | Required | Description |
|---|---|---|
| name | Yes | Stable id used by the CLI (button, prompt-input). |
| type | Yes | Item kind, usually registry:ui for Cubix components. |
| title | No | Human-readable label shown in docs and search. |
| description | No | Short summary for humans and AI assistants. |
| dependencies | No | npm packages to install (for example @base-ui/react). |
| registryDependencies | No | Other registry items that must be installed first. |
| files | Yes | Source files with path, type, and optional target. |
When an item needs other Cubix pieces and npm packages, list both:
{
"$schema": "https://cubixflow.ir/schema/registry-item.json",
"name": "calendar",
"type": "registry:ui",
"title": "Calendar",
"description": "A date picker calendar for selecting a day, several days, or a range.",
"dependencies": ["date-fns", "react-day-picker"],
"registryDependencies": ["button"],
"files": [
{
"path": "components/cubix/calendar.tsx",
"type": "registry:ui",
"target": "components/cubix/calendar.tsx"
}
]
}Item types
Cubix primarily ships registry:ui items. The schema also supports related kinds for larger catalogs:
| Type | Description |
|---|---|
| registry:ui | Reusable UI primitives under components/cubix. |
| registry:component | Composed components that are not core primitives. |
| registry:block | Larger page or section templates (chat shells, 404s). |
| registry:hook | Shared React hooks. |
| registry:lib | Utilities and helpers (for example path aliases under lib). |
| registry:style | CSS tokens or style fragments for the design system. |
Build and serve
Author a source registry.json, then generate static files with the CLI. Output defaults to public/r:
pnpm dlx cubix-ui@latest buildOn Next.js, those files are served as /r/button.json, /r/registry.json, and so on. Any host that serves static JSON works the same way. Full build flags are on the CLI page.
Consume a registry
After Installation, add components by name from the configured Cubix registry:
pnpm dlx cubix-ui@latest add buttonOr pass a full item URL:
pnpm dlx cubix-ui@latest add https://cubixflow.ir/r/button.jsonInspect before install:
pnpm dlx cubix-ui@latest view buttonpnpm dlx cubix-ui@latest search -q "dialog"Namespaces
Map a short namespace to a URL template in cubix.json. {name} is replaced with the item id:
{
"registries": {
"@cubix": "https://cubixflow.ir/r/{name}.json"
}
}Custom registries work the same way:
{
"registries": {
"@acme": "https://acme.com/r/{name}.json"
}
}pnpm dlx cubix-ui@latest add @acme/buttonPublish your own
To distribute internal components with the same CLI flow:
- Keep source under paths your consumers expect (Cubix uses
components/cubix). - Define a root catalog that conforms to the Cubix registry schema:
{
"$schema": "https://cubixflow.ir/schema/registry.json",
"name": "acme",
"homepage": "https://acme.com",
"items": [
{
"name": "button",
"type": "registry:ui",
"title": "Button",
"description": "A simple button component.",
"files": [
{
"path": "components/cubix/button.tsx",
"type": "registry:ui"
}
]
}
]
}- Run
cubix-ui buildand deploy the output directory. - Share the namespace URL template so teams can
cubix-ui add @acme/button.
Authoring guidelines
- Give every item a clear
titleanddescription- humans and Skills both rely on them. - List all npm packages in
dependenciesand all Cubix peers inregistryDependencies. - Set
files[].targetto the path consumers should receive afteradd. - Keep the visual API aligned across Base UI, React Aria, and Radix when you publish base variants.
- Prefer Cubix tokens only - never ship hardcoded brand colors in registry source.
- Update the catalog whenever you add or rename an item so
searchstays accurate.