# nirajkaushal/retroui architecture

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

- Interactive diagram: https://gitdiagram.com/nirajkaushal/retroui
- Repository: https://github.com/nirajkaushal/retroui

## Overview

##### Key Relationships to Highlight

a) Documentation Flow:
**Content (MDX) -> ContentLayer -> Next.js Pages -> Rendered Docs**

b) Component Showcase Flow:
**UI Components -> Preview Components -> Component Showcase -> Documentation**

c) Build Pipeline:
**Source -> TypeScript -> Package Building -> Distribution**

##### Specific Elements

a) Core Components Section:
- Major component categories (Accordions, Alerts, Avatars, etc.)
- Shared utilities and types
- Relationship with Tailwind CSS

b) Documentation Architecture:
- Next.js App Router structure
- MDX processing pipeline
- Preview component system
- Navigation system

c) Development Tools:
- ESLint configuration
- TypeScript setup
- ContentLayer processing
- Build pipeline

##### Important Architectural Patterns to Emphasize

- Component Composition Pattern
- Documentation-as-Code approach
- Preview/Demo separation
- Monorepo structure (packages/ui)

**┌─ Documentation Layer ─────────────────┐**
- ┌─ App Router ─┐ ┌─ Content ───────┐ │
- /docs        │ │ MDX Files       │ │
- /marketing   │ │ Preview Examples│ │
- /sink        │ └────────────────┘ │
- ┴─────────────┴──────────────────────┘
**┌─ Component Library Core ─────────────┐**
- ┌─ UI Components ─┐ ┌─ Utils ──────┐ │
- Buttons         │ │ Types        │ │
- Cards           │ │ Helpers      │ │
- Forms           │ │ Configs      │ │
- ┴────────────────┴─┴──────────────┴──┘
**┌─ Infrastructure ───────────────────────┐**
- ┌─ Build ────────┐ ┌─ Deploy ──────┐  │
- TypeScript     │ │ GitHub Actions│  │
- Tailwind       │ │ Docker        │  │
- ┴───────────────┴──┴──────────────┴───┘

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Documentation
        AppRouter["App Router"]
        DocRoutes["/(docs)"]
        MarketingRoutes["/(marketing)"]
        SinkRoutes["/(sink)"]
        MDXContent["MDX Content"]
        ContentConfig["Content Config"]
        MDXComponent["MDX Component"]
        ShowcaseSystem["Component Showcase"]
        PreviewComponents["Preview Components"]
        Navigation["Navigation System"]
        SideNav["Side Navigation"]
        TopNav["Top Navigation"]
        NavConfig["Navigation Config"]
    end

    subgraph CoreLibrary
        UIComponents["UI Components"]
        Accordions["Accordions"]
        Alerts["Alerts"]
        Avatars["Avatars"]
        Buttons["Buttons"]
        Cards["Cards"]
        Dialog["Dialog"]
        Form["Form"]
        Utils["Utilities"]
        Types["Type Definitions"]
    end

    subgraph Infrastructure
        BuildConfig["Build Configuration"]
        NextConfig["Next.js Config"]
        TSConfig["TypeScript Config"]
        TailwindConfig["Tailwind Config"]
        Deploy["Deployment"]
    end

    %% Relationships
    AppRouter --> DocRoutes
    AppRouter --> MarketingRoutes
    AppRouter --> SinkRoutes
    MDXContent --> ContentConfig
    ContentConfig --> MDXComponent
    ShowcaseSystem --> PreviewComponents
    Navigation --> SideNav
    Navigation --> TopNav
    Navigation --> NavConfig

    UIComponents --> Accordions
    UIComponents --> Alerts
    UIComponents --> Avatars
    UIComponents --> Buttons
    UIComponents --> Cards
    UIComponents --> Dialog
    UIComponents --> Form
    UIComponents --> Utils
    UIComponents --> Types

    BuildConfig --> NextConfig
    BuildConfig --> TSConfig
    BuildConfig --> TailwindConfig
    BuildConfig --> Deploy

    %% Click Events
    click AppRouter "https://github.com/nirajkaushal/retroui/tree/main/app/"
    click DocRoutes "https://github.com/nirajkaushal/retroui/tree/main/app/(docs)"
    click MarketingRoutes "https://github.com/nirajkaushal/retroui/tree/main/app/(marketing)"
    click SinkRoutes "https://github.com/nirajkaushal/retroui/tree/main/app/(sink)"
    click MDXContent "https://github.com/nirajkaushal/retroui/tree/main/content/docs/"
    click ContentConfig "https://github.com/nirajkaushal/retroui/blob/main/contentlayer.config.ts"
    click MDXComponent "https://github.com/nirajkaushal/retroui/blob/main/components/MDX.tsx"
    click ShowcaseSystem "https://github.com/nirajkaushal/retroui/blob/main/components/ComponentShowcase.tsx"
    click PreviewComponents "https://github.com/nirajkaushal/retroui/tree/main/preview/components/"
    click UIComponents "https://github.com/nirajkaushal/retroui/tree/main/packages/ui/"
    click Accordions "https://github.com/nirajkaushal/retroui/tree/main/packages/ui/Accordions"
    click Alerts "https://github.com/nirajkaushal/retroui/tree/main/packages/ui/Alerts"
    click Avatars "https://github.com/nirajkaushal/retroui/tree/main/packages/ui/Avatars"
    click Buttons "https://github.com/nirajkaushal/retroui/tree/main/packages/ui/Buttons"
    click Cards "https://github.com/nirajkaushal/retroui/tree/main/packages/ui/Cards"
    click Dialog "https://github.com/nirajkaushal/retroui/tree/main/packages/ui/Dialog"
    click Form "https://github.com/nirajkaushal/retroui/tree/main/packages/ui/Form"
    click Utils "https://github.com/nirajkaushal/retroui/blob/main/lib/utils.ts"
    click Types "https://github.com/nirajkaushal/retroui/blob/main/types/index.d.ts"
    click SideNav "https://github.com/nirajkaushal/retroui/blob/main/components/SideNav.tsx"
    click TopNav "https://github.com/nirajkaushal/retroui/blob/main/components/TopNav.tsx"
    click NavConfig "https://github.com/nirajkaushal/retroui/blob/main/config/navigation.ts"
    click NextConfig "https://github.com/nirajkaushal/retroui/blob/main/next.config.mjs"
    click TSConfig "https://github.com/nirajkaushal/retroui/blob/main/tsconfig.json"
    click TailwindConfig "https://github.com/nirajkaushal/retroui/blob/main/tailwind.config.ts"
    click Deploy "https://github.com/nirajkaushal/retroui/blob/main/.github/workflows/deploy.yml"

    %% Styling
    classDef documentation fill:#FFE5CC,stroke:#FF9933
    classDef core fill:#E6F3FF,stroke:#3399FF
    classDef infrastructure fill:#E6FFE6,stroke:#33CC33

    class AppRouter,DocRoutes,MarketingRoutes,SinkRoutes,MDXContent,ContentConfig,MDXComponent,ShowcaseSystem,PreviewComponents,Navigation,SideNav,TopNav,NavConfig documentation
    class UIComponents,Accordions,Alerts,Avatars,Buttons,Cards,Dialog,Form,Utils,Types core
    class BuildConfig,NextConfig,TSConfig,TailwindConfig,Deploy infrastructure
```
