### Install all components with @creative-tim/ui Source: https://deepwiki.com/creativetimofficial/ui/2-getting-started Fetches all.json from the registry and installs all available components. Sets up shadcn/ui if not already configured and adds necessary dependencies. ```bash npx @creative-tim/ui@latest add all ``` -------------------------------- ### Install all components with shadcn CLI Source: https://deepwiki.com/creativetimofficial/ui/2.1-installation-methods Use `npx shadcn@latest add https://creative-tim.com/ui/r/all.json` to install all components via the aggregated registry. ```bash npx shadcn@latest add https://creative-tim.com/ui/r/all.json ``` -------------------------------- ### Start Development Server with pnpm dev Source: https://deepwiki.com/creativetimofficial/ui/4.2-component-development Command to start the development server for local testing. ```bash pnpm dev ``` -------------------------------- ### Install a specific component with @creative-tim/ui Source: https://deepwiki.com/creativetimofficial/ui/2-getting-started Fetches the component's JSON (e.g., card.json) from the registry and installs it. ```bash npx @creative-tim/ui@latest add card ``` -------------------------------- ### Install a component with Creative Tim CLI Source: https://deepwiki.com/creativetimofficial/ui/2.1-installation-methods Use `npx @creative-tim/ui@latest add ` to install a single component. This command fetches metadata, downloads files, installs dependencies, and configures shadcn/ui if needed. ```bash npx @creative-tim/ui@latest add ``` -------------------------------- ### Install private component with CLI using API key Source: https://deepwiki.com/creativetimofficial/ui/5.6-api-routes Sets the API key in .env.local and installs a private component using the CLI. The API key must be configured before running the install command. ```bash # Set in .env.local API_KEY=your_api_key_here # Install private component npx @creative-tim/ui add testimonials-03 ``` -------------------------------- ### Install a component using shadcn CLI with URL Source: https://deepwiki.com/creativetimofficial/ui/2-getting-started Alternative installation method using the standard shadcn CLI with a direct URL to the component's JSON file. ```bash npx shadcn@latest add https://creative-tim.com/ui/r/button.json ``` -------------------------------- ### Installation Workflow Sequence Diagram Source: https://deepwiki.com/creativetimofficial/ui/2.1-installation-methods Sequence diagram showing the complete installation flow, including public and private component handling, authentication, and file system operations. ```mermaid sequenceDiagram participant User participant CLI as "CLI Tool
(CT or shadcn)" participant Registry as "creative-tim.com/ui/r/" participant PrivateAPI as "/api/r/[name]" participant FileSystem as "Local Filesystem" User->>CLI: "npx ... add component-name" CLI->>CLI: "Check if shadcn/ui initialized" CLI->>Registry: "GET /r/component-name.json" alt Component is Public Registry-->>CLI: "200 OK + JSON metadata" else Component is Private Registry-->>PrivateAPI: "Route to private API" CLI->>PrivateAPI: "GET with Authorization header" PrivateAPI->>PrivateAPI: "Validate PRIVATE_COMPONENTS" PrivateAPI->>PrivateAPI: "Validate API_KEY" alt Valid Token PrivateAPI->>PrivateAPI: "readFileSync(componentPath)" PrivateAPI-->>CLI: "200 OK + JSON metadata" else Invalid Token PrivateAPI-->>CLI: "401 Unauthorized" CLI-->>User: "Error: Authentication required" end end CLI->>CLI: "Parse component metadata" CLI->>FileSystem: "Write files to components/ui/" CLI->>FileSystem: "Update package.json" CLI->>User: "✓ Component installed" ``` -------------------------------- ### Install a component with shadcn CLI Source: https://deepwiki.com/creativetimofficial/ui/2.1-installation-methods Use `npx shadcn@latest add ` to install a component via the shadcn CLI, providing the registry JSON URL. ```bash npx shadcn@latest add https://creative-tim.com/ui/r/.json ``` -------------------------------- ### Fork and Setup Workflow Diagram (Mermaid) Source: https://deepwiki.com/creativetimofficial/ui/2.2-development-environment-setup A Mermaid graph illustrating the complete setup process from forking the repository to running the development server and viewing changes in the browser. ```mermaid graph TB Fork["Fork Repository
github.com/creativetimofficial/ui"] Clone["git clone
https://github.com/YOUR_USERNAME/ui.git"] Navigate["cd ui"] Branch["git checkout -b
my-new-branch"] Install["pnpm install"] Dev["pnpm dev"] subgraph "GitHub" UpstreamRepo["creativetimofficial/ui
(upstream)"] end subgraph "Local Machine" LocalRepo["Local Repository
ui/"] NodeModules["node_modules/
.pnpm-store/"] DevServer["Next.js Dev Server
localhost:3000"] end subgraph "Development Ready" EditCode["Edit Source Files"] ViewChanges["View in Browser"] end UpstreamRepo -->|"Fork"| Fork Fork -->|"Clone"| Clone Clone --> Navigate Navigate --> LocalRepo LocalRepo --> Branch Branch --> Install Install --> NodeModules NodeModules --> Dev Dev --> DevServer DevServer --> ViewChanges LocalRepo --> EditCode EditCode --> ViewChanges ``` -------------------------------- ### Example markdown response body Source: https://deepwiki.com/creativetimofficial/ui/5.6-api-routes Shows the structure of the response body, which is raw markdown content from the MDX source, with a heading and installation command placeholder. ```markdown # Component Documentation This component provides... ## Installation ```bash npx @creative-tim/ui add component-name ``` ... ``` -------------------------------- ### Install component with Creative Tim CLI Source: https://deepwiki.com/creativetimofficial/ui/4.3-component-distribution Installs a component using the Creative Tim CLI. The CLI reads the API_KEY from the user's environment for private components and includes it in requests to the /api/r/[name] endpoint. ```bash npx @creative-tim/ui add button ``` -------------------------------- ### Install Dependencies with pnpm Source: https://deepwiki.com/creativetimofficial/ui/2.2-development-environment-setup Run this command in the project root to install all workspace dependencies. It reads package.json files, resolves versions, downloads packages to .pnpm-store/, creates node_modules/ with symlinks, and generates pnpm-lock.yaml. ```bash pnpm install ``` -------------------------------- ### Environment Configuration (.env.local) Source: https://deepwiki.com/creativetimofficial/ui/2-getting-started Example .env.local file with API_KEY and NEXT_PUBLIC_APP_URL variables. Required for accessing private components via the private registry API. ```plaintext API_KEY=your_api_key_here NEXT_PUBLIC_APP_URL=http://localhost:3000 ``` -------------------------------- ### Responsive Tailwind class example Source: https://deepwiki.com/creativetimofficial/ui/4.2-component-development Example of responsive variants using Tailwind breakpoints. ```tsx className="flex-col md:flex-row lg:items-center" ``` -------------------------------- ### Registry build flow (Mermaid diagram) Source: https://deepwiki.com/creativetimofficial/ui/4.2-component-development Shows the build process for the registry: component source files are processed by `pnpm build:registry` to generate an index file and JSON files for CLI installation and preview routes. ```mermaid graph LR Source["Component Source Files"] --> Build["pnpm build:registry"] Build --> Index["registry/__index__.tsx"] Build --> JSON["public/r/*.json"] Index --> Preview["Preview Routes"] JSON --> CLI["CLI Installation"] ``` -------------------------------- ### Response headers JSON example Source: https://deepwiki.com/creativetimofficial/ui/5.6-api-routes Shows the headers returned by the endpoint: Content-Type set to text/markdown; charset=utf-8. ```json { "Content-Type": "text/markdown; charset=utf-8" } ``` -------------------------------- ### GET /api/r/[name] Source: https://deepwiki.com/creativetimofficial/ui/2.1-installation-methods Retrieves a component by name. For private components, authentication is required via API key. ```APIDOC ## GET /api/r/[name] ### Description Retrieves a component by name. For private components (e.g., testimonials-03, testimonials-04), authentication is required. ### Method GET ### Endpoint /api/r/[name] ### Parameters #### Path Parameters - **name** (string) - Required - The name of the component to retrieve. #### Query Parameters - **token** (string) - Optional - Authentication token when using query parameter authentication. ### Headers - **Authorization** (string) - Optional - Bearer token for authentication. - **x-api-key** (string) - Optional - API key for authentication. ### Response #### Success Response (200) - Returns the component JSON. - Includes `Cache-Control: private, max-age=3600` header for authenticated responses. #### Unauthorized (401) - Returned when the provided token is invalid or missing for private components. #### Not Found (404) - Returned when the component is not in the private components list or does not exist. ### Authentication Private components require a valid API key. The API key can be provided via: - `Authorization` header with Bearer token - `x-api-key` header - `token` query parameter The API key is validated against `process.env.API_KEY`. Configure it in a `.env.local` file: ``` API_KEY=your_api_key_here ``` Obtain your API key from `https://creative-tim.com/ui`. ``` -------------------------------- ### Importing Components with Aliases Source: https://deepwiki.com/creativetimofficial/ui/2-getting-started Use the configured aliases to import components from the UI library. The '@/' alias resolves to the project root, and the '/components/ui' path points to the directory where components are installed. ```tsx import { Button } from "@/components/ui/button" import { Card } from "@/components/ui/card" ``` -------------------------------- ### Component Distribution Flowchart Source: https://deepwiki.com/creativetimofficial/ui/4.3-component-distribution Flowchart showing how registry source files are built into JSON artifacts and accessed by public or private routes before installation via CLI tools. ```mermaid graph TD SourceCode["registry/creative-tim/ui/
Component Source Files"] BuildCmd["pnpm build:registry
Build Command"] JsonOutput["public/r/*.json
Component Metadata"] PublicAccess["Public Components
Direct File Access"] PrivateAPI["/api/r/[name]
Private Component API"] AuthCheck{"Authentication
Required?"} CTCLI["@creative-tim/ui CLI
Installation Tool"] ShadcnCLI["shadcn CLI
Installation Tool"] UserProject["User's Next.js Project
components/ui/"] SourceCode --> BuildCmd BuildCmd --> JsonOutput JsonOutput --> AuthCheck AuthCheck -->|"No
(Public)"| PublicAccess AuthCheck -->|"Yes
(Private)"| PrivateAPI PublicAccess --> CTCLI PublicAccess --> ShadcnCLI PrivateAPI --> CTCLI PrivateAPI --> ShadcnCLI CTCLI --> UserProject ShadcnCLI --> UserProject ``` -------------------------------- ### Dark mode Tailwind class example Source: https://deepwiki.com/creativetimofficial/ui/4.2-component-development Example of automatic dark mode classes. ```tsx className="bg-white dark:bg-slate-950" ``` -------------------------------- ### Complete Development Cycle Diagram Source: https://deepwiki.com/creativetimofficial/ui/4.2-component-development Mermaid flowchart showing the full development cycle from starting development to creating a pull request. ```mermaid graph TD Start["Start Development"] --> Branch["git checkout -b feature/component-name"] Branch --> Create["Create Component Files"] Create --> Implement["Implement & Style"] Implement --> Preview["Test in /view Route"] Preview --> BuildReg["pnpm build:registry"] BuildReg --> Docs["Update Documentation"] Docs --> Commit["Git Commit"] Commit --> Push["Git Push"] Push --> PR["Create Pull Request"] ``` -------------------------------- ### Tailwind CSS variable class example Source: https://deepwiki.com/creativetimofficial/ui/4.2-component-development Example of using CSS variables for theme colors in a className. ```tsx className="bg-background text-foreground" ``` -------------------------------- ### Preview Route Integration Diagram Source: https://deepwiki.com/creativetimofficial/ui/4.2-component-development Mermaid flowchart showing the preview system integration: registry/__index__.tsx feeds into generateStaticParams(), filters by type (block, component, example, internal), and generates /view/[name] routes which render the component. ```mermaid graph TD Registry["registry/__index__.tsx"] --> Static["generateStaticParams()"] Static --> Filter["Filter by Type"] Filter --> Block["registry:block"] Filter --> Component["registry:component"] Filter --> Example["registry:example"] Filter --> Internal["registry:internal"] Block --> Generate["Generate /view/[name]"] Component --> Generate Example --> Generate Internal --> Generate Generate --> Render["Render Component"] ``` -------------------------------- ### Component Registry System Flow (Mermaid) Source: https://deepwiki.com/creativetimofficial/ui/4-component-registry-system Mermaid diagram showing the three-phase flow: source files in apps/www/registry/creative-tim/ui/ are read by pnpm build:registry, which generates registry/__index__.tsx and public/r/*.json. The JSON artifacts are publicly accessible to both @creative-tim/ui and shadcn CLIs, while the private API /api/r/[name] requires authentication. Both CLIs install components into the user's Next.js project. ```mermaid graph TB SourceFiles["apps/www/registry/
creative-tim/ui/"] BuildCommand["pnpm build:registry"] IndexFile["registry/__index__.tsx"] JSONArtifacts["public/r/*.json"] CLI_CT["@creative-tim/ui CLI"] CLI_Shadcn["shadcn CLI"] PrivateAPI["/api/r/[name]"] UserProject["User's Next.js Project
components/ui/"] SourceFiles -->|"reads"| BuildCommand BuildCommand -->|"generates"| IndexFile BuildCommand -->|"generates"| JSONArtifacts JSONArtifacts -->|"public access"| CLI_CT JSONArtifacts -->|"public access"| CLI_Shadcn PrivateAPI -->|"auth required"| JSONArtifacts CLI_CT -->|"installs to"| UserProject CLI_Shadcn -->|"installs to"| UserProject style SourceFiles fill:#f5f5f5 style JSONArtifacts fill:#f5f5f5 style BuildCommand fill:#f5f5f5 ``` -------------------------------- ### Commit Message Example Source: https://deepwiki.com/creativetimofficial/ui/8.4-version-control-configuration Example of a well-formed commit message following the repository's commit conventions. Uses imperative mood, lowercase type, parenthetical scope, a concise subject line, and a body providing context. ```text feat(registry): add authentication for private components Implements API key validation for testimonials-03 and testimonials-04. Uses REGISTRY_PRIVATE_API_KEY environment variable for authorization. Returns 401 when key is missing or invalid. ``` -------------------------------- ### Clone fork and add upstream remote Source: https://deepwiki.com/creativetimofficial/ui/3.2-development-workflows Clones your fork, navigates into the repository, and adds the original repository as an upstream remote. This is the standard setup for a fork-and-pull-request workflow. ```bash git clone https://github.com/your-username/ui.git cd ui git remote add upstream https://github.com/creativetimofficial/ui.git ``` -------------------------------- ### CLI request flow diagram Source: https://deepwiki.com/creativetimofficial/ui/4.3-component-distribution Mermaid diagram illustrating the CLI request flow. It shows how the CLI checks if a component is private, fetches from public/r/*.json for public components, or adds the API_KEY and requests /api/r/[name] for private ones, then installs files to components/ui/. ```mermaid graph LR User["User runs CLI command"] CheckPrivate{"Component
is Private?"} DirectFetch["Fetch from
public/r/*.json"] APIRequest["Request
/api/r/[name]"] AddAuth["Add API_KEY
to request"] Install["Install files to
components/ui/"] User --> CheckPrivate CheckPrivate -->|No| DirectFetch CheckPrivate -->|Yes| AddAuth AddAuth --> APIRequest DirectFetch --> Install APIRequest --> Install ``` -------------------------------- ### Component variants with cn() Source: https://deepwiki.com/creativetimofficial/ui/4.2-component-development Example of creating variant props for different styles using the `cn` utility. ```tsx className={cn( "base-classes", variant === "outline" && "border border-input", variant === "ghost" && "hover:bg-accent" )} ``` -------------------------------- ### System Architecture Mermaid Diagram Source: https://deepwiki.com/creativetimofficial/ui/1-overview Architecture diagram showing the monorepo structure, user project integration, and deployed site routes. It illustrates how the registry source feeds the public JSON and API endpoints, and how both CLI commands install components into the user's project. ```mermaid graph TB subgraph Repository["creativetimofficial/ui Repository"] Root["Root
(pnpm + Turborepo)"] WWW["apps/www
(Next.js 13+ App)"] Registry["apps/www/registry/creative-tim
(Component Source)"] Content["apps/www/content
(MDX Documentation)"] Public["apps/www/public/r
(Generated JSON)"] end subgraph UserProject["User Next.js Project"] UserCLI["npx @creative-tim/ui add"] ShadcnCLI["npx shadcn add"] UserComponents["components/ui/"] end subgraph DeployedSite["creative-tim.com/ui"] DocsRoute["/docs"] BlocksRoute["/blocks"] APIRoute["/api/r/[name]"] ViewRoute["/view/[name]"] end Root --> WWW Root --> Registry Root --> Content WWW -->|"pnpm build:registry"| Public WWW -->|"deployed to"| DeployedSite Public --> APIRoute APIRoute --> UserCLI APIRoute --> ShadcnCLI UserCLI --> UserComponents ShadcnCLI --> UserComponents Registry -->|"source for"| Public Content -->|"renders to"| DocsRoute Registry -->|"previewed in"| ViewRoute ``` -------------------------------- ### Render ShowcaseMasonry component Source: https://deepwiki.com/creativetimofficial/ui/5.2-landing-and-marketing-pages Renders the ShowcaseMasonry component without props to display a masonry layout of example components. Positioned after the hero and before the achievements section. ```jsx ``` -------------------------------- ### Run Command in Specific Workspace with pnpm --filter Source: https://deepwiki.com/creativetimofficial/ui/2.2-development-environment-setup Use `pnpm --filter=[WORKSPACE] [command]` to run a command in a specific workspace. The example `pnpm --filter=www dev` is equivalent to `pnpm dev` when apps/www is the default workspace. ```bash pnpm --filter=[WORKSPACE] [command] ``` ```bash pnpm --filter=www dev ``` -------------------------------- ### Authentication Error Message Source: https://deepwiki.com/creativetimofficial/ui/4.3-component-distribution Detailed error message returned when authentication fails for private components. Guides users to configure authentication by setting API_KEY in .env.local or providing it via Authorization header, X-API-Key header, or ?token= query parameter. ```text Authentication required for private components. Set API_KEY in your .env.local file or provide it via Authorization header, X-API-Key header, or ?token= query parameter. ``` -------------------------------- ### Access control flow diagram Source: https://deepwiki.com/creativetimofficial/ui/4.1-registry-architecture Mermaid diagram showing the access control flow for component installation requests. It branches on whether the component is private, then checks API key validity, serving either public JSON, private JSON with Cache-Control: private, or a 401 Unauthorized response. ```mermaid graph TB CLIRequest["CLI Installation Request"] CheckPrivate{"Is component
in PRIVATE_COMPONENTS?"} PublicJSON["Serve from
public/r/component.json"] CheckAuth{"Valid API key
provided?"} PrivateAPI["api/r/[name]/route.ts
GET handler"] ServePrivate["Return JSON
with Cache-Control: private"] Return401["Return 401
Unauthorized"] CLIRequest --> CheckPrivate CheckPrivate -->|No| PublicJSON CheckPrivate -->|Yes| CheckAuth CheckAuth -->|Yes| PrivateAPI CheckAuth -->|No| Return401 PrivateAPI --> ServePrivate ``` -------------------------------- ### ESLint ignorePatterns for fixtures Source: https://deepwiki.com/creativetimofficial/ui/8.2-eslint-configuration Configuration-based ignore pattern in .eslintrc.json that prevents ESLint from analyzing any files in fixtures directories, typically containing test fixtures or example code. ```json "ignorePatterns": ["**/fixtures/**"] ``` -------------------------------- ### Block rendering flow diagram Source: https://deepwiki.com/creativetimofficial/ui/5.4-blocks-gallery-system Mermaid diagram illustrating the block rendering flow: the blocks array is mapped to block names, which are passed to the BlockDisplay component as name and key props. BlockDisplay then renders the preview, shows metadata, and provides installation actions. ```mermaid graph LR subgraph "Page Loop" BlocksArray["blocks[] array"] MapFunction["map(name => ...)"] BlockName["block name key"] end subgraph "BlockDisplay Component" DisplayComponent["BlockDisplay"] NameProp["name prop"] KeyProp["key prop"] end BlocksArray --> MapFunction MapFunction --> BlockName BlockName --> DisplayComponent BlockName --> NameProp BlockName --> KeyProp DisplayComponent -.->|"renders"| Preview["Block Preview"] DisplayComponent -.->|"shows"| Metadata["Block Metadata"] DisplayComponent -.->|"provides"| Actions["Installation Actions"] ``` -------------------------------- ### Mermaid flow diagram for LLM content endpoint Source: https://deepwiki.com/creativetimofficial/ui/5.6-api-routes Uses mermaid syntax to show the request flow: from GET /llm/[[...slug]] through slug extraction, source.getPage(slug) content retrieval, and response generation with Content-Type: text/markdown and NextResponse. Also shows notFound() for missing pages. ```mermaid graph TD Request["GET /llm/[[...slug]]"] subgraph "Parameter Processing" ExtractSlug["Extract slug array
from params"] end subgraph "Content Layer Integration" SourceGetPage["source.getPage(slug)"] ContentLayer["fumadocs source
.contentlayer data"] end subgraph "Response Generation" ExtractContent["page.data.content"] SetHeaders["Content-Type:
text/markdown"] NextResponse["NextResponse
with markdown body"] end Request --> ExtractSlug ExtractSlug --> SourceGetPage SourceGetPage --> ContentLayer ContentLayer -->|found| ExtractContent ContentLayer -->|not found| NotFound["notFound()"] ExtractContent --> SetHeaders SetHeaders --> NextResponse ``` -------------------------------- ### Render ExamplesPreview Component Source: https://deepwiki.com/creativetimofficial/ui/5.2-landing-and-marketing-pages Renders the ExamplesPreview component as a standalone section, positioned between the achievements and testimonials sections. ```jsx ``` -------------------------------- ### Run main website with pnpm dev Source: https://deepwiki.com/creativetimofficial/ui/3.2-development-workflows Run the main website application. The first command is equivalent to the second, which explicitly targets the 'www' workspace. ```bash pnpm dev ``` ```bash pnpm --filter=www dev ``` -------------------------------- ### Navigate to Component Preview URL Source: https://deepwiki.com/creativetimofficial/ui/4.2-component-development URL pattern to preview a component in the browser. Replace [component-name] with the actual component name. ```text http://localhost:3000/view/[component-name] ``` -------------------------------- ### Import with Path Aliases Source: https://deepwiki.com/creativetimofficial/ui/4.2-component-development Shows how to import utilities, components, and configuration using the configured path aliases (@/components, @/lib, @/lib/utils, @/hooks). Use these aliases in apps/www code to avoid relative import paths. ```typescript // Utility imports import { cn } from "@/lib/utils" // Component imports import { Button } from "@/components/ui/button" // Configuration imports import { siteConfig } from "@/lib/config" ``` -------------------------------- ### Navigate to Project Directory (cd ui) Source: https://deepwiki.com/creativetimofficial/ui/2.2-development-environment-setup Changes the current directory to the cloned repository's root folder. ```bash cd ui ``` -------------------------------- ### Fetch documentation for LLM integration Source: https://deepwiki.com/creativetimofficial/ui/5.6-api-routes Fetches documentation content in raw markdown for LLM processing. The response is suitable for context injection or AI tools. ```bash # Fetch documentation for AI processing curl https://creative-tim.com/ui/llm/docs/installation # Fetch specific guide curl https://creative-tim.com/ui/llm/docs/components/button ``` -------------------------------- ### Add a New Component Workflow Source: https://deepwiki.com/creativetimofficial/ui/3.2-development-workflows Workflow for adding a new component: create a feature branch, edit registry and documentation files, build the registry, commit with a conventional message, and push to open a PR. ```bash # Create feature branch git checkout -b feat/add-new-component # Make changes to registry files # Edit apps/www/registry/creative-tim/ui/new-component.tsx # Build registry pnpm build:registry # Add documentation # Edit apps/www/content/docs/components/new-component.mdx # Commit with conventional format git add . git commit -m "feat(components): add new component with variants" # Push and create PR git push origin feat/add-new-component ``` -------------------------------- ### Configure API Key in .env.local Source: https://deepwiki.com/creativetimofficial/ui/2.1-installation-methods Create a .env.local file in your project root and add your API key. The CLI automatically reads this environment variable when making authenticated requests. ```plaintext API_KEY=your_api_key_here ``` -------------------------------- ### Build Process Diagram Source: https://deepwiki.com/creativetimofficial/ui/4.3-component-distribution Mermaid diagram illustrating the build process: components in the registry are processed to generate JSON files in public/r/. ```mermaid graph LR Registry["registry/creative-tim/ui/"] Button["button.tsx"] Card["card.tsx"] Private["testimonials-03.tsx"] BuildProcess["Build Process"] ButtonJSON["public/r/button.json"] CardJSON["public/r/card.json"] PrivateJSON["public/r/testimonials-03.json"] Registry --> Button Registry --> Card Registry --> Private Button --> BuildProcess Card --> BuildProcess Private --> BuildProcess BuildProcess --> ButtonJSON BuildProcess --> CardJSON BuildProcess --> PrivateJSON ``` -------------------------------- ### Build Registry with pnpm build:registry Source: https://deepwiki.com/creativetimofficial/ui/4.2-component-development Command to build the component registry, generating JSON output. ```bash pnpm build:registry ``` -------------------------------- ### Direct API request with authentication headers Source: https://deepwiki.com/creativetimofficial/ui/5.6-api-routes Shows three ways to authenticate a direct API request: Authorization header, X-API-Key header, or query parameter. Replace your_api_key_here with your actual key. ```bash # Using Authorization header curl -H "Authorization: Bearer your_api_key_here" \ https://creative-tim.com/ui/api/r/testimonials-03 # Using X-API-Key header curl -H "X-API-Key: your_api_key_here" \ https://creative-tim.com/ui/api/r/testimonials-04 # Using query parameter curl "https://creative-tim.com/ui/api/r/testimonials-03?token=your_api_key_here" ``` -------------------------------- ### Mermaid diagram: Monorepo configuration file structure Source: https://deepwiki.com/creativetimofficial/ui/3.1-monorepo-organization Shows the relationships between root and app-level configuration files in the monorepo. Root package.json defines workspace scripts, pnpm-workspace.yaml declares workspace packages, turbo.json configures the build pipeline, and apps/www/package.json declares app dependencies. ```mermaid graph TB subgraph "Root Configuration" PkgRoot["package.json
Workspace root"] PnpmWS["pnpm-workspace.yaml
Workspace definition"] TurboJSON["turbo.json
Build pipeline"] end subgraph "apps/www Configuration" PkgWWW["apps/www/package.json
App dependencies"] NextConfig["apps/www/next.config.mjs
Next.js settings"] TSConfig["apps/www/tsconfig.json
TypeScript config"] Components["apps/www/components.json
shadcn/ui config"] end PkgRoot -.->|defines| PnpmWS PkgRoot -.->|references| TurboJSON PnpmWS -.->|includes| PkgWWW ``` -------------------------------- ### Mermaid diagram: Build artifacts and commands in apps/www Source: https://deepwiki.com/creativetimofficial/ui/3.1-monorepo-organization Shows the relationship between pnpm build commands and the resulting artifacts in the apps/www workspace, including .next/, out/, .contentlayer/, and public/r/. ```mermaid graph LR subgraph "apps/www Artifacts" NextOut[".next/
Build cache"] StaticOut["out/
Static export"] ContentCache[".contentlayer/
Content data"] RegistryOut["public/r/
Registry JSON"] end Build["pnpm build"] --> NextOut Build --> StaticOut Build --> ContentCache BuildReg["pnpm build:registry"] --> RegistryOut ``` -------------------------------- ### Theme Initialization Script Sequence Diagram Source: https://deepwiki.com/creativetimofficial/ui/5.1-application-structure Sequence diagram illustrating the theme initialization script's flow: it reads theme and layout from localStorage and applies dark mode meta theme color or layout class to the DOM before rendering. ```mermaid sequenceDiagram participant Browser participant InlineScript participant localStorage participant DOM Browser->>InlineScript: Execute in InlineScript->>localStorage: Read theme alt theme is 'dark' or system prefers dark InlineScript->>DOM: Set theme-color meta to dark end InlineScript->>localStorage: Read layout alt layout exists InlineScript->>DOM: Add layout-* class to end ``` -------------------------------- ### Component Development Workflow Diagram (Mermaid) Source: https://deepwiki.com/creativetimofficial/ui/4.2-component-development A Mermaid flowchart illustrating the step-by-step process for developing components in the registry. It shows the sequence from creating component files through implementation, styling, metadata definition, preview testing, documentation updates, building the registry, validating JSON output, and committing changes. ```mermaid graph TD Create["Create Component Files"] --> Implement["Implement Component Logic"] Implement --> Style["Apply Styling"] Style --> Metadata["Define Component Metadata"] Metadata --> Preview["Test in Preview Route"] Preview --> Docs["Update Documentation"] Docs --> Build["Run pnpm build:registry"] Build --> Validate["Validate JSON Output"] Validate --> Commit["Commit Changes"] ``` -------------------------------- ### Preview page integration with registry components Source: https://deepwiki.com/creativetimofficial/ui/5.5-component-preview-system Diagram showing the dependencies of the preview page (view/[name]/page.tsx) on registry functions (getRegistryItem, getRegistryComponent), registry data (generated index, registryItemSchema), and configuration utilities (siteConfig, cn(), absoluteUrl()). ```mermaid graph LR PreviewPage["view/[name]/page.tsx"] subgraph "Registry Functions" GetItem["getRegistryItem(name)"] GetComponent["getRegistryComponent(name)"] end subgraph "Registry Data" Index["registry/__index__.tsx
Generated Index"] Schema["registryItemSchema
Zod Validation"] end subgraph "Configuration" SiteConfig["lib/config.ts
siteConfig"] Utils["lib/utils.ts
cn(), absoluteUrl()"] end PreviewPage --> GetItem PreviewPage --> GetComponent PreviewPage --> Index PreviewPage --> Schema PreviewPage --> SiteConfig PreviewPage --> Utils ``` -------------------------------- ### Mermaid diagram of configuration files and IDE integration Source: https://deepwiki.com/creativetimofficial/ui/2.2-development-environment-setup A Mermaid graph showing how configuration files (.editorconfig, .gitignore, .prettierrc.json, .eslintrc.json) integrate with IDEs (VS Code, WebStorm, Other IDEs) and enforce standards like UTF-8 encoding, LF line endings, 2-space indentation, trailing whitespace trimming, and final newline. ```mermaid graph TB subgraph ConfigFiles["Configuration Files"] Editor[".editorconfig"] Git[".gitignore"] Prettier[".prettierrc.json"] ESLint[".eslintrc.json"] end subgraph IDEIntegration["IDE Integration"] VSCode["VS Code"] WebStorm["WebStorm"] OtherIDE["Other IDEs"] end subgraph EnforcedStandards["Enforced Standards"] Charset["UTF-8 encoding"] EOL["LF line endings"] Indent["2-space indentation"] Trailing["Trim trailing whitespace"] FinalNewline["Final newline"] end Editor --> VSCode Editor --> WebStorm Editor --> OtherIDE VSCode --> Charset VSCode --> EOL VSCode --> Indent VSCode --> Trailing VSCode --> FinalNewline ``` -------------------------------- ### Static asset prefix from environment variable Source: https://deepwiki.com/creativetimofficial/ui/5.2-landing-and-marketing-pages Reads the NEXT_PUBLIC_ASSET_PREFIX environment variable to support CDN delivery of static assets. Applied to all logo image sources, allowing assets to be served from different domains or CDN paths without code changes. ```javascript const assetPrefix = process.env.NEXT_PUBLIC_ASSET_PREFIX ``` -------------------------------- ### Complete .kodiak.toml Structure Source: https://deepwiki.com/creativetimofficial/ui/8.5-automated-pr-management Complete configuration file for Kodiak bot. Sets merge behavior including automerge label, squash method, branch deletion, and message formatting. ```toml version = 1 [merge] automerge_label = "automerge" require_automerge_label = true method = "squash" delete_branch_on_merge = true optimistic_updates = false prioritize_ready_to_merge = true notify_on_conflict = true [merge.message] title = "pull_request_title" body = "pull_request_body" include_pr_number = true body_type = "markdown" strip_html_comments = true ``` -------------------------------- ### Load logo with NEXT_PUBLIC_ASSET_PREFIX Source: https://deepwiki.com/creativetimofficial/ui/5.2-landing-and-marketing-pages Uses the NEXT_PUBLIC_ASSET_PREFIX environment variable to construct the image source for CDN support. The img tag applies the h-7 w-auto classes for sizing. ```jsx const assetPrefix = process.env.NEXT_PUBLIC_ASSET_PREFIX OpenAI ``` -------------------------------- ### Update Documentation Workflow Source: https://deepwiki.com/creativetimofficial/ui/3.2-development-workflows Workflow for updating documentation: create a docs branch, edit MDX files, commit with a conventional docs message, and push to open a PR. ```bash # Create docs branch git checkout -b docs/update-installation # Edit documentation # Edit apps/www/content/docs/**/*.mdx # Commit git add . git commit -m "docs(installation): clarify pnpm requirements" # Push and create PR git push origin docs/update-installation ``` -------------------------------- ### Build-time static generation flow (Mermaid) Source: https://deepwiki.com/creativetimofficial/ui/5.5-component-preview-system Mermaid diagram illustrating the build-time flow: Next.js calls generateStaticParams(), loads the registry index, filters items, and generates static pages for each component preview, outputting to the .next/ directory. ```mermaid graph TB BuildStart["Next.js Build Phase"] CallGenerate["Call generateStaticParams()"] LoadIndex["Load registry/__index__"] FilterItems["Filter registry items"] GeneratePages["Generate static pages"] BuildStart --> CallGenerate CallGenerate --> LoadIndex LoadIndex --> FilterItems FilterItems --> Page1["view/button-01/page.html"] FilterItems --> Page2["view/card-03/page.html"] FilterItems --> PageN["view/testimonial-02/page.html"] Page1 --> GeneratePages Page2 --> GeneratePages PageN --> GeneratePages GeneratePages --> BuildOutput[".next/ directory"] ``` -------------------------------- ### CI/CD Pipeline with GitHub Actions and Kodiak Source: https://deepwiki.com/creativetimofficial/ui/8-development-infrastructure Mermaid diagram illustrating the pull request workflow, including lint, type check, and build steps in GitHub Actions, and the Kodiak bot auto-merge process with the 'automerge' label. ```mermaid graph LR subgraph "Pull Request" PR["Pull Request"] Label["'automerge' label"] end subgraph "GitHub Actions CI" Lint["Lint Check
ESLint validation"] Type["Type Check
TypeScript validation"] Build["Build
Next.js compilation"] end subgraph "Kodiak Bot" Config[".kodiak.toml
Merge Strategy"] Merge["Auto-merge"] end subgraph "Requirements" R1["✓ CI passes"] R2["✓ Reviews approved"] R3["✓ 'automerge' label"] end PR --> Lint PR --> Type PR --> Build Lint --> R1 Type --> R1 Build --> R1 PR --> Label Label --> R3 R1 --> Config R2 --> Config R3 --> Config Config --> Merge ``` -------------------------------- ### Root Directory Structure Tree Source: https://deepwiki.com/creativetimofficial/ui/3.1-monorepo-organization Shows the top-level monorepo layout with apps/, packages/, and configuration files. Use to understand the separation between the primary Next.js application and reusable packages. ```text ├── apps/ │ └── www/ # Primary Next.js application ├── packages/ # Additional workspace packages (gitignored) ├── .gitignore # Root-level ignore patterns ├── .turbo/ # Turborepo cache (gitignored) ├── .contentlayer/ # Generated content cache (gitignored) ├── node_modules/ # Shared dependencies ├── .pnpm-store/ # pnpm store (gitignored) └── pnpm-workspace.yaml # Workspace configuration ``` -------------------------------- ### Build Output JSON Structure Source: https://deepwiki.com/creativetimofficial/ui/4.2-component-development Shows the standardized JSON structure generated by the build process for each component. Includes name, type, files, dependencies, and registryDependencies fields. ```json { "name": "component-name", "type": "registry:ui", "files": ["registry/creative-tim/ui/component-name.tsx"], "dependencies": ["package-name"], "registryDependencies": ["other-component"] } ``` -------------------------------- ### Registry distribution flow diagram Source: https://deepwiki.com/creativetimofficial/ui/1-overview Mermaid diagram illustrating the registry distribution flow: source component files are processed by `pnpm build:registry` to generate JSON files, which are then consumed by the CLI command `npx @creative-tim/ui add button` to copy the component into the user's project. ```mermaid graph LR Source["apps/www/registry/creative-tim/ui/button.tsx"] BuildStep["pnpm build:registry"] JSON["public/r/button.json"] CLI["npx @creative-tim/ui add button"] UserProject["user-project/components/ui/button.tsx"] Source -->|"processes"| BuildStep BuildStep -->|"generates"| JSON JSON -->|"consumed by"| CLI CLI -->|"copies to"| UserProject ``` -------------------------------- ### File system layout summary Source: https://deepwiki.com/creativetimofficial/ui/4.1-registry-architecture Shows the complete directory layout of the registry architecture within the monorepo, including source components, generated JSON artifacts, API routes, and shadcn/ui configuration. ```text apps/www/ ├── registry/ # Source components │ └── creative-tim/ │ ├── blocks/ # Block components │ └── ui/ # UI components ├── public/ │ └── r/ # Generated JSON artifacts │ ├── button.json │ ├── card.json │ └── *.json ├── app/ │ └── api/ │ └── r/ │ └── [name]/ │ └── route.ts # Private component API └── components.json # shadcn/ui configuration ``` -------------------------------- ### apps/www Directory Structure (Mermaid) Source: https://deepwiki.com/creativetimofficial/ui/3.1-monorepo-organization Mermaid diagram of the apps/www directory, showing the app/, components/, content/, registry/, and public/ subdirectories and their relationships. Use to understand the Next.js application layout. ```mermaid graph TB subgraph "apps/www" App["app/
Next.js App Router"] Components["components/
React Components"] Content["content/
MDX Documentation"] Registry["registry/
Component Source"] Public["public/
Static Assets"] subgraph "registry/" RegCT["creative-tim/
Component Styles"] RegBlocks["creative-tim/blocks/
Block Components"] RegUI["creative-tim/ui/
UI Components"] RegExample["creative-tim/example/
Example Code"] end subgraph "app/" AppRoutes["(app)/
Main Route Group"] ViewRoutes["(view)/
Preview Route Group"] API["api/
API Routes"] end Registry --> RegCT RegCT --> RegBlocks RegCT --> RegUI RegCT --> RegExample App --> AppRoutes App --> ViewRoutes App --> API end ``` -------------------------------- ### Metadata generation flow for preview pages Source: https://deepwiki.com/creativetimofficial/ui/5.5-component-preview-system Flowchart showing how the preview page generates Open Graph and Twitter Card metadata. It extracts the component name from params, fetches the cached registry item, and returns an empty object if the item does not exist; otherwise it builds a metadata object with OpenGraph and Twitter Card fields. ```mermaid graph TB GenMeta["generateMetadata({params})"] ExtractName["Extract name from params"] FetchItem["getCachedRegistryItem(name)"] CheckItem{"Item exists?"} EmptyMeta["Return {}"] BuildMeta["Build Metadata object"] OGMeta["OpenGraph:
title, description, type,
url, images"] TwitterMeta["Twitter Card:
card, title, description,
images, creator"] GenMeta --> ExtractName ExtractName --> FetchItem FetchItem --> CheckItem CheckItem -->|"No"| EmptyMeta CheckItem -->|"Yes"| BuildMeta BuildMeta --> OGMeta BuildMeta --> TwitterMeta ``` -------------------------------- ### Clone Repository (git clone) Source: https://deepwiki.com/creativetimofficial/ui/2.2-development-environment-setup Clones the forked repository to your local machine using the provided URL. Replace YOUR_USERNAME with your GitHub username. ```bash git clone https://github.com/YOUR_USERNAME/ui.git ``` -------------------------------- ### Mermaid diagram of gitignored build artifacts and environment files Source: https://deepwiki.com/creativetimofficial/ui/3-repository-architecture Mermaid graph showing which directories are version controlled versus gitignored build artifacts and environment files, with arrows indicating the build relationships from source code to .next, out, .turbo, and .contentlayer. ```mermaid graph TB subgraph "Version Controlled" Source["Source Code
(apps/www/*)"] end subgraph "Build Artifacts (Gitignored)" NodeMods["node_modules
(.gitignore:4)"] NextDir[".next/
(.gitignore:13)"] OutDir["out/
(.gitignore:14)"] TurboDir[".turbo
(.gitignore:40)"] ContentlayerDir[".contentlayer
(.gitignore:42)"] PackagesDir["packages/*
(.gitignore:51)"] end subgraph "Environment Files (Gitignored)" EnvLocal[".env.local
(.gitignore:34)"] EnvDev[".env.development.local
(.gitignore:35)"] EnvTest[".env.test.local
(.gitignore:36)"] EnvProd[".env.production.local
(.gitignore:37)"] end Source -->|"builds to"| NextDir Source -->|"exports to"| OutDir Source -->|"caches in"| TurboDir Source -->|"processes to"| ContentlayerDir ``` -------------------------------- ### Mermaid Diagram of pnpm and Turborepo Workflow Source: https://deepwiki.com/creativetimofficial/ui/2.2-development-environment-setup A Mermaid graph showing how pnpm commands map to Turborepo tasks and the apps/www workspace outputs. Useful for understanding the build pipeline. ```mermaid graph LR subgraph Commands["pnpm Commands"] Dev["pnpm dev"] Build["pnpm build"] BuildRegistry["pnpm build:registry"] Filter["pnpm --filter=WORKSPACE"] end subgraph Turborepo["Turborepo
turbo.json"] Pipeline["pipeline configuration"] Cache["task caching"] Deps["dependency graph"] end subgraph WWWWorkspace["apps/www workspace"] NextDev["next dev"] NextBuild["next build"] RegistryScript["scripts/build-registry.mts"] ContentlayerBuild["contentlayer build"] end Dev --> Turborepo Build --> Turborepo BuildRegistry --> Turborepo Filter --> Turborepo Turborepo --> Pipeline Pipeline --> NextDev Pipeline --> NextBuild Pipeline --> RegistryScript Pipeline --> ContentlayerBuild NextDev -.->|"output"| DevServer["localhost:3000"] NextBuild -.->|"output"| NextOutput[".next/"] RegistryScript -.->|"output"| RegistryJSON["public/r/*.json"] ContentlayerBuild -.->|"output"| ContentlayerDir[".contentlayer/"] ``` -------------------------------- ### Local Development Testing Workflow Diagram Source: https://deepwiki.com/creativetimofficial/ui/4.2-component-development Mermaid flowchart showing the local development testing loop: edit component, run pnpm dev, view in browser, navigate to /view/component-name, inspect and debug, then repeat. ```mermaid graph LR Edit["Edit Component"] --> Dev["pnpm dev"] Dev --> Browser["View in Browser"] Browser --> Preview["Navigate to /view/component-name"] Preview --> Inspect["Inspect & Debug"] Inspect --> Edit ``` -------------------------------- ### File path construction Source: https://deepwiki.com/creativetimofficial/ui/5.6-api-routes Constructs the file path for the component JSON file in the public/r directory. ```javascript path.join(process.cwd(), "public", "r", `${componentName}.json`) ``` -------------------------------- ### Component and User className with cn() Source: https://deepwiki.com/creativetimofficial/ui/6.2-tailwind-and-component-styling Shows how components accept a className prop and use cn() to merge classes, with user classes applied last for precedence. ```jsx // Component implementation