Getting started
To create a new monorepo project, run the
init command. You will be prompted
to select the type of project you are creating.This will create a new monorepo project with two workspaces:
web and ui,
and Turborepo as the build system.The CLI will figure out what type of component you are adding and install the
correct files to the correct path.
For example, if you run
npx shadcn@latest add button, the CLI will install the button component under packages/ui and update the import path for components in apps/web.If you run
npx shadcn@latest add login-01, the CLI will install the button, label, input and card components under packages/ui and the login-form component under apps/web/components.File Structure
When you create a new monorepo project, the CLI will create the following file structure:Requirements
-
Every workspace must have a
components.jsonfile. Apackage.jsonfile tells npm how to install the dependencies. Acomponents.jsonfile tells the CLI how and where to install components. -
The
components.jsonfile must properly define aliases for the workspace. This tells the CLI how to import components, hooks, utilities, etc.
apps/web/components.json
packages/ui/components.json
-
Ensure you have the same
style,iconLibraryandbaseColorin bothcomponents.jsonfiles. -
For Tailwind CSS v4, leave the
tailwindconfig empty in thecomponents.jsonfile.