sharedcn API & CLI Documentation
⚠️ Note: The CLI
Push: Your components will be added but with
setup-auth
command is currently halted. Please use only the add and push features for now.Push: Your components will be added but with
@public
prefix.CLI: Fetch Components by Alias (add)
npx sharedcn add <alias1> <alias2> ... - Fetches one or more components by alias. - Writes code to components/custom/<alias>/ - Installs dependencies automatically. - Shows missing components and failed installs.Example:
npx sharedcn add @public/button @public/card
CLI: Push Components (push)
npx sharedcn push <file1> <file2> ... --name=<name> [--description=...] [--dependent=...] - Pushes a new component to the server (with @public prefix). - Example: npx sharedcn push Button.tsx --name=@public/button --description="A button"
CLI: Setup Auth (halted)
npx sharedcn setup-auth <token> - This command is currently halted.
API: Fetch Components by Alias
POST /api/components/fetch Body: ["alias1", "alias2", ...] Returns: Array of components or { alias, error: "doesnot exist" } for missing ones.Example:
curl -X POST https://yourdomain.com/api/components/fetch -H "Content-Type: application/json" -d '["@public/button", "@public/card"]'
API: Push Component (with @public prefix)
POST /api/components/add Body: { name, description, dependent, code } - Adds a new component with @public prefix. - Returns the created component or error.
API: Check Alias Availability
GET /api/components/check-alias?alias=your-alias Returns: ("available" = true / false)
API: Get All Components
GET /api/components/all Returns: Array of all components