nook
Browse the docs

Registry

A registry is a folder of JSON files. Each file describes one item that the CLI can install. Nook's own registry is served from /r/<name>.json, for example /r/button.json, with an index.

An item

{
  "name": "button",
  "type": "registry:ui",
  "description": "Triggers an action.",
  "dependencies": ["class-variance-authority@^0.7.1"],
  "registryDependencies": ["utils"],
  "files": [
    { "path": "ui/button.tsx", "type": "registry:ui", "content": "..." }
  ],
  "cssVars": { "theme": { "radius": "0.75rem" }, "light": {}, "dark": {} }
}
FieldMeaning
nameLowercase words joined by dashes
typeregistry:ui, registry:lib, registry:icons, registry:icon, registry:theme, registry:base, registry:block, registry:template
dependenciesnpm packages, with an optional version range
registryDependenciesOther items: a name, @namespace/name or a URL
filesPath, type and content. target overrides where a file lands
cssVarsVariables for theme (:root), light and dark

The format is described by a JSON Schema. Nook validates its own registry against it on every build.

Build your own

Publish JSON files anywhere that serves static files. People use it with a namespace in nook.json:

{ "registries": { "@acme": "https://acme.dev/r/{name}.json" } }
nook add @acme/pricing-table

Private and paid registries

Items never contain credentials. Authentication belongs to the request, so a private or paid registry uses the same item format as a free one. Add headers to the namespace, and reference environment variables so tokens stay out of your repository:

{
  "registries": {
    "@pro": {
      "url": "https://pro.example.com/r/{name}.json",
      "headers": { "Authorization": "Bearer ${PRO_TOKEN}" }
    }
  }
}

Safety

The CLI treats every registry as untrusted. It rejects absolute paths, .. segments, unknown file types, unsafe package names and CSS values that could break out of a rule. It also refuses plain http:// URLs except for localhost.