A powerful buildy-ui CLI for adding UI components to your Vite React projects with multi-registry support and intelligent dependency validation.
No installation needed! Use directly with npx
or bun x
:
# Initialize utility registry (base requirement)
npx buildy-ui@latest init
# Initialize additional registries
npx buildy-ui@latest init --registry semantic
npx buildy-ui@latest init --registry yourtheme
# Add components from different registries
npx buildy-ui@latest add button card --registry utility
npx buildy-ui@latest add input --registry semantic
npx buildy-ui@latest add dark-theme --registry yourtheme
# Install all components from a registry
npx buildy-ui@latest add --all --registry semantic
# Build and scan registries
npx buildy-ui@latest scan --registry utility
npx buildy-ui@latest build
Components installed via CLI can also use semantic styles through CDN:
<!-- Add compiled semantic CSS styles -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/ui8kit@latest/css/dist/styles.css">
<!-- OR -->
<link rel="stylesheet" href="https://unpkg.com/ui8kit@latest/css/dist/styles.css">
This allows you to:
- Use CLI for component logic and structure
- Apply semantic styling via CDN without additional CSS bundling
- Mix CLI workflow with CDN styling for faster development
// CLI-imported component with CDN styling
import { Button } from '@/semantic/ui/button'
// Component will automatically use semantic CSS classes from CDN
<Button className="button button-secondary button-lg">Styled Button</Button>
Best Practice: Install components via CLI for development workflow, add CDN CSS link for instant semantic styling without build configuration.
Since semantic CSS files contain Tailwind directives (@apply
), they must be processed during build time:
# Install the CSS package
npm install ui8kit@latest
# or
yarn add ui8kit@latest
# or
pnpm add ui8kit@latest
# or
bun add ui8kit@latest
/* Import all semantic styles */
@import "ui8kit/css/dist/semantic/index.css";
/* Or import individual components */
@import "ui8kit/css/dist/semantic/button.css";
@import "ui8kit/css/dist/semantic/card.css";
@import "ui8kit/css/dist/semantic/input.css";
Semantic CSS files contain Tailwind directives that need compilation:
/* Example from button.css */
.button-default {
@apply bg-primary text-primary-foreground shadow-xs hover:bg-primary/90;
}
.button-destructive {
@apply bg-destructive text-destructive-foreground shadow-xs hover:bg-destructive/90;
}
Method | Use Case | Tailwind Directives | Build Required |
---|---|---|---|
Package | Production projects | β Supported | β Required |
CDN | Quick prototyping | β Pre-compiled only | β Not required |
Add the package path to your tailwind.config.js
for proper purging:
/** @type {import('tailwindcss').Config} */
module.exports = {
content: [
"./src/**/*.{js,ts,jsx,tsx}",
"./node_modules/ui8kit/**/*.{js,ts,jsx,tsx}",
],
// ... rest of your config
}
Note: For production builds, use npm package installation. CDN is only for quick prototyping with pre-compiled styles.
The CLI supports three types of registries:
utility
- Base registry (required first). Contains foundational UI componentssemantic
- Semantic components that extend utility componentstheme
- Theme-specific components and variations
- Utility registry is the foundation and must be initialized first
- Semantic and yourtheme registries require utility registry to be present
- Components can only be installed in non-utility registries if they exist in utility first
# Initialize utility registry (required first)
npx buildy-ui@latest init
# Initialize additional registries
npx buildy-ui@latest init --registry semantic
npx buildy-ui@latest init --registry yourtheme
# Skip prompts and use defaults
npx buildy-ui@latest init --yes --registry semantic
Creates registry-specific configuration, directories, and dependencies.
# Add from utility registry (default)
npx buildy-ui@latest add button card
# Add from specific registries
npx buildy-ui@latest add button --registry utility
npx buildy-ui@latest add input --registry semantic
npx buildy-ui@latest add dark-theme --registry yourtheme
# Add multiple components at once
npx buildy-ui@latest add button card hero-section --registry semantic
# Add from external URL
npx buildy-ui@latest add "https://ui.example.com/button.json"
# Install ALL available components from a registry
npx buildy-ui@latest add --all --registry utility
npx buildy-ui@latest add --all --registry semantic
# Preview what would be installed
npx buildy-ui@latest add --all --dry-run --registry semantic
npx buildy-ui@latest add button --dry-run --registry yourtheme
# Force overwrite existing files
npx buildy-ui@latest add button --force --registry semantic
# Enable retry logic for unreliable connections
npx buildy-ui@latest add button --retry --registry semantic
npx buildy-ui@latest add --all --retry --registry yourtheme
Smart Features:
- Registry Validation: Ensures utility registry exists before using semantic/theme
- Component Validation: Checks if components exist in utility before installing in other registries
- Smart Search: Automatically searches across all categories (
ui
,blocks
,components
,lib
,templates
) - Dependency Intelligence: Handles workspace dependencies and filters real npm packages
- Skip Existing: Already installed files are skipped automatically (use
--force
to overwrite) - Retry Mode: Use
--retry
flag for enhanced connection logic with automatic retries and timeouts - Graceful Fallback: Helpful error messages with alternative solutions when registry is unavailable
# Scan utility registry
npx buildy-ui@latest scan --registry utility
# Scan semantic registry
npx buildy-ui@latest scan --registry semantic --output ./semantic/registry.json
# Scan with custom source directory
npx buildy-ui@latest scan --registry yourtheme --source ./theme --output ./theme-registry.json
Scan Features:
- Multi-category scanning: Scans
ui
,components
,blocks
,templates
, andlib
directories - Dependency analysis: Uses TypeScript AST to extract real dependencies vs devDependencies
- Smart filtering: Excludes local aliases (
@/
,./
,~/
) and workspace dependencies - JSDoc extraction: Automatically extracts component descriptions from comments
# Build with default settings
npx buildy-ui@latest build
# Build specific registry
npx buildy-ui@latest build ./utility/registry.json --output ./packages/registry/r/utility
# Build semantic registry
npx buildy-ui@latest build ./semantic/registry.json --output ./packages/registry/r/semantic
# Build from different working directory
npx buildy-ui@latest build --cwd ./packages/ui --output ./packages/registry/r
After initialization, your project will have registry-specific directories:
# Utility registry (base)
utility/
βββ ui/ # UI components (@/ui)
βββ blocks/ # Component blocks (@/blocks)
βββ components/ # Generic components (@/components)
βββ templates/ # Template components (@/templates)
βββ buildy.config.json
# Semantic registry
semantic/
βββ ui/ # Semantic UI components
βββ blocks/ # Semantic blocks
βββ components/ # Semantic components
βββ templates/ # Semantic templates
βββ buildy.config.json
# Theme registry
theme/
βββ ui/ # Theme-specific UI
βββ blocks/ # Theme blocks
βββ components/ # Theme components
βββ templates/ # Theme templates
βββ buildy.config.json
# Shared utilities (created with utility registry)
lib/ # Utilities (@/lib)
βββ utils.ts
Components are automatically installed to the correct directory based on their type and registry:
registry:ui
β{registry}/ui/
registry:block
β{registry}/blocks/
registry:component
β{registry}/components/
registry:template
β{registry}/templates/
registry:lib
βlib/
(always at root)
registry:ui
- Basic UI components (buttons, inputs, etc.)registry:lib
- Utility libraries and functions (shared across registries)registry:block
- Complex component blocksregistry:component
- Generic componentsregistry:template
- Template components
Each registry has its own buildy.config.json
file:
{
"$schema": "https://buildy.tw/schema.json",
"framework": "vite-react",
"typescript": true,
"aliases": {
"@": "./src",
"@/components": "./utility/components",
"@/ui": "./utility/ui",
"@/blocks": "./utility/blocks",
"@/lib": "./lib",
"@/utility": "./utility",
"@/semantic": "./semantic",
"@/theme": "./theme"
},
"registry": "@ui8kit",
"componentsDir": "./utility/ui",
"libDir": "./lib"
}
{
"$schema": "https://buildy.tw/schema.json",
"framework": "vite-react",
"typescript": true,
"aliases": {
"@": "./src",
"@/components": "./semantic/components",
"@/ui": "./semantic/ui",
"@/blocks": "./semantic/blocks",
"@/lib": "./lib",
"@/utility": "./utility",
"@/semantic": "./semantic",
"@/theme": "./theme"
},
"registry": "@ui8kit",
"componentsDir": "./semantic/ui",
"libDir": "./lib"
}
The CLI includes intelligent validation:
# This will fail if utility registry is not initialized
npx buildy-ui@latest init --registry semantic
# β Cannot use semantic registry without utility registry. Please run: npx buildy-ui init
# This will fail if utility registry has no components
npx buildy-ui@latest add button --registry semantic
# β No components found in utility registry. Please install utility components first
# This will show available utility components and fail
npx buildy-ui@latest add card --registry semantic
# Output:
# π¦ Available utility components (3 total):
# ui: button, input
# lib: utils
# β Components not found in utility registry: card. Install them first: npx buildy-ui add card
The CLI intelligently handles dependencies:
# Automatically detects and handles workspace dependencies
npx buildy-ui@latest add button --registry semantic
# Output:
# β
Already installed: clsx, tailwind-merge
# π Workspace dependencies: react, react-dom
# π¦ Will install: lucide-react
- Real dependencies: Actual npm packages that need installation
- Workspace dependencies: Detected and skipped (e.g.,
workspace:*
) - Local aliases: Filtered out (
@/
,./
,~/
) - DevDependencies: Automatically categorized (TypeScript, testing tools, etc.)
{
"$schema": "https://buildy.tw/schema/registry-item.json",
"name": "button",
"type": "registry:ui",
"description": "A customizable button component",
"dependencies": ["clsx", "tailwind-merge"],
"devDependencies": ["@types/react"],
"files": [
{
"path": "button.tsx",
"content": "import React from 'react'...",
"target": "ui"
}
]
}
{
"$schema": "https://buildy.tw/schema/registry.json",
"items": [
{
"name": "button",
"type": "registry:ui",
"description": "A customizable button component",
"dependencies": ["clsx", "tailwind-merge"],
"devDependencies": ["@types/react"],
"files": [
{
"path": "./utility/ui/button.tsx",
"target": "ui"
}
]
}
],
"registry": "utility",
"version": "1.0.0"
}
packages/registry/r/
βββ utility/
β βββ index.json # Utility registry index
β βββ ui/
β β βββ button.json # UI components
β βββ lib/
β β βββ utils.json # Utility libraries
β βββ blocks/
β β βββ hero.json # Component blocks
β βββ components/
β βββ card.json # Generic components
βββ semantic/
β βββ index.json # Semantic registry index
β βββ ui/
β βββ input.json # Semantic components
βββ yourtheme/
βββ index.json # Theme registry index
βββ ui/
βββ dark-button.json # Theme components
- Initialize registries in your development environment
- Develop components in registry-specific directories
- Scan registries to generate registry.json files
- Build registries to generate distribution files
- Deploy the registry directories to your CDN
- Users install with registry-specific commands
# Development setup
npx buildy-ui@latest init
npx buildy-ui@latest init --registry semantic
npx buildy-ui@latest init --registry yourtheme
# Develop components in utility/, semantic/, yourtheme/ directories
# Generate registry files
npx buildy-ui@latest scan --registry utility --output ./utility/registry.json
npx buildy-ui@latest scan --registry semantic --output ./semantic/registry.json
npx buildy-ui@latest scan --registry yourtheme --output ./theme/registry.json
# Build distribution
npx buildy-ui@latest build ./utility/registry.json --output ./packages/registry/r/utility
npx buildy-ui@latest build ./semantic/registry.json --output ./packages/registry/r/semantic
npx buildy-ui@latest build ./theme/registry.json --output ./packages/registry/r/theme
# Deploy packages/registry/r/ to your CDN
If you prefer to install the CLI:
npm install -g buildy-ui
# Then use: buildy init, buildy add button, etc.
npm install -D buildy-ui
# Then use: npx buildy init, npx buildy add button, etc.
MIT