Install with shadcn CLI

PreviousNext

How CLI install works for free and pro patterns, how tokenized installs are generated, and how to verify a successful install.

Use this path when you want to pull a pattern directly into an existing app with one command.

Two install paths

Free patterns

pnpm dlx shadcn@latest add <pattern-name>

Pro patterns

The UI generates a tokenized install URL and copies a command like:

pnpm dlx shadcn@latest add 'https://www.aisdkagents.com/pro-registry/<pattern-name>?token=<short-lived-token>'

The tokenized command is generated from the block toolbar so private registry access can be validated first.

Where command generation happens

  • Toolbar component: components/shadcn-registry/shadcn-copy-install-button.tsx
  • Pro flow:
    1. Request token from /api/cli-token/<pattern-name>
    2. Build install command using NEXT_PUBLIC_APP_URL or window.location.origin
    3. Copy command to clipboard
  • Free flow:
    1. Build npx shadcn@latest add <pattern-name>
    2. Copy command to clipboard

What gets added to your project

shadcn add installs pattern files plus any registry dependencies referenced by that pattern. If the pattern needs additional npm packages, install prompts are shown by the CLI.

Verification checklist

After running the copied command:

  1. Confirm new files exist in your app.
  2. Confirm imports resolve (@/components/*, @/lib/*).
  3. Run your type check and lint:
pnpm lint
pnpm typecheck
  1. Start dev server and open the route that uses the installed pattern.

Common failures

401/403 on pro installs

  • Your account is not entitled to the pattern, or
  • The token expired before command execution.

Fix: recopy the command from the pattern page and run it immediately.

Command works but UI breaks

  • Usually missing env vars or npm dependencies.

Fix: review the pattern docs for required environment variables and services.

When to choose this path

  • You already have an app and want specific patterns.
  • You want minimal file footprint instead of full project scaffolding.