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 🙏

© 2026 – Pkg Stats / Ryan Hefner

fumadocs-registry

v0.3.2

Published

Automatic shadcn registry generation for component libraries built with Fumadocs

Downloads

20

Readme

fumadocs-registry

Automatic shadcn registry generation for component libraries built with Fumadocs.

Features

  • Auto-generates registry.json and component JSONs
  • Auto-injects code into <ComponentPreview> in MDX
  • Extracts exports and dependencies automatically
  • Automatic dependency bundling for v0.dev compatibility
  • Zero manual configuration for component metadata

Quick Start

pnpm add fumadocs-registry

Run the init command to set up your project:

npx fumadocs-registry init

This creates:

  • registry.config.ts - Configuration file
  • src/components/docs/component-preview.tsx - Preview component

Setup

1. Add the remark plugin

In source.config.ts:

import { remarkComponentPreview } from "fumadocs-registry/remark";

export default defineConfig({
  mdxOptions: {
    remarkPlugins: [remarkComponentPreview],
  },
});

2. Register the component

In mdx-components.tsx:

import { ComponentPreview } from "@/components/docs/component-preview";

export function useMDXComponents(components: MDXComponents) {
  return {
    ComponentPreview,
    ...components,
  };
}

3. Add build script

In package.json:

{
  "scripts": {
    "build": "fumadocs-registry && next build"
  }
}

Usage

Write your component documentation using <ComponentPreview>:

<ComponentPreview component="button" example="preview">
  <Button>Click me</Button>
</ComponentPreview>

The plugin automatically:

  1. Injects the source code as the code prop
  2. Generates registry JSON files in public/r/
  3. Creates demo blocks for v0.dev integration

Configuration

Create registry.config.ts in your project root:

import type { PluginOptions } from "fumadocs-registry";

export default {
  // Required: Base URL where registry files are served
  baseUrl: "https://myui.com/r",

  // Optional: Registry metadata
  registry: {
    name: "myui",
    homepage: "https://myui.com",
  },

  // Optional: Component directories (default: [{ name: "ui", type: "ui" }])
  componentsDirs: [
    { name: "ui", type: "ui" },
    { name: "animated", type: "ui" },
    { name: "lib", type: "lib" },
  ],

  // Optional: Docs directories to scan (default: ["content/docs/components"])
  docsDirs: [
    "content/docs/components",
    "content/docs/animated",
  ],

  // Optional: Other settings
  componentsDir: "src/registry",  // Default: "src/registry"
  outputDir: "public/r",          // Default: "public/r"
} satisfies PluginOptions;

Project Structure

Expected directory structure:

your-project/
├── src/
│   ├── registry/
│   │   ├── ui/
│   │   │   ├── button.tsx
│   │   │   └── card.tsx
│   │   └── lib/
│   │       └── utils.ts
│   └── components/
│       └── docs/
│           └── component-preview.tsx
├── content/
│   └── docs/
│       └── components/
│           ├── button.mdx
│           └── card.mdx
├── public/
│   └── r/                # Generated (auto-created)
└── registry.config.ts

CLI Commands

# Initialize a new project
fumadocs-registry init

# Build the registry
fumadocs-registry

# Show help
fumadocs-registry --help

Output

The plugin generates:

  • public/r/registry.json - Main registry index
  • public/r/button.json - Component registry entry
  • public/r/button-demo-preview.json - Demo block for v0.dev

Automatic Dependency Bundling

Since v0.3.0, fumadocs-registry automatically bundles internal dependencies directly into each component's files array. This ensures compatibility with v0.dev and the shadcn CLI.

How it works:

When a component imports internal utilities or other components from your registry:

import { useControllableState } from "@/lib/use-controllable-state";
import { cn } from "@/lib/utils";

Instead of creating separate registryDependencies URLs, fumadocs-registry will:

  1. Detect all internal imports recursively
  2. Bundle all required files into the component's files array
  3. Keep only external shadcn dependencies in registryDependencies

Example output:

{
  "name": "card-input",
  "files": [
    { "target": "components/ui/card-input.tsx", ... },
    { "target": "lib/use-controllable-state.ts", ... },
    { "target": "lib/utils.ts", ... }
  ],
  "dependencies": ["clsx", "tailwind-merge"]
}

This ensures v0.dev can resolve all imports without needing to fetch multiple registry entries.

License

MIT