# saadeghi/daisyui architecture

> Architecture diagram of the GitHub repository saadeghi/daisyui, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-17). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/saadeghi/daisyui
- Repository: https://github.com/saadeghi/daisyui

## Overview

#### Purpose and Package Shape
This monorepo produces **daisyUI**, a Tailwind CSS component-library plugin: authored CSS components, utilities, and named themes are compiled into consumable npm/CDN bundles. It also owns the public documentation/site, interactive playground, and AI-editor skill/plugin distributions.

Primary package entry points are `packages/daisyui/index.js` for the Tailwind plugin and `packages/daisyui/build.js` for release artifact generation. Prebuilt distribution adapters live in `packages/bundle/daisyui.js` and `packages/bundle/daisyui-theme.js`.

#### CSS Source Model
The product source is declarative CSS, organized by responsibility:
- Global/base behavior: `packages/daisyui/src/base/reset.css`, `packages/daisyui/src/base/properties.css`
- Reusable component class definitions: `packages/daisyui/src/components/button.css`, `packages/daisyui/src/components/modal.css`
- Theme token definitions: `packages/daisyui/src/themes/light.css`, `packages/daisyui/src/themes/dark.css`
- General-purpose styling utilities: `packages/daisyui/src/utilities/join.css`, `packages/daisyui/src/utilities/typography.css`

These files are the primary compatibility boundary: documentation examples, generated bundles, and user Tailwind builds all depend on their class names and CSS custom-property contracts.

#### Plugin and Theme Runtime
`packages/daisyui/index.js` exposes the integration consumed by Tailwind CSS. Plugin assembly and user-option handling are separated in `packages/daisyui/functions/plugin.js` and `packages/daisyui/functions/pluginOptionsHandler.js`. Theme-specific registration is handled by `packages/daisyui/functions/themePlugin.js`.

Control flow is Tailwind configuration → daisyUI plugin/options → selected component/theme CSS and generated rules → Tailwind output. This is a Node.js/JavaScript build-time runtime, not a browser component runtime.

#### Build and Distribution Pipeline
`packages/daisyui/build.js` orchestrates source-to-package generation. It discovers CSS, compiles/extracts styles, transforms CSS into JavaScript-compatible payloads, and creates package-facing files through modules such as `packages/daisyui/functions/compileAndExtractStyles.js`, `packages/daisyui/functions/generatePlugins.js`, and `packages/daisyui/functions/createPluginFiles.js`.

The pipeline’s output boundary is the published package and the checked-in bundle adapters under `packages/bundle/`. Changes to source CSS often require regenerated plugin/bundle artifacts rather than isolated edits.

#### Documentation Application
`packages/docs` is a SvelteKit application serving documentation, component references, marketing content, store/skills pages, feeds, sitemap, and redirects. Its route root and shell are `packages/docs/src/routes/(routes)/+layout.svelte` and `packages/docs/src/routes/(routes)/+page.svelte`; SvelteKit endpoint entry points include `packages/docs/src/routes/search.csv/+server.js` and `packages/docs/src/routes/sitemap.xml/+server.js`.

Component documentation is MD(S)VEX route content, e.g. `packages/docs/src/routes/(routes)/components/button/+page.md`, and should remain synchronized with the CSS source contract.

#### Docs Content, Rendering, and Server Data
MD(S)VEX configuration and transforms govern markdown rendering, links, headings, embedded components, and syntax highlighting: `packages/docs/src/lib/mdsvex/mdsvex.config.js`, `packages/docs/src/lib/mdsvex/render-component.js`, `packages/docs/src/lib/mdsvex/highlighting/index.js`.

Server-side route loaders consume a content/data layer for catalogs, framework pages, comparisons, skills, store products, and media: `packages/docs/src/lib/server/content/catalog.js`, `packages/docs/src/lib/server/content/componentIndex.js`, `packages/docs/src/lib/server/content/store.js`. This separates filesystem/content interpretation from Svelte route presentation.

#### Ancillary Delivery Surfaces and Infrastructure
The browser playground exercises generated daisyUI styles across LTR/RTL, themes, prefixing, and demos: `packages/playground/build-daisyui.js`, `packages/playground/src/pages/main.js`. `packages/tailwind-play-share/index.mjs` supports Tailwind Play sharing/preview integration.

