Vvcare/ui
Documentation menu

Components

Registry

Build your own

The exact structure of this repository, step by step.

Project layout

vcare-ui/
  registry.json                 the manifest
  src/
    registry/vcare/
      lib/utils.ts              cn()
      ui/button.tsx ...         the app components (folders for data-grid, gantt…)
      site/                     the website kit and its sections (blocks)
      styles/vcare.css         the app theme; site.css the website theme
      examples/*.tsx            demos shown on the docs pages
  scripts/gen-registry.mjs      writes registry.json from the files
    pages/                      this documentation site
  public/r/                     generated by shadcn build
  public/_headers               CORS for Cloudflare
  wrangler.jsonc                Cloudflare config

The registry and the website live in one repo, and the website imports the same files it publishes. The component on the page and the component you install can never drift apart.

1. Create an Astro project

npm create astro@latest vcare-ui
cd vcare-ui
npx astro add react sitemap
npm i tailwindcss @tailwindcss/vite class-variance-authority clsx tailwind-merge @radix-ui/react-slot
npm i -D shadcn wrangler

2. Add the alias

Registry source imports from @/registry/..., so alias @ to src in both TypeScript and Vite.

tsconfig.json
{
  "extends": "astro/tsconfigs/strict",
  "compilerOptions": {
    "jsx": "react-jsx",
    "jsxImportSource": "react",
    "paths": { "@/*": ["./src/*"] }
  }
}
astro.config.mjs
import { defineConfig } from "astro/config"
import react from "@astrojs/react"
import tailwindcss from "@tailwindcss/vite"
import path from "node:path"

export default defineConfig({
  output: "static",
  integrations: [react()],
  vite: {
    plugins: [tailwindcss()],
    resolve: { alias: { "@": path.resolve("./src") } },
  },
})

3. Write a component

Put it under src/registry/<name>/ui/. Import the helper from the registry path, not a relative one:

import { cn } from "@/registry/vcare/lib/utils"

function Skeleton({ className, ...props }: React.ComponentProps<"div">) {
  return <div className={cn("animate-pulse rounded-md bg-accent", className)} {...props} />
}

export { Skeleton }

4. Register it

registry.json
{
  "$schema": "https://ui.shadcn.com/schema/registry.json",
  "name": "vcare-ui",
  "homepage": "https://vcare-ui.pages.dev",
  "items": [
    {
      "name": "utils",
      "type": "registry:lib",
      "dependencies": ["clsx", "tailwind-merge"],
      "files": [{ "path": "src/registry/vcare/lib/utils.ts", "type": "registry:lib" }]
    },
    {
      "name": "skeleton",
      "type": "registry:ui",
      "title": "Skeleton",
      "registryDependencies": ["@vcare/utils"],
      "files": [{ "path": "src/registry/vcare/ui/skeleton.tsx", "type": "registry:ui" }]
    }
  ]
}

Cross-references

Reference your own items with the namespace form, @vcare/utils. Consumers resolve it through their registries config, so the registry never hard-codes its own domain.

5. Build and test

Wire the build into package.json so the JSON is always fresh:

{
  "scripts": {
    "registry:build": "shadcn build -o public/r",
    "dev": "npm run registry:build && astro dev --port 5190",
    "build": "npm run registry:build && astro build"
  }
}

Start the site, then in a scratch project that has a components.json:

npx shadcn@latest registry add @vcare=http://localhost:5190/r/{name}.json
npx shadcn@latest add @vcare/skeleton

If the files appear with imports rewritten to your aliases, the registry works.

Blocks and themes