# rei/rei-cedar architecture

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

- Interactive diagram: https://gitdiagram.com/rei/rei-cedar
- Repository: https://github.com/rei/rei-cedar

## Overview

##### Project type and purpose
- This is a front-end UI component library and style framework (“REI Cedar”) meant to provide reusable Vue components, SCSS variables, mixins, utilities, docs, demos, and a publishing pipeline.
- It is not a full-stack app; it is a client-side component framework with build, test, dev-preview, documentation, and CI/CD.

##### File structure
- Top-level:
- src/           ← Vue components, styles, utilities, types, mixins, props
- build/         ← custom build scripts (copy-css, transfer variables)
- templates/     ← component scaffolding templates
- public/, index.html ← dev/demo static assets
- vite.config*/ rollupOptions.mjs ← bundler configurations
- test/, playwright.config.ts ← unit and E2E/a11y tests
- .github/workflows ← CI jobs (node.js, deploy, pages, playwright)
- generator.js, docgen*.mjs ← API documentation generators
- package.json ← scripts (dev, unit, test, prerelease, changelog)
- Patterns:
- “src/components” subtree organized by component name, each with .vue + styles + tests + examples
- CSS modules + SCSS variable files under “styles/vars”
- A “dev” sandbox (src/dev) that runs a Vite-powered local preview
- Build outputs under “build/” and “dist/” via Rollup/Vite UMD and ESM configs

##### README
- Confirms it’s a style framework and component library
- Describes dev server, unit tests, Playwright E2E/a11y tests, publishing via npm with prerelease tags
- Mentions a separate docs site and GitHub Pages demo

##### Main components
a. Source modules
- Vue component modules (src/components)
- SCSS styles & variables (src/styles, component-level “styles/vars”)
- Utilities, mixins, props, types (src/utils, src/mixins, src/props, src/types)
b. Build & Bundling
- Build scripts (build/*.js, docgen.mjs, generator.js)
- Bundler configs (vite.config.ts, vite.umd.config.ts, rollupOptions.mjs)
- Output: ESM, UMD packages, CSS outputs in build/ or dist/
c. Developer Experience
- Dev sandbox (src/dev + public/index.html) → hot-reload server (npm run dev)
- Component examples in each folder
d. Testing
- Unit tests (jest/vue-jest in src/components/**/__tests__)
- E2E & accessibility tests (Playwright under test/playwright)
e. Documentation & Demos
- Doc generators (docgen-scss.mjs, docgen.mjs, lint-report-generator.mjs)
- GitHub Pages demo (deploy.js.yml, pages.yml)
- Separate Cedar docs site (external)
f. CI/CD & Publishing
- GitHub Actions workflows for build, test, deploy to npm (prerelease), pages, Playwright
- npm scripts (npm run unit, test, prerelease, changelog)

##### Relationships and interactions
- Flow of raw source → build pipeline → bundled artifacts → npm registry
- Source feeds tests (unit & E2E) and doc generators
- Dev sandbox pulls from source and bundler for live preview
- CI pipelines trigger tests → build → publish/demo site
- External services: GitHub Actions, npm registry, GitHub Pages, external docs site

