Registry
How items are built from source, what an item contains, and how to host your own registry.
A tdpxl registry is a folder of static JSON files: one document per item plus a
registry.json index. The CLI fetches them over HTTP or reads them from disk.
There is no server logic, so any static host works.
From source to JSON
- The catalogues —
lib/components.ts,lib/hooks.ts,lib/charts.tsandlib/blocks.ts. A name, title and description for every item, a group or category, and for blocks the route the page lands on. No dependency lists. scripts/build-registry.ts— reads each item's source files, works out their dependencies from their imports, inlines the source, and writespublic/r/<name>.jsonandpublic/r/registry.json.public/r/— the output, served as it is.
pnpm registry:buildDependencies are derived from imports
Nobody writes a dependency list by hand. The build reads every import,
export … from, side-effect import and dynamic import() in the file:
| Import | Becomes |
|---|---|
@/registry/ui/<name>, @/registry/hooks/<name>, @/registry/charts/<name> | registryDependencies: ["<name>"] |
@/lib/utils | registryDependencies: ["utils"] |
A package, such as radix-ui or lucide-react | dependencies (React, React DOM and Next.js are never listed) |
Any other @/… path | A build error: the installed file would not compile |
Every component also depends on theme, because every component reads the
role scale. The build fails if an item depends on a name that is not in the
registry, so a broken graph never reaches the machine of whoever installs it.
A hand-kept list goes stale the first time someone adds an import, and the failure then shows up as a missing module in someone else's project. Deriving it means the list cannot disagree with the code.
Item types
| Type | Source | Installed as |
|---|---|---|
registry:ui | registry/ui/<name>.tsx | components/ui/<name>.tsx |
registry:hook | registry/hooks/<name>.ts | hooks/<name>.ts |
registry:block | registry/charts/<name>.tsx | components/<name>.tsx |
registry:block | registry/blocks/<name>/** | app/<route>/page.tsx plus its components beside it |
registry:lib | registry/lib/utils.ts (utils) | lib/utils.ts |
registry:theme | lib/tokens.ts, lib/styles.ts (theme) | A managed section of your stylesheet |
Inside a block, the page has the file type registry:page and the other files
registry:component; each carries a target under app/<route>/ that keeps
their relative positions. Destinations are the defaults; the aliases in
tdpxl.json decide the real folders. See CLI.
What an item looks like
tdpxl items follow tdpxl's own item schema, referenced by $schema and served
next to the registry under /schema/.
{
"$schema": ".../schema/registry-item.json",
"name": "combobox",
"type": "registry:ui",
"version": "0.1.0",
"title": "Combobox",
"description": "A searchable select, composed from Popover and Command.",
"categories": ["forms"],
"dependencies": ["cmdk", "lucide-react"],
"registryDependencies": ["button", "command", "popover", "theme", "utils"],
"files": [
{
"path": "registry/ui/combobox.tsx",
"type": "registry:ui",
"content": "\"use client\"\n\nimport ...",
"hash": "sha256:…"
}
]
}| Field | Meaning |
|---|---|
name | Lowercase, hyphenated; what you pass to add |
type | One of the item types above |
version | Semver of the item; see Versions |
title, description, categories | Catalogue data shown by list and the site |
dependencies, devDependencies | npm packages the source imports |
registryDependencies | Bare names of other items in the same registry |
files[] | path in the registry, file type, optional target, the full content, and hash (sha256 of content) |
cssVars | Only on theme: light and dark role values, and theme radius/shadow tokens |
css | Only on theme: imports, base styles and @utility rules |
cssHash | Only on theme: sha256 of JSON.stringify({ cssVars, css }) |
registryDependencies are bare names because they always mean "the item with
this name in the registry you are installing from". The same JSON works on a
production host, a staging host or a local folder without being rebuilt.
registry.json lists every item with the same fields minus file contents and
CSS, and is what npx @tdpxl/cli list reads.
The theme item
theme carries no files, only variables and CSS, generated from lib/tokens.ts
and lib/styles.ts at build time. That keeps the scale a consumer installs
identical to the one the site and Storybook render. See
Installation for what it writes.
Versions
governance/registry-versions.json is the source of truth: for each item, its
version and the fingerprint (hash of the published item) that version stands
for. The build copies the version into every item and adds the content hashes;
it warns when an item changed since its recorded version. Versions only move
with a local command, which publishes nothing:
pnpm release:version --dry-run # print the plan
pnpm release:version # bump, write changelogs, rebuild public/rDescribe changes with a changeset file in .changeset/ (any name, .md):
---
button: minor
---
Button gains a `loading` state.The script applies the largest bump declared per item, gives a patch bump to
any item whose content changed without a changeset (so one version never stands
for two contents), starts new items at 0.1.0, appends an entry to
governance/changelog/<item>.md and deletes the consumed changesets. Commit the
result together with public/r.
Consumers compare per-file hashes as well as versions, so tdpxl diff also sees
content published between two releases. Only the current version of each item
is served; tdpxl update merges against the copy of the installed version that
the consumer keeps in .tdpxl/base/, not against old registry documents.
Hosting your own registry
To publish a modified tdpxl — your brand, your components — fork the repository and build it yourself:
-
Change
lib/tokens.tsfor colors, andregistry/for components. Add new items to the catalogue inlib/and give each component a demo. -
Build, with the public URL the registry will live at:
REGISTRY_HOMEPAGE=https://registry.example.com pnpm registry:buildREGISTRY_HOMEPAGEis used for the$schemaandhomepagefields. -
Deploy
public/r/to any static host so thathttps://registry.example.com/r/button.jsonresolves. -
Point projects at it, either per project or from the start:
npx @tdpxl/cli init --registry https://registry.example.com/r TDPXL_REGISTRY=https://registry.example.com/r npx @tdpxl/cli initor by editing
registryin an existingtdpxl.json.
Before deploying, install from the built folder directly:
npx @tdpxl/cli add button --registry /path/to/your-fork/public/r --dry-run