# ekkun/vite-template architecture

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

- Interactive diagram: https://gitdiagram.com/ekkun/vite-template
- Repository: https://github.com/ekkun/vite-template

## Overview

##### Main components
- Starter Kit Selector – Representing the fact that the repository hosts multiple templates (Vite + EJS and Vite + Pug).
- Build System (Vite 6) – Show the central role of Vite, which processes and builds the templates.
- Template Engines – Separate nodes for EJS (in “vite_ejs”) and Pug (in “vite_pug”), each with its own configurations and template files.
- Assets and Styling – Components for SCSS folders, public assets (CSS, JavaScript, fonts, images), and the image optimizer utilities.
- Development Utilities – Tools such as ESLint, Babel, PostCSS, Tailwind CSS configurations, and code beautifiers.
- Node Scripts/CLI Tools – Specific scripts for tasks like “convertImage”, “createSymlink”, “htmlBeautify”, and “mediaQueries” that support the build and optimization process.

##### Relationships and interactions
- That both “vite_ejs” and “vite_pug” have their own source directories containing:
- Template partials (found in “src/_templates” or similar)
- HTML/Pug/EJS page templates (like “index.html”, “index.pug”)
- Static assets (images, public directories, fonts, etc.)
- SCSS file structure (organized into foundation, global, layout, object, and pages)
- JavaScript components (main file and modular components)
- Dependency flows: for example, show that the build process relies on ESLint/Babel for code quality and PostCSS/Tailwind for CSS processing.

##### Important architectural patterns and design principles
- Modularity – The project is split into distinct directories and components (templates, assets, scripts). Emphasize the clean separation between template engines to allow developers to choose based on project requirements.
- Configuration-driven Build – Multiple configuration files (.env, package.json, Vite config, etc.) drive the build and development processes.
- Reusability – Common structural patterns (e.g., SCSS segregation into foundation, globals, layout, etc.) ensure maintainability and extension.
- Separation of concerns – Static assets, template files, and JavaScript code are independently managed and integrated through the Vite build system.

##### Relevant technologies, frameworks, and libraries
- Vite 6 – Core build system.
- EJS and Pug – Two template engines provided.
- SCSS – For styling, organized into multiple logical modules.
- PostCSS, Tailwind CSS – For advanced CSS processing.
- Babel, ESLint, Prettier – For transpiling and code quality.
- Additional Node scripts – For image conversion and build optimizations.

## Diagram (Mermaid)