##### Architectural patterns & design principles
- Modular component design grouping code, styles, tests, examples
- Separation of concerns: components / styles / utilities / build / tests / docs
- Convention-over-configuration: folder naming for templates and generators
- CI as code: GitHub Actions orchestrating quality, build, and publish
- Theme/variable driven styling via SCSS variable architecture

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Source Layer"
        SC["src/components"]:::source
        SS["src/styles"]:::source
        SU["src/utils"]:::source
        SMX["src/mixins"]:::source
        SP["src/props"]:::source
        ST["src/types"]:::source
        TMP["templates"]:::source
    end

    subgraph "Build Layer"
        BS["Build Scripts"]:::build
        BC["Bundler Configs"]:::build
        PC["postcss.config.js"]:::build
        BT["browserTargets.mjs"]:::build
    end

    subgraph "Output Layer"
        OUT["build/ & dist/"]:::output
    end

    subgraph "Dev & Docs Layer"
        DEV["Dev Sandbox (src/dev + public/index.html)"]:::dev
        DOCGEN["Doc Generators"]:::dev
        PUB["public/ + index.html"]:::dev
    end

    subgraph "Testing Layer"
        UT["Unit Tests"]:::test
        E2E["E2E & A11y Tests"]:::test
    end

    subgraph "CI/CD Layer"
        CI["GitHub Actions Workflows"]:::ci
        NP["npm registry"]:::external
        GH["GitHub Pages"]:::external
        ED["External Docs Site"]:::external
    end

    SC -->|feeds| BS
    SS -->|feeds| BS
    SU -->|feeds| BS
    SMX -->|feeds| BS
    SP -->|feeds| BS
    ST -->|feeds| BS
    TMP -->|templates source| SC

    BS -->|builds into| OUT
    BC -->|configures| OUT
    PC -->|postcss config| OUT
    BT -->|browser targets| OUT

    SC -->|tested by| UT
    SC -->|tested by| E2E

    OUT -->|served to| DEV
    SC -->|hot-reload| DEV

    BS -->|generate docs| DOCGEN
    SS -->|styles for| DOCGEN
    DOCGEN -->|outputs| PUB
    DOCGEN -->|outputs| ED

    CI -->|runs| UT
    CI -->|runs| E2E
    CI -->|invokes| BS
    CI -->|invokes| DOCGEN
    CI -->|publishes| NP
    CI -->|deploys| GH

    classDef source fill:#cce5ff,stroke:#004085
    classDef build fill:#d4edda,stroke:#155724
    classDef output fill:#e2e3e5,stroke:#6c757d
    classDef dev fill:#fff3cd,stroke:#856404
    classDef test fill:#ffe5b4,stroke:#e69500
    classDef ci fill:#f8d7da,stroke:#721c24
    classDef external fill:#d1ecf1,stroke:#0c5460

    click SC "https://github.com/rei/rei-cedar/tree/main/src/components/"
    click SS "https://github.com/rei/rei-cedar/tree/main/src/styles/"
    click SU "https://github.com/rei/rei-cedar/tree/main/src/utils/"
    click SMX "https://github.com/rei/rei-cedar/tree/main/src/mixins/"
    click SP "https://github.com/rei/rei-cedar/tree/main/src/props/"
    click ST "https://github.com/rei/rei-cedar/tree/main/src/types/"
    click TMP "https://github.com/rei/rei-cedar/tree/main/templates/"
    click BS "https://github.com/rei/rei-cedar/blob/main/build/copy-css.js"
    click BS "https://github.com/rei/rei-cedar/blob/main/build/component-variables-transfer.js"
    click BS "https://github.com/rei/rei-cedar/blob/main/docgen-scss.mjs"
    click BS "https://github.com/rei/rei-cedar/blob/main/docgen.mjs"
    click BS "https://github.com/rei/rei-cedar/blob/main/generator.js"
    click BS "https://github.com/rei/rei-cedar/blob/main/lint-report-generator.mjs"
    click BC "https://github.com/rei/rei-cedar/blob/main/vite.config.ts"
    click BC "https://github.com/rei/rei-cedar/blob/main/vite.umd.config.ts"
    click BC "https://github.com/rei/rei-cedar/blob/main/rollupOptions.mjs"
    click PC "https://github.com/rei/rei-cedar/blob/main/postcss.config.js"
    click BT "https://github.com/rei/rei-cedar/blob/main/browserTargets.mjs"
    click OUT "https://github.com/rei/rei-cedar/tree/main/build/"
    click UT "https://github.com/rei/rei-cedar/tree/main/src/components/**/__tests__/"
    click UT "https://github.com/rei/rei-cedar/blob/main/test/vue-jest-style-workaround.js"
    click E2E "https://github.com/rei/rei-cedar/tree/main/test/playwright/"
    click E2E "https://github.com/rei/rei-cedar/blob/main/playwright.config.ts"
    click CI "https://github.com/rei/rei-cedar/blob/main/.github/workflows/node.js.yml"
    click CI "https://github.com/rei/rei-cedar/blob/main/.github/workflows/deploy.js.yml"
    click CI "https://github.com/rei/rei-cedar/blob/main/.github/workflows/pages.yml"
    click CI "https://github.com/rei/rei-cedar/blob/main/.github/workflows/playwright.yml"
    click NP "https://github.com/rei/rei-cedar/blob/main/package.json"
    click PUB "https://github.com/rei/rei-cedar/tree/main/public/"
    click PUB "https://github.com/rei/rei-cedar/blob/main/index.html"
```
