# nuejs/nue architecture

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

- Interactive diagram: https://gitdiagram.com/nuejs/nue
- Repository: https://github.com/nuejs/nue

## Overview

##### Main Components

The system should be represented as a monorepo architecture with these core packages:

a. Core Framework Components:
- nuejs (Core framework package)
- nuekit (Build and development toolkit)
- nuemark (Markdown processing engine)
- glow (Syntax highlighting component)

b. Documentation/Examples:
- nuejs.org (Documentation website)
- examples/simple-blog (Example implementation)

##### Architectural Layers

**┌─ Application Layer ─────────────────────┐**
- [Examples]        [Documentation Site] │
- simple-blog         nuejs.org          │
- ┬────────────────────┬─┘

**┌─ Framework Layer ─▼────────────────┐  │**
- ┌─ NueKit ──────────────────────┐ │  │
- CLI Interface              │ │  │
- Development Server         │ │  │
- Build System              │ │  │
- Hot Reload                │ │  │
- ┬──────────────┘ │  │

- ┌─ NueJS ──────▼──────────────┐ │  │
- Component System          │ │  │
- Templating Engine         │ │  │
- Reactive Runtime          │ │  │
- ┬──────────────┘ │  │
- ┼────────────────┘  │

**┌─ Utils Layer ───▼───────────────────▼┐**
- [Nuemark]           [Glow]          │
- Markdown Engine     Syntax Highlight │
- ┘

##### Important Details

- Browser Components (/src/browser)
- Server Components (/src/layout)
- Build Tools (/src/builder)
- CLI Interface (/src/cli)

##### Integration Points

External integration points:
- Browser Runtime
- Development Server
- Build Pipeline
- Content Processing

##### Development Flow

**Source Files → NueKit Build → Optimized Output**
- ↑                ↓
**Hot Reload ←── Dev Server**

Remember to:
- Use consistent styling and notation
- Version information
- Document key architectural decisions

- Standards-first approach
- Minimal tooling
- Content-centric architecture
- Built-in optimization

This will provide a clear understanding of how the different packages interact while maintaining a focus on the project's core principles of simplicity and standards-based development.

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles and classes
    classDef application fill:#9370DB,stroke:#333,stroke-width:2px
    classDef framework fill:#4169E1,stroke:#333,stroke-width:2px
    classDef utils fill:#FFD700,stroke:#333,stroke-width:2px
    classDef build fill:#3CB371,stroke:#333,stroke-width:2px
    classDef browser fill:#87CEEB,stroke:#333,stroke-width:2px
    classDef server fill:#98FB98,stroke:#333,stroke-width:2px

    %% Application Layer
    subgraph Applications
        Blog["Simple Blog Example"]
        Docs["Documentation Site"]
    end
    class Blog,Docs application

    %% Framework Layer
    subgraph Framework
        subgraph NueKit["NueKit Build Tools"]
            CLI["CLI Interface"]
            DevServer["Development Server"]
            BuildSys["Build System"]
            HotReload["Hot Reload"]
            ViewTrans["View Transitions"]
        end

        subgraph NueJS["NueJS Core"]
            Browser["Browser Runtime"]
            CompSys["Component System"]
            Template["Templating Engine"]
        end
    end
    class NueJS,CompSys,Template,Browser framework
    class CLI,DevServer,BuildSys,HotReload,ViewTrans build

    %% Utils Layer
    subgraph Utils
        subgraph Nuemark["Nuemark"]
            DocParser["Document Parser"]
            BlockParser["Block Parser"]
            InlineParser["Inline Parser"]
        end

        subgraph Glow["Glow"]
            SyntaxCore["Core Implementation"]
            SyntaxStyles["Syntax Styles"]
        end
    end
    class Nuemark,DocParser,BlockParser,InlineParser,Glow,SyntaxCore,SyntaxStyles utils

    %% Relationships
    Blog --> NueKit
    Docs --> NueKit
    NueKit --> NueJS
    NueJS --> Nuemark
    NueJS --> Glow
    DevServer --> HotReload
    CLI --> BuildSys
    BuildSys --> CompSys

    %% Click events
    click Blog "https://github.com/nuejs/nue/tree/master/packages/examples/simple-blog"
    click Docs "https://github.com/nuejs/nue/blob/master/packages/nuejs.org"
    click CLI "https://github.com/nuejs/nue/blob/master/packages/nuekit/src/cli.js"
    click DevServer "https://github.com/nuejs/nue/blob/master/packages/nuekit/src/nueserver.js"
    click BuildSys "https://github.com/nuejs/nue/blob/master/packages/nuekit/src/builder.js"
    click HotReload "https://github.com/nuejs/nue/blob/master/packages/nuekit/src/browser/hotreload.js"
    click ViewTrans "https://github.com/nuejs/nue/blob/master/packages/nuekit/src/browser/view-transitions.js"
    click Browser "https://github.com/nuejs/nue/tree/master/packages/nuejs/src/browser"
    click CompSys "https://github.com/nuejs/nue/blob/master/packages/nuejs/src/compile.js"
    click Template "https://github.com/nuejs/nue/blob/master/packages/nuejs/src/render.js"
    click DocParser "https://github.com/nuejs/nue/blob/master/packages/nuemark/src/parse-document.js"
    click BlockParser "https://github.com/nuejs/nue/blob/master/packages/nuemark/src/parse-blocks.js"
    click InlineParser "https://github.com/nuejs/nue/blob/master/packages/nuemark/src/parse-inline.js"
    click SyntaxCore "https://github.com/nuejs/nue/blob/master/packages/glow/src/glow.js"
    click SyntaxStyles "https://github.com/nuejs/nue/blob/master/packages/glow/css/syntax.css"
```
