npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

shadreg

v0.0.75

Published

build registry files for your UI library with shadcn

Readme

shadreg

A CLI tool for generating a ShadCN component registry JSON for your UI library.

Commands

init

The init command initializes the necessary dependencies for your project and generates a configuration file.

npx shadreg init

You will be prompted with a series of questions to configure your project.

Example interaction:

✔ A shadreg.config.ts file already exists. Overwrite it? Yes
✔ Enter the output directory: ./shadreg
✔ Enter the base url of your components: ./src/components
✔ Do you want to include registry example? Yes

Config File Template

// shadreg.config.ts

import { shadregConfig } from "shadreg"

export default shadregConfig({
  baseUrl: "./src/components", // Path to your component files
  outputDir: "./shadreg", // Output directory for the registry files
  registries: [
    {
      name: "cool-text", // Component name
      type: "registry:ui", // Type of registry (e.g., UI component)
      registryDependencies: ["button"], // Components your component depends on
      dependencies: [], // Regular dependencies
      devDependencies: [], // Dev dependencies
      tailwind: {
        config: {}, // Tailwind config if necessary
      },
      cssVars: {}, // CSS variables for your component
      files: ["cool-text.tsx"], // Files associated with the component
    },
  ],
})

// your "cool-text" component should located at ./src/components/cool-text.tsx

Properties

| Property | Type | Description | Default | | ---------- | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------ | | baseUrl | string | The base url of your components | ./src/components | | outputDir | string | Where the registry json files and _generated.json will be saved | ./shadreg | | registries | Registry | A list of registry entries. See Shadcn Registry Schema for more details. | |

build

The build command generates the registry JSON files in the specified output directory.

npx shadcn build

This will generate the registry JSON files and a _generated.json in the outputDir you set.

_generated.json Structure

| Property | Type | Description | | -------- | --------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | name | string | The name of the component | | url | string? | The url of the component after publishing to Vercel Blob Store. | | entry | RegistryEntry | The registry entry for the component. See Shadcn Registry Schema for more details. |

A allRegistries object is exported from index.mjs and index.d.ts files, which can be imported into your Next.js project, used in API endpoints, etc.

So that you can make your component public with API endpoint and Shadcn CLI.

Example for Next.js Integration

  1. Update path alias in tsconfig.json or jsconfig.json :
"paths": {
  "@/*": ["./src/*"],
  "@/shadreg": ["./shadreg/index.mjs"] // <-- add this line
}
  1. Create an API route in src/app/api/registry/[name]/route.ts :
// src/app/api/registry/[name]/route.ts

import { NextResponse } from "next/server"
import { allRegistries } from "@/shadreg"

export async function GET(
  request: Request,
  { params }: { params: { name: string } },
) {
  const { name } = params
  const registry = allRegistries.find((entry) => entry.name === name)

  if (!registry) {
    return NextResponse.json(
      { error: `Registry with name "${name}" not found` },
      { status: 404 },
    )
  }

  return NextResponse.json(registry.entry)
}

To fetch the registry:

GET http://localhost:3000/api/registry/cool-text

To add the registry with shadcn:

npx shadcn@latest add http://localhost:3000/api/registry/cool-text

publish

The publish command uploads the registry JSON to Vercel Blob Store, making it publicly accessible.

npx shadcn publish

You must provide a Vercel Blob token in your .env file.

BLOB_READ_WRITE_TOKEN=your-vercel-blob-token

Once published, the Vercel Blob URL will be added to the _generated.json file.

License

Licensed under the MIT license.