Overview
Anicon uses shadcn’s registry system to enable CLI-based installation. When users run:- Fetches the JSON file from your registry
- Copies the component to the user’s project
- Installs required dependencies (like
motion) - Configures the component based on their
components.json
Registry Structure
File Organization
Registry Configuration
Theregistry.json file defines all icons in your registry:
Schema Fields
Top-level:$schema: Points to shadcn’s registry schema (required for validation)name: Registry identifier (“anicon”)homepage: URL to your repository or homepageitems: Array of all icon entries
name: Unique identifier for the icon (used in CLI commands)type: Always"registry:component"for componentstitle: Human-readable title shown in documentationdescription: Brief description of the animation behaviordependencies: Array of npm packages required (typically["motion"])files: Array of file objects defining component paths
path: Relative path from project root to the component filetype: File type (typically"registry:component")
Building the Registry
Build Command
To generate distributable JSON files:shadcn build command defined in package.json:
What Happens During Build
// public/r/icon-heart.json
{
"name": "icon-heart",
"type": "registry:component",
"dependencies": ["motion"],
"files": [
{
"name": "icon-heart.tsx",
"content": "// Full component source code here"
}
]
}
Output Files
After building, yourpublic/r/ directory contains:
Local Development
Development Workflow
-
Start dev server to preview changes:
-
Make changes to icons in
registry/default/ - Update registry.json if adding/removing icons
-
Build registry when ready to test installation:
-
Test installation in a separate project:
Testing Installation Locally
Create a test Next.js project with shadcn:components/ui/icon-heart.tsx and test it:
Deployment
Prerequisites
-
Build the registry:
-
Build your Next.js app:
-
Verify
public/r/contains all JSON files
Deploy to Vercel
Anicon is designed for Vercel deployment:public/ directory, making your registry accessible at:
Deploy to Other Platforms
Netlify:public/ and supports Next.js.
Making Icons Available
Update Documentation
After deployment, update your installation instructions with the production URL:Share Registry URL
Users can install icons from your deployed registry:Continuous Integration
GitHub Actions Example
Automate registry builds on every commit:Troubleshooting
Build fails with “File not found”
Problem: Registry references a file that doesn’t exist. Solution: Verify all paths inregistry.json match actual files:
Icons not appearing after deployment
Problem: JSON files not being served. Solution:- Verify build ran:
npm run registry:build - Check
public/r/contains JSON files - Ensure hosting serves
public/directory - Test URL directly:
https://your-site.com/r/icon-heart.json
Installation fails with “Invalid registry”
Problem: JSON format doesn’t match shadcn schema. Solution: Validateregistry.json structure:
- Ensure
$schemafield is present - Verify all required fields exist
- Check JSON syntax with a validator
Dependency not installed
Problem:motion not added to user’s project.
Solution: Ensure dependencies array includes "motion":
Advanced Topics
Multiple File Components
If an icon requires multiple files:Custom Dependencies
Add additional dependencies if needed:Automated Registry Generation
Thereconstruct_registry.js script can regenerate registry.json from icon metadata:
Next Steps
- Learn how to add icons to the registry
- Explore creating custom icon animations
- Read shadcn registry documentation
- Check out the shadcn CLI source for advanced usage