AI-oriented documentation is distributed as skills and editor plugins, centered on `skills/daisyui/SKILL.md`, `.claude-plugin/plugin.json`, and `.codex-plugin/plugin.json`. GitHub Actions provide test, release, documentation deployment, and Tailwind Play PR-preview automation: `.github/workflows/run-tests.yml`, `.github/workflows/release-new-version.yml`, `.github/workflows/deploy-docs.yml`.

Main entry points: [`packages/daisyui/functions/plugin.js`](https://github.com/saadeghi/daisyui/blob/master/packages/daisyui/functions/plugin.js) (Plugin assembly), [`packages/daisyui/build.js`](https://github.com/saadeghi/daisyui/blob/master/packages/daisyui/build.js) (Package build), [`packages/daisyui/src/components/button.css`](https://github.com/saadeghi/daisyui/blob/master/packages/daisyui/src/components/button.css) (Component CSS), [`packages/docs/src/routes/(routes)/components/button/+page.md`](https://github.com/saadeghi/daisyui/blob/master/packages/docs/src/routes/(routes)/components/button/%2Bpage.md) (Component docs)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_css["CSS Source"]
  node_base["Base CSS<br/>CSS sources<br/>[reset.css]"]
  node_components["Component CSS<br/>CSS sources<br/>[button.css]"]
  node_themes["Theme tokens<br/>CSS sources<br/>[light.css]"]
  node_utilities["Utility CSS<br/>CSS sources<br/>[join.css]"]
end

subgraph group_package["Plugin &amp; Distribution"]
  node_tailwind{{"Tailwind configuration<br/>consumer input"}}
  node_plugin_entry["daisyUI plugin entry<br/>Node.js entry<br/>[index.js]"]
  node_plugin_assembly["Plugin assembly<br/>plugin runtime<br/>[plugin.js]"]
  node_theme_plugin["Theme registration<br/>plugin runtime<br/>[themePlugin.js]"]
  node_tailwind_output["Tailwind CSS output<br/>generated CSS"]
  node_build["Package build<br/>Node.js build<br/>[build.js]"]
  node_compile["Style compilation<br/>build stage"]
  node_plugin_generation["Plugin file generation<br/>build stage<br/>[generatePlugins.js]"]
  node_bundle_adapter["Bundle adapter<br/>distribution adapter<br/>[daisyui.js]"]
end

subgraph group_docs["Documentation"]
  node_docs_shell["Docs route shell<br/>SvelteKit routes<br/>[+layout.svelte]"]
  node_component_docs["Component docs<br/>MD&#40;S&#41;VEX content<br/>[+page.md]"]
  node_mdsvex["MD&#40;S&#41;VEX rendering<br/>content transform<br/>[mdsvex.config.js]"]
  node_content_data[("Docs content data<br/>server content layer<br/>[catalog.js]")]
  node_docs_endpoints["Search &amp; sitemap endpoints<br/>SvelteKit endpoints<br/>[+server.js]"]
end

subgraph group_surfaces["Delivery Surfaces"]
  node_playground["Browser playground<br/>interactive app<br/>[main.js]"]
  node_ai_skill["AI editor skill<br/>editor distribution<br/>[SKILL.md]"]
  node_ci_release["Release workflow<br/>GitHub Actions"]
end

node_base -->|"registered by"| node_plugin_assembly
node_components -->|"selected CSS"| node_plugin_assembly
node_themes -->|"theme definitions"| node_theme_plugin
node_utilities -->|"selected CSS"| node_plugin_assembly
node_tailwind -->|"loads"| node_plugin_entry
node_plugin_entry -->|"configures"| node_plugin_assembly
node_plugin_assembly -->|"registers"| node_theme_plugin
node_plugin_assembly -->|"generates rules"| node_tailwind_output
node_theme_plugin -->|"generates theme rules"| node_tailwind_output
node_base -->|"build input"| node_build
node_components -->|"build input"| node_build
node_themes -->|"build input"| node_build
node_utilities -->|"build input"| node_build
node_build -->|"compiles and extracts"| node_compile
node_compile -->|"style payloads"| node_plugin_generation
node_plugin_generation -->|"writes artifacts"| node_bundle_adapter
node_components -.->|"class contract"| node_component_docs
node_component_docs -->|"rendered by"| node_mdsvex
node_mdsvex -->|"route content"| node_docs_shell
node_content_data -->|"server data"| node_docs_shell
node_content_data -->|"indexes content"| node_docs_endpoints
node_bundle_adapter -->|"generated styles"| node_playground
node_ci_release -->|"release generation"| node_build
node_component_docs -.->|"AI guidance source"| node_ai_skill

click node_base "https://github.com/saadeghi/daisyui/blob/master/packages/daisyui/src/base/reset.css"
click node_components "https://github.com/saadeghi/daisyui/blob/master/packages/daisyui/src/components/button.css"
click node_themes "https://github.com/saadeghi/daisyui/blob/master/packages/daisyui/src/themes/light.css"
click node_utilities "https://github.com/saadeghi/daisyui/blob/master/packages/daisyui/src/utilities/join.css"
click node_plugin_entry "https://github.com/saadeghi/daisyui/blob/master/packages/daisyui/index.js"
click node_plugin_assembly "https://github.com/saadeghi/daisyui/blob/master/packages/daisyui/functions/plugin.js"
click node_theme_plugin "https://github.com/saadeghi/daisyui/blob/master/packages/daisyui/functions/themePlugin.js"
click node_build "https://github.com/saadeghi/daisyui/blob/master/packages/daisyui/build.js"
click node_compile "https://github.com/saadeghi/daisyui/blob/master/packages/daisyui/functions/compileAndExtractStyles.js"
click node_plugin_generation "https://github.com/saadeghi/daisyui/blob/master/packages/daisyui/functions/generatePlugins.js"
click node_bundle_adapter "https://github.com/saadeghi/daisyui/blob/master/packages/bundle/daisyui.js"
click node_docs_shell "https://github.com/saadeghi/daisyui/blob/master/packages/docs/src/routes/(routes)/%2Blayout.svelte"
click node_component_docs "https://github.com/saadeghi/daisyui/blob/master/packages/docs/src/routes/(routes)/components/button/%2Bpage.md"
click node_mdsvex "https://github.com/saadeghi/daisyui/blob/master/packages/docs/src/lib/mdsvex/mdsvex.config.js"
click node_content_data "https://github.com/saadeghi/daisyui/blob/master/packages/docs/src/lib/server/content/catalog.js"
click node_docs_endpoints "https://github.com/saadeghi/daisyui/blob/master/packages/docs/src/routes/search.csv/%2Bserver.js"
click node_playground "https://github.com/saadeghi/daisyui/blob/master/packages/playground/src/pages/main.js"
click node_ai_skill "https://github.com/saadeghi/daisyui/blob/master/skills/daisyui/SKILL.md"
click node_ci_release "https://github.com/saadeghi/daisyui/blob/master/.github/workflows/release-new-version.yml"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_base,node_components,node_themes,node_utilities toneBlue
class node_tailwind,node_plugin_entry,node_plugin_assembly,node_theme_plugin,node_tailwind_output,node_build,node_compile,node_plugin_generation,node_bundle_adapter toneAmber
class node_docs_shell,node_component_docs,node_mdsvex,node_content_data,node_docs_endpoints toneMint
class node_playground,node_ai_skill,node_ci_release toneRose
```

## Components

### CSS Source

Shared class and token contract.

- [Base CSS](https://github.com/saadeghi/daisyui/blob/master/packages/daisyui/src/base/reset.css): CSS sources · `packages/daisyui/src/base/reset.css`
- [Component CSS](https://github.com/saadeghi/daisyui/blob/master/packages/daisyui/src/components/button.css): CSS sources · Reusable component class definitions. · `packages/daisyui/src/components/button.css`
- [Theme tokens](https://github.com/saadeghi/daisyui/blob/master/packages/daisyui/src/themes/light.css): CSS sources · `packages/daisyui/src/themes/light.css`
- [Utility CSS](https://github.com/saadeghi/daisyui/blob/master/packages/daisyui/src/utilities/join.css): CSS sources · `packages/daisyui/src/utilities/join.css`

### Plugin & Distribution

Tailwind integration and published artifacts.

- **Tailwind configuration**: consumer input
- [daisyUI plugin entry](https://github.com/saadeghi/daisyui/blob/master/packages/daisyui/index.js): Node.js entry · `packages/daisyui/index.js`
- [Plugin assembly](https://github.com/saadeghi/daisyui/blob/master/packages/daisyui/functions/plugin.js): plugin runtime · Applies user options and registers generated rules. · `packages/daisyui/functions/plugin.js`
- [Theme registration](https://github.com/saadeghi/daisyui/blob/master/packages/daisyui/functions/themePlugin.js): plugin runtime · `packages/daisyui/functions/themePlugin.js`
- **Tailwind CSS output**: generated CSS
- [Package build](https://github.com/saadeghi/daisyui/blob/master/packages/daisyui/build.js): Node.js build · Orchestrates CSS discovery and package generation. · `packages/daisyui/build.js`
- [Style compilation](https://github.com/saadeghi/daisyui/blob/master/packages/daisyui/functions/compileAndExtractStyles.js): build stage · `packages/daisyui/functions/compileAndExtractStyles.js`
- [Plugin file generation](https://github.com/saadeghi/daisyui/blob/master/packages/daisyui/functions/generatePlugins.js): build stage · `packages/daisyui/functions/generatePlugins.js`
- [Bundle adapter](https://github.com/saadeghi/daisyui/blob/master/packages/bundle/daisyui.js): distribution adapter · Checked-in package-facing bundle. · `packages/bundle/daisyui.js`

### Documentation

SvelteKit content and rendering.

- [Docs route shell](https://github.com/saadeghi/daisyui/blob/master/packages/docs/src/routes/(routes)/%2Blayout.svelte): SvelteKit routes · `packages/docs/src/routes/(routes)/+layout.svelte`
- [Component docs](https://github.com/saadeghi/daisyui/blob/master/packages/docs/src/routes/(routes)/components/button/%2Bpage.md): MD(S)VEX content · Must track the component CSS contract. · `packages/docs/src/routes/(routes)/components/button/+page.md`
- [MD(S)VEX rendering](https://github.com/saadeghi/daisyui/blob/master/packages/docs/src/lib/mdsvex/mdsvex.config.js): content transform · Transforms markdown, embeds, links, and highlighting. · `packages/docs/src/lib/mdsvex/mdsvex.config.js`
- [Docs content data](https://github.com/saadeghi/daisyui/blob/master/packages/docs/src/lib/server/content/catalog.js): server content layer · Provides catalogs, framework pages, skills, and store data. · `packages/docs/src/lib/server/content/catalog.js`
- [Search & sitemap endpoints](https://github.com/saadeghi/daisyui/blob/master/packages/docs/src/routes/search.csv/%2Bserver.js): SvelteKit endpoints · `packages/docs/src/routes/search.csv/+server.js`

### Delivery Surfaces

- [Browser playground](https://github.com/saadeghi/daisyui/blob/master/packages/playground/src/pages/main.js): interactive app · Exercises generated styles, themes, RTL, and prefixes. · `packages/playground/src/pages/main.js`
- [AI editor skill](https://github.com/saadeghi/daisyui/blob/master/skills/daisyui/SKILL.md): editor distribution · `skills/daisyui/SKILL.md`
- [Release workflow](https://github.com/saadeghi/daisyui/blob/master/.github/workflows/release-new-version.yml): GitHub Actions · `.github/workflows/release-new-version.yml`

## Connections

- Base CSS → Plugin assembly: registered by
- Component CSS → Plugin assembly: selected CSS
- Theme tokens → Theme registration: theme definitions
- Utility CSS → Plugin assembly: selected CSS
- Tailwind configuration → daisyUI plugin entry: loads
- daisyUI plugin entry → Plugin assembly: configures
- Plugin assembly → Theme registration: registers
- Plugin assembly → Tailwind CSS output: generates rules
- Theme registration → Tailwind CSS output: generates theme rules
- Base CSS → Package build: build input
- Component CSS → Package build: build input
- Theme tokens → Package build: build input
- Utility CSS → Package build: build input
- Package build → Style compilation: compiles and extracts
- Style compilation → Plugin file generation: style payloads
- Plugin file generation → Bundle adapter: writes artifacts
- Component CSS → Component docs: class contract
- Component docs → MD(S)VEX rendering: rendered by
- MD(S)VEX rendering → Docs route shell: route content
- Docs content data → Docs route shell: server data
- Docs content data → Search & sitemap endpoints: indexes content
- Bundle adapter → Browser playground: generated styles
- Release workflow → Package build: release generation
- Component docs → AI editor skill: AI guidance source
