Vvcare/ui
Documentation menu

Components

Registry

Deploy to Cloudflare

The whole site, registry included, is static files. Cloudflare Pages serves it for free.

Why it fits

The build produces a dist/ folder of HTML, JS and JSON. There is no server code and no database, so Pages needs no adapter and no Worker.

Option A: connect a Git repository

  1. In the Cloudflare dashboard open Workers & Pages, then Create, then Pages, then connect your repo.
  2. Framework preset: Astro. Build command: npm run build. Output directory: dist.
  3. Add an environment variable PUBLIC_SITE_URL set to your final URL, for example https://ui.vcarehms.com or your custom domain.
  4. Deploy. Every push to the production branch redeploys, and other branches get preview URLs.

Why PUBLIC_SITE_URL matters

The install commands, sitemap and canonical links on these pages are generated from it at build time. Without it they show http://localhost:5190.

Option B: deploy from your terminal

This repo includes a wrangler.jsonc and a deploy script.

npx wrangler login
PUBLIC_SITE_URL=https://ui.vcarehms.com npm run deploy

The script builds the registry and the site, then runs wrangler pages deploy dist.

CORS and headers

The CLI fetches JSON from Node, so CORS is not required for it. It is required if a browser app, such as an in-browser playground, fetches your items. public/_headers is copied into dist and Cloudflare applies it:

public/_headers
/r/*
  Access-Control-Allow-Origin: *
  Content-Type: application/json
  Cache-Control: public, max-age=300

A five minute cache keeps installs fast while letting fixes roll out quickly. Raise it once your registry stabilises.

Custom domain

In the Pages project open Custom domains and add one, for instance ui.example.com. Update PUBLIC_SITE_URL, rebuild, and consumers change their namespace to the new template. Items reference each other by namespace, so nothing inside the JSON has to change.

Verify

curl -sI https://ui.vcarehms.com/r/button.json | grep -i -E "http|content-type|access-control"
npx shadcn@latest view https://ui.vcarehms.com/r/button.json

You should see a 200, application/json, and the resolved item with its file contents.