```mermaid
flowchart TD
    A["Starter Kit Selector"]:::selector

    %% Vite + EJS Starter Branch
    subgraph "Vite + EJS Starter"
        VE_SEL["EJS Starter Kit"]:::selector
        VE_BUILDSYS["Build System (EJS)"]:::build
        subgraph "Build Configs (EJS)"
            VE_VITECFG["vite.config.mjs (EJS)"]:::build
            VE_TWCFG["tailwind.config.mjs (EJS)"]:::build
            VE_PCCFG["postcss.config.mjs (EJS)"]:::build
        end
        VE_TEMPLATE["Template Engine (EJS)"]:::template
        subgraph "Templates (EJS)"
            VE_TEMP_DIR["Template Directory (EJS)"]:::template
            VE_PARTIALS["Template Partials (EJS)"]:::template
            VE_INDEX["Index Page (EJS)"]:::template
            VE_ABOUT["About Page (EJS)"]:::template
            VE_NEWS["News Page (EJS)"]:::template
        end
        VE_ASSETS["Assets & Styling (EJS)"]:::assets
        subgraph "Assets (EJS)"
            VE_SCSS["SCSS (EJS)"]:::assets
            VE_PUBASSETS["Public Assets (EJS)"]:::assets
            VE_IMAGES["Images (EJS)"]:::assets
        end
        VE_DEV["Development Utilities (EJS)"]:::dev
        subgraph "Dev Utils (EJS)"
            VE_ESLINT1["ESLint Config (EJS) 1"]:::dev
            VE_ESLINT2["ESLint Config (EJS) 2"]:::dev
            VE_BABEL["Babel (EJS)"]:::dev
            VE_BEAUTIFY["Beautifier Config (EJS)"]:::dev
            VE_HTMLBEAUTIFY["HTML Beautify (EJS)"]:::dev
        end
        VE_SCRIPTS["Node Scripts (EJS)"]:::script
        subgraph "Scripts (EJS)"
            VE_CONVERT["convertImage (EJS)"]:::script
            VE_SYMLINK["createSymlink (EJS)"]:::script
            VE_SCRIPTHTML["htmlBeautify Script (EJS)"]:::script
            VE_MEDIA["mediaQueries (EJS)"]:::script
        end
    end

    %% Vite + Pug Starter Branch
    subgraph "Vite + Pug Starter"
        VP_SEL["Pug Starter Kit"]:::selector
        VP_BUILDSYS["Build System (Pug)"]:::build
        subgraph "Build Configs (Pug)"
            VP_VITECFG["vite.config.mjs (Pug)"]:::build
            VP_TWCFG["tailwind.config.mjs (Pug)"]:::build
            VP_PCCFG["postcss.config.mjs (Pug)"]:::build
        end
        VP_TEMPLATE["Template Engine (Pug)"]:::template
        subgraph "Templates (Pug)"
            VP_TEMP_DIR["Template Directory (Pug)"]:::template
            VP_PARTIALS["Template Partials (Pug)"]:::template
            VP_INDEX["Index Page (Pug)"]:::template
            VP_ABOUT["About Page (Pug)"]:::template
            VP_NEWS["News Page (Pug)"]:::template
        end
        VP_ASSETS["Assets & Styling (Pug)"]:::assets
        subgraph "Assets (Pug)"
            VP_SCSS["SCSS (Pug)"]:::assets
            VP_PUBASSETS["Public Assets (Pug)"]:::assets
            VP_IMAGES["Images (Pug)"]:::assets
        end
        VP_DEV["Development Utilities (Pug)"]:::dev
        subgraph "Dev Utils (Pug)"
            VP_ESLINT1["ESLint Config (Pug) 1"]:::dev
            VP_ESLINT2["ESLint Config (Pug) 2"]:::dev
            VP_BABEL["Babel (Pug)"]:::dev
            VP_BEAUTIFY["Beautifier Config (Pug)"]:::dev
            VP_HTMLBEAUTIFY["HTML Beautify (Pug)"]:::dev
        end
        VP_SCRIPTS["Node Scripts (Pug)"]:::script
        subgraph "Scripts (Pug)"
            VP_CONVERT["convertImage (Pug)"]:::script
            VP_SYMLINK["createSymlink (Pug)"]:::script
            VP_SCRIPTHTML["htmlBeautify Script (Pug)"]:::script
            VP_MEDIA["mediaQueries (Pug)"]:::script
        end
        subgraph "Pug Plugins"
            VP_PLUGINBUILD["vite-plugin-pug-build"]:::script
            VP_PLUGINSERVE["vite-plugin-pug-serve"]:::script
            VP_PLUGIN["vite-plugin-pug"]:::script
        end
    end

    %% Connections for EJS branch
    A --> VE_SEL
    VE_SEL --> VE_BUILDSYS
    VE_BUILDSYS --> VE_VITECFG
    VE_BUILDSYS --> VE_TWCFG
    VE_BUILDSYS --> VE_PCCFG
    VE_BUILDSYS --> VE_TEMPLATE
    VE_TEMPLATE --> VE_TEMP_DIR
    VE_TEMPLATE --> VE_PARTIALS
    VE_TEMPLATE --> VE_INDEX
    VE_TEMPLATE --> VE_ABOUT
    VE_TEMPLATE --> VE_NEWS
    VE_BUILDSYS --> VE_ASSETS
    VE_BUILDSYS --> VE_DEV
    VE_BUILDSYS --> VE_SCRIPTS

    %% Connections for Pug branch
    A --> VP_SEL
    VP_SEL --> VP_BUILDSYS
    VP_BUILDSYS --> VP_VITECFG
    VP_BUILDSYS --> VP_TWCFG
    VP_BUILDSYS --> VP_PCCFG
    VP_BUILDSYS --> VP_TEMPLATE
    VP_TEMPLATE --> VP_TEMP_DIR
    VP_TEMPLATE --> VP_PARTIALS
    VP_TEMPLATE --> VP_INDEX
    VP_TEMPLATE --> VP_ABOUT
    VP_TEMPLATE --> VP_NEWS
    VP_BUILDSYS --> VP_ASSETS
    VP_BUILDSYS --> VP_DEV
    VP_BUILDSYS --> VP_SCRIPTS
    VP_BUILDSYS --> VP_PLUGINBUILD
    VP_BUILDSYS --> VP_PLUGINSERVE
    VP_BUILDSYS --> VP_PLUGIN

    %% Click Events for Starter Kit Selector
    click VE_SEL "https://github.com/ekkun/vite-template/tree/main//vite_ejs"
    click VP_SEL "https://github.com/ekkun/vite-template/tree/main//vite_pug"

    %% Click Events for Build Configs - EJS
    click VE_VITECFG "https://github.com/ekkun/vite-template/blob/main//vite_ejs/vite.config.mjs"
    click VE_TWCFG "https://github.com/ekkun/vite-template/blob/main//vite_ejs/tailwind.config.mjs"
    click VE_PCCFG "https://github.com/ekkun/vite-template/blob/main//vite_ejs/postcss.config.mjs"

    %% Click Events for Templates - EJS
    click VE_TEMP_DIR "https://github.com/ekkun/vite-template/tree/main//vite_ejs/src"
    click VE_PARTIALS "https://github.com/ekkun/vite-template/tree/main//vite_ejs/src/_templates"
    click VE_INDEX "https://github.com/ekkun/vite-template/blob/main//vite_ejs/src/index.html"
    click VE_ABOUT "https://github.com/ekkun/vite-template/blob/main//vite_ejs/src/about/index.html"
    click VE_NEWS "https://github.com/ekkun/vite-template/blob/main//vite_ejs/src/news/index.html"

    %% Click Events for Assets - EJS
    click VE_SCSS "https://github.com/ekkun/vite-template/tree/main//vite_ejs/src/scss/"
    click VE_PUBASSETS "https://github.com/ekkun/vite-template/tree/main//vite_ejs/src/public/assets"
    click VE_IMAGES "https://github.com/ekkun/vite-template/tree/main//vite_ejs/src/images"

    %% Click Events for Dev Utils - EJS
    click VE_ESLINT1 "https://github.com/ekkun/vite-template/blob/main//vite_ejs/eslint.config.mjs"
    click VE_ESLINT2 "https://github.com/ekkun/vite-template/blob/main//vite_ejs/eslint.config.org.mjs"
    click VE_BABEL "https://github.com/ekkun/vite-template/blob/main//vite_ejs/babel.babelrc"
    click VE_BEAUTIFY "https://github.com/ekkun/vite-template/blob/main//vite_ejs/.jsbeautifyrc"
    click VE_HTMLBEAUTIFY "https://github.com/ekkun/vite-template/blob/main//vite_ejs/htmlBeautify.mjs"

    %% Click Events for Node Scripts - EJS
    click VE_CONVERT "https://github.com/ekkun/vite-template/blob/main//vite_ejs/convertImage.mjs"
    click VE_SYMLINK "https://github.com/ekkun/vite-template/blob/main//vite_ejs/createSymlink.mjs"
    click VE_SCRIPTHTML "https://github.com/ekkun/vite-template/blob/main//vite_ejs/htmlBeautify.mjs"
    click VE_MEDIA "https://github.com/ekkun/vite-template/blob/main//vite_ejs/mediaQueries.mjs"

    %% Click Events for Build Configs - Pug
    click VP_VITECFG "https://github.com/ekkun/vite-template/blob/main//vite_pug/vite.config.mjs"
    click VP_TWCFG "https://github.com/ekkun/vite-template/blob/main//vite_pug/tailwind.config.mjs"
    click VP_PCCFG "https://github.com/ekkun/vite-template/blob/main//vite_pug/postcss.config.mjs"

    %% Click Events for Templates - Pug
    click VP_TEMP_DIR "https://github.com/ekkun/vite-template/tree/main//vite_pug/src"
    click VP_PARTIALS "https://github.com/ekkun/vite-template/tree/main//vite_pug/src/_templates"
    click VP_INDEX "https://github.com/ekkun/vite-template/blob/main//vite_pug/src/index.pug"
    click VP_ABOUT "https://github.com/ekkun/vite-template/blob/main//vite_pug/src/about/index.pug"
    click VP_NEWS "https://github.com/ekkun/vite-template/blob/main//vite_pug/src/news/index.pug"

    %% Click Events for Assets - Pug
    click VP_SCSS "https://github.com/ekkun/vite-template/tree/main//vite_pug/src/scss/"
    click VP_PUBASSETS "https://github.com/ekkun/vite-template/tree/main//vite_pug/src/public/assets"
    click VP_IMAGES "https://github.com/ekkun/vite-template/tree/main//vite_pug/src/images"

    %% Click Events for Dev Utils - Pug
    click VP_ESLINT1 "https://github.com/ekkun/vite-template/blob/main//vite_pug/eslint.config.mjs"
    click VP_ESLINT2 "https://github.com/ekkun/vite-template/blob/main//vite_pug/eslint.config.org.mjs"
    click VP_BABEL "https://github.com/ekkun/vite-template/blob/main//vite_pug/babel.babelrc"
    click VP_BEAUTIFY "https://github.com/ekkun/vite-template/blob/main//vite_pug/.jsbeautifyrc"
    click VP_HTMLBEAUTIFY "https://github.com/ekkun/vite-template/blob/main//vite_pug/htmlBeautify.mjs"

    %% Click Events for Node Scripts - Pug
    click VP_CONVERT "https://github.com/ekkun/vite-template/blob/main//vite_pug/convertImage.mjs"
    click VP_SYMLINK "https://github.com/ekkun/vite-template/blob/main//vite_pug/createSymlink.mjs"
    click VP_SCRIPTHTML "https://github.com/ekkun/vite-template/blob/main//vite_pug/htmlBeautify.mjs"
    click VP_MEDIA "https://github.com/ekkun/vite-template/blob/main//vite_pug/mediaQueries.mjs"

    %% Click Events for Pug Plugins
    click VP_PLUGINBUILD "https://github.com/ekkun/vite-template/blob/main//vite_pug/plugins/vite-plugin-pug-build.ts"
    click VP_PLUGINSERVE "https://github.com/ekkun/vite-template/blob/main//vite_pug/plugins/vite-plugin-pug-serve.ts"
    click VP_PLUGIN "https://github.com/ekkun/vite-template/blob/main//vite_pug/plugins/vite-plugin-pug.ts"

    %% Styles
    classDef selector fill:#f9d342,stroke:#333,stroke-width:2px;
    classDef build fill:#b3e5fc,stroke:#333,stroke-width:2px;
    classDef template fill:#c8e6c9,stroke:#333,stroke-width:2px;
    classDef assets fill:#ffe0b2,stroke:#333,stroke-width:2px;
    classDef dev fill:#d1c4e9,stroke:#333,stroke-width:2px;
    classDef script fill:#ffcdd2,stroke:#333,stroke-width:2px;
```
