tdpxl

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

  1. The catalogues — lib/components.ts, lib/hooks.ts, lib/charts.ts and lib/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.
  2. scripts/build-registry.ts — reads each item's source files, works out their dependencies from their imports, inlines the source, and writes public/r/<name>.json and public/r/registry.json.
  3. public/r/ — the output, served as it is.
pnpm registry:build

Dependencies 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:

ImportBecomes
@/registry/ui/<name>, @/registry/hooks/<name>, @/registry/charts/<name>registryDependencies: ["<name>"]
@/lib/utilsregistryDependencies: ["utils"]
A package, such as radix-ui or lucide-reactdependencies (React, React DOM and Next.js are never listed)
Any other @/… pathA 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

TypeSourceInstalled as
registry:uiregistry/ui/<name>.tsxcomponents/ui/<name>.tsx
registry:hookregistry/hooks/<name>.tshooks/<name>.ts
registry:blockregistry/charts/<name>.tsxcomponents/<name>.tsx
registry:blockregistry/blocks/<name>/**app/<route>/page.tsx plus its components beside it
registry:libregistry/lib/utils.ts (utils)lib/utils.ts
registry:themelib/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:…"
    }
  ]
}
FieldMeaning
nameLowercase, hyphenated; what you pass to add
typeOne of the item types above
versionSemver of the item; see Versions
title, description, categoriesCatalogue data shown by list and the site
dependencies, devDependenciesnpm packages the source imports
registryDependenciesBare 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)
cssVarsOnly on theme: light and dark role values, and theme radius/shadow tokens
cssOnly on theme: imports, base styles and @utility rules
cssHashOnly 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/r

Describe 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:

  1. Change lib/tokens.ts for colors, and registry/ for components. Add new items to the catalogue in lib/ and give each component a demo.

  2. Build, with the public URL the registry will live at:

    REGISTRY_HOMEPAGE=https://registry.example.com pnpm registry:build

    REGISTRY_HOMEPAGE is used for the $schema and homepage fields.

  3. Deploy public/r/ to any static host so that https://registry.example.com/r/button.json resolves.

  4. 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 init

    or by editing registry in an existing tdpxl.json.

Before deploying, install from the built folder directly:

npx @tdpxl/cli add button --registry /path/to/your-fork/public/r --dry-run

On this page