# huntabyte/shadcn-svelte architecture

> Architecture diagram of the GitHub repository huntabyte/shadcn-svelte, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/huntabyte/shadcn-svelte
- Repository: https://github.com/huntabyte/shadcn-svelte

## Overview

##### Project type and purpose
- This is an open-source, community-led component library monorepo with three main deliverables:
– packages/cli: a command-line tool to scaffold and update Svelte component projects
– packages (implicit): the shared shadcn-svelte component registry (under sites/docs/src/lib/registry)
– sites/docs: a SvelteKit documentation site (and playgrounds) showcasing components
- Additional “playground” apps under /playgrounds allow live testing of components in JS and TS.

##### File structure
- Top-level directories:
– packages/cli: CLI entrypoint, commands, utils, templates, tests, build config
– playgrounds/*: two sample SvelteKit apps consuming the components in JS & TS
– sites/docs: SvelteKit docs site with MDsX content, registry files, static assets, scripts, tests, build configs
– .github/workflows: CI, release, preview deploys, reproduction workflows
– pnpm-workspace.yaml: monorepo dependency management via pnpm
- Architectural patterns:
– Monorepo with isolated package (CLI) and a docs site that imports the shared registry
– The component registry follows a directory structure by “style” (default, new-york) and type (block, example, ui)
– SvelteKit for server-side route generation in docs site
- Config files: pnpm-lock.yaml, package.json, tsconfig.json, eslint.config.js, Prettier, Vite, Tailwind, Svelte configs

##### README for additional insights
- Project description: “Unofficial community-led Svelte port of shadcn/ui”
- CLI exists to help users copy & paste components into their own apps
- Docs site runs on SvelteKit (routes, content, registry modules)
- Continuous integration and deployment via GitHub Actions

## Diagram (Mermaid)

```mermaid
graph TD
  %% Monorepo Root
  subgraph "Monorepo Root" 
    direction TB
    PNPM["pnpm-workspace.yaml"]:::internal
    RootConfigs["Root Configs"]:::internal
    subgraph "CLI Package"
      direction TB
      CLI["CLI Package"]:::service
      Index["src/index.ts"]:::internal
      Commands["src/commands"]:::internal
      Utils["src/utils"]:::internal
      TestsCLI["test"]:::internal
    end
    subgraph "Component Registry Library"
      direction TB
      Registry["Registry Library"]:::service
      Schema["schema.ts"]:::internal
      Styles["styles.ts"]:::internal
      Themes["themes.ts"]:::internal
      DefaultStyle["default"]:::internal
      NewYorkStyle["new-york"]:::internal
    end
    subgraph "Documentation Site"
      direction TB
      Docs["Docs Site"]:::service
      Content["src/content"]:::internal
      MDXConfig["mdsx.config.js"]:::internal
      Routes["src/routes"]:::internal
      Scripts["scripts"]:::internal
      Components["src/lib/components"]:::internal
      Blocks["src/lib/blocks.ts"]:::internal
      TestsDocs["tests"]:::internal
    end
    subgraph "Playground Apps"
      direction TB
      subgraph "Playground JS"
        PJ["playground-js"]:::service
        PJSrc["src"]:::internal
        PJConfig["package.json / vite.config.js / svelte.config.js"]:::internal
      end
      subgraph "Playground TS"
        PT["playground-ts"]:::service
        PTSrc["src"]:::internal
        PTConfig["package.json / vite.config.ts / tsconfig.json"]:::internal
      end
    end
  end

  %% External Services
  GitHub["GitHub"]:::external
  NPM["NPM Registry"]:::external
  CI["GitHub Actions (CI/CD)"]:::pipeline
  Vercel["Vercel Hosting"]:::external
  Discord["Discord Community"]:::external

  %% Relationships
  CLI -->|"reads templates from"| Registry
  CLI -->|"generates files in user project"| UserProject["User Project"]
  CLI -->|"publishes CLI package to"| NPM
  Registry -->|"imported by"| Docs
  Registry -->|"imported by"| PJ
  Registry -->|"imported by"| PT
  Docs -->|"deploy preview/prod via"| Vercel
  GitHub -->|"hosts source & triggers workflows"| CI
  CI -->|"build & test CLI & Docs"| CLI
  CI -->|"build & test CLI & Docs"| Docs
  CI -->|"deploy docs"| Vercel
  GitHub -->|"issue tracking & community chats"| Discord

  %% Click Events
  click CLI "https://github.com/huntabyte/shadcn-svelte/tree/main/packages/cli"
  click Index "https://github.com/huntabyte/shadcn-svelte/blob/main/packages/cli/src/index.ts"
  click Commands "https://github.com/huntabyte/shadcn-svelte/tree/main/packages/cli/src/commands"
  click Utils "https://github.com/huntabyte/shadcn-svelte/tree/main/packages/cli/src/utils"
  click TestsCLI "https://github.com/huntabyte/shadcn-svelte/tree/main/packages/cli/test"
  click Registry "https://github.com/huntabyte/shadcn-svelte/tree/main/sites/docs/src/lib/registry"
  click Schema "https://github.com/huntabyte/shadcn-svelte/blob/main/sites/docs/src/lib/registry/schema.ts"
  click Styles "https://github.com/huntabyte/shadcn-svelte/blob/main/sites/docs/src/lib/registry/styles.ts"
  click Themes "https://github.com/huntabyte/shadcn-svelte/blob/main/sites/docs/src/lib/registry/themes.ts"
  click DefaultStyle "https://github.com/huntabyte/shadcn-svelte/tree/main/sites/docs/src/lib/registry/default"
  click NewYorkStyle "https://github.com/huntabyte/shadcn-svelte/tree/main/sites/docs/src/lib/registry/new-york"
  click Docs "https://github.com/huntabyte/shadcn-svelte/tree/main/sites/docs"
  click Content "https://github.com/huntabyte/shadcn-svelte/tree/main/sites/docs/src/content"
  click MDXConfig "https://github.com/huntabyte/shadcn-svelte/blob/main/sites/docs/mdsx.config.js"
  click Routes "https://github.com/huntabyte/shadcn-svelte/tree/main/sites/docs/src/routes"
  click Scripts "https://github.com/huntabyte/shadcn-svelte/tree/main/sites/docs/scripts"
  click Components "https://github.com/huntabyte/shadcn-svelte/tree/main/sites/docs/src/lib/components"
  click Blocks "https://github.com/huntabyte/shadcn-svelte/blob/main/sites/docs/src/lib/blocks.ts"
  click TestsDocs "https://github.com/huntabyte/shadcn-svelte/tree/main/sites/docs/tests"
  click PJ "https://github.com/huntabyte/shadcn-svelte/tree/main/playgrounds/playground-js"
  click PJSrc "https://github.com/huntabyte/shadcn-svelte/tree/main/playgrounds/playground-js/src"
  click PJConfig "https://github.com/huntabyte/shadcn-svelte/blob/main/playgrounds/playground-js/package.json"
  click PT "https://github.com/huntabyte/shadcn-svelte/tree/main/playgrounds/playground-ts"
  click PTSrc "https://github.com/huntabyte/shadcn-svelte/tree/main/playgrounds/playground-ts/src"
  click PTConfig "https://github.com/huntabyte/shadcn-svelte/blob/main/playgrounds/playground-ts/package.json"
  click CI "https://github.com/huntabyte/shadcn-svelte/blob/main/.github/workflows/ci.yml"
  click CI "https://github.com/huntabyte/shadcn-svelte/blob/main/.github/workflows/build-preview.yml"
  click CI "https://github.com/huntabyte/shadcn-svelte/blob/main/.github/workflows/deploy-preview.yml"
  click CI "https://github.com/huntabyte/shadcn-svelte/blob/main/.github/workflows/deploy-prod.yml"
  click CI "https://github.com/huntabyte/shadcn-svelte/blob/main/.github/workflows/release.yml"
  click CI "https://github.com/huntabyte/shadcn-svelte/blob/main/.github/workflows/reproduire.yml"
  click PNPM "https://github.com/huntabyte/shadcn-svelte/blob/main/pnpm-workspace.yaml"
  click RootConfigs "https://github.com/huntabyte/shadcn-svelte/blob/main/package.json"
  classDef internal fill:#f9f,stroke:#333,stroke-width:1px
  classDef service fill:#bbf,stroke:#333,stroke-width:1px
  classDef external fill:#bfb,stroke:#333,stroke-width:1px
  classDef pipeline fill:#fbf,stroke:#333,stroke-width:1px
```
