Project setup
Configure Next.js, components.json, path aliases, and monorepos before installing diarmuradi items.
Configure your Next.js project before installing diarmuradi items: shadcn initialization, components.json, path aliases, and monorepo layout.
For theme tokens, see Dark Mode. Registry configuration is in Quick Setup.
Requirements
- A Next.js app using the App Router
- shadcn/ui initialized with a
components.jsonfile - For gated blocks: a diarmuradi API key from your account and a Core or Full Access plan
Free block samples do not require an account or API key. Templates are downloaded from the site, not installed with the CLI.
Initialize shadcn
If you do not have shadcn/ui set up yet, run the init command in your project root. This creates components.json and adds the default path aliases.
pnpm dlx shadcn@latest init
Pick the style preset that matches your UI base:
- Base UI projects (default): use a
base-*style (for examplebase-nova) - Radix UI projects: use a
radix-*style (for exampleradix-nova) - React Aria projects: use an
aria-*style (for examplearia-nova)
Your style choice should align with the registry URL you configure in Quick Setup.
components.json
The components.json file is the entry point for the shadcn CLI. It tells the CLI where to install files, which Tailwind settings to use, and which registries you can install from.
A minimal structure (add registries from Quick Setup):
{
"$schema": "https://ui.shadcn.com/schema.json",
"style": "base-nova",
"rsc": true,
"tsx": true,
"tailwind": {
"config": "",
"css": "app/globals.css",
"baseColor": "neutral",
"cssVariables": true,
"prefix": ""
},
"iconLibrary": "lucide",
"aliases": {
"components": "@/components",
"utils": "@/lib/utils",
"ui": "@/components/ui",
"lib": "@/lib",
"hooks": "@/hooks"
},
"registries": {}
}Path aliases
Running npx shadcn@latest init adds components, utils, ui, lib, and hooks by default. diarmuradi blocks resolve into those paths.
"aliases": {
"components": "@/components",
"utils": "@/lib/utils",
"ui": "@/components/ui",
"lib": "@/lib",
"hooks": "@/hooks"
}Match these paths to your project structure. Alias values must align with the paths in your tsconfig.json.
Monorepo
The shadcn CLI understands monorepo layouts and installs files to the correct workspace paths. See the shadcn monorepo docs for the full reference.
Getting started
Scaffold a new monorepo with:
pnpm dlx shadcn@latest init --monorepo
After adding registry entries and REGISTRY_TOKEN to your app workspace, install diarmuradi items from the app path, not the repo root.
cd apps/web
npx shadcn@latest add @diarmuradi/header-1File structure
apps
└── web # App (routes, pages)
├── app
├── components
├── components.json
└── package.json
packages
└── ui # Shared UI, hooks, utils
├── src
├── components.json
└── package.jsonMonorepo requirements
- Every workspace needs a
components.json - Define aliases per workspace
- Register
@diarmuradi(and@diarmuradi-prowhen needed) in the workspace you install from - Keep
style,iconLibrary, andbaseColoraligned across workspaces - For Tailwind CSS v4, leave
tailwind.configempty incomponents.json
Example app workspace components.json:
{
"aliases": {
"components": "@/components",
"hooks": "@/hooks",
"lib": "@/lib",
"utils": "@workspace/ui/lib/utils",
"ui": "@workspace/ui/components"
},
"registries": {
"@diarmuradi": "https://diarmuradi.com/r/{style}/{name}.json",
"@diarmuradi-pro": {
"url": "https://diarmuradi.com/api/registry/bearer/{name}",
"headers": {
"Authorization": "Bearer ${REGISTRY_TOKEN}"
}
}
}
}Import shared UI from the workspace package:
import { Button } from "@workspace/ui/components/button"
import { cn } from "@workspace/ui/lib/utils"