# weareathlon/frontend-webpack-boilerplate architecture

> Architecture diagram of the GitHub repository weareathlon/frontend-webpack-boilerplate, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-07-19). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/weareathlon/frontend-webpack-boilerplate
- Repository: https://github.com/weareathlon/frontend-webpack-boilerplate

## Overview

##### Project type and purpose
- This is a front-end Webpack 5 boilerplate template designed to jumpstart new web projects. It provides a configurable asset pipeline (JS, SASS/PostCSS, images, fonts, videos, HTML), linting, development server, production build optimizations, and CI/CD via GitHub Actions.

##### File structure
- Top-level config files: .babelrc, .eslintrc, .sasslintrc, postcss.config.js, webpack.config.js, configuration/*.js
- Source assets under src/:
- src/js/*.js
- src/scss/ (base, demo, dirty hacks)
- src/images/content & src/images/design
- src/fonts, src/videos, src/index.html
- Builds output at /dist (CSS, JS, images, fonts, HTML) controlled by configuration/webpack.{dev,prod}.config.js
- CI and repository management under .github/ (actions pipelines, issue/Pull templates)
- Package metadata and scripts in package.json

##### README insights
- The README confirms features: environment-specific Webpack configs, Babel, Autoprefixer, imagemin, code linters, Webpack Dev Server, Bundle Analyzer, and GitHub Actions for build+deploy. It outlines development and production workflows.

a. Main components
- Developer workstation (source code editor, terminal)
- Source code repository (GitHub)
- Build/configuration layer:
- Webpack core
- Environment module (configuration/environment.js)
- Dev config vs. Prod config
- Loaders: Babel (JS), Sass/PostCSS, file-loader/url-loader for images/fonts/videos, html-webpack-plugin
- Plugins: Terser, imagemin, autoprefixer, webpack-dev-server, bundle-analyzer
- Linters: ESLint, SassLint
- Development server (webpack-dev-server + live reload)
- Artifact output (dist/)
- Client browser (loads dev server or built assets)
- CI/CD pipeline (GitHub Actions → lint → build → deploy to GitHub Pages)
- NPM registry (optional for publishing @weareathlon/frontend-webpack-boilerplate)

b. Relationships and interactions
- Developer pushes code to GitHub
- GitHub Actions triggers lint → build → deploy
- Local development: Webpack reads environment config & webpack.dev.config → processes src/ assets through loaders/plugins → serves on webpack-dev-server → browser auto-reloads
- Production build: Webpack uses prod config → emits optimized assets to /dist → deployable to static host

c. Architectural patterns/design principles
- Modular pipeline: clear separation of loader chains per asset type
- Environment-driven configuration: abstracted env vars, dev vs. prod
- Convention-over-configuration: auto‐discover all HTML in src/
- GitOps: CI/CD declaratively in .github/workflows

d. Technologies/frameworks/libraries
- Webpack 5, Babel 7, Sass/PostCSS, Autoprefixer, Terser, imagemin, webpack-dev-server, ESLint (Airbnb), SassLint, GitHub Actions

##### Detail without overthinking
- Separate development vs. production paths.
- Thresholds (e.g., inline assets below size limit).
- How browserslist influences Babel & Autoprefixer.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Source Layer
    subgraph "Source Files"
        direction TB
        JSApp["app.js"]:::assets
        JSDemo["demo.js"]:::assets
        SCSSApp["app.scss"]:::assets
        SCSSVars["_vars.scss"]:::assets
        SCSSMixins["_mixins.scss"]:::assets
        SCSSReset["_reset.scss"]:::assets
        SCSSPrint["_print.scss"]:::assets
        SCSSFonts["_fonts.scss"]:::assets
        SCSSDemo["demo.scss"]:::assets
        SCSSHacks["_hacks.scss"]:::assets
        HTML["index.html"]:::assets
        Fonts["DINPro-Regular.eot"]:::assets
        ImagesContent["images/content"]:::assets
        ImagesDesign["images/design"]:::assets
        Videos["video.webm"]:::assets
    end

    subgraph "Configuration & Metadata"
        direction TB
        Babelrc[".babelrc"]:::code
        PostCSS["postcss.config.js"]:::code
        ESLintRC[".eslintrc"]:::code
        SassLintRC[".sasslintrc"]:::code
        Package["package.json"]:::code
        EnvModule["environment.js"]:::code
        WebpackCore["webpack.config.js"]:::code
        WebpackDev["webpack.dev.config.js"]:::code
        WebpackProd["webpack.prod.config.js"]:::code
    end

    %% Build Layer
    subgraph "Build Pipeline"
        direction TB
        WebpackCoreTool["Webpack Core"]:::build
        Loaders["Loaders (Babel, Sass, File)"]:::build
        Plugins["Plugins (Terser, imagemin, Autoprefixer)"]:::build
        DevServer["webpack-dev-server"]:::build
    end

    %% Output Layer
    subgraph "Output"
        direction TB
        Dist["/dist"]:::assets
    end

    %% Delivery Layer
    subgraph "Delivery & CI/CD"
        direction TB
        GitHub["GitHub Repo"]:::external
        CodeQL["codeql-analysis.yml"]:::external
        DeployWF["deploy.yml"]:::external
        Actions["GitHub Actions"]:::external
        Pages["GitHub Pages"]:::external
        NPM["NPM Registry"]:::external
        Browser["Client Browser"]:::external
    end

    %% Relationships
    JSApp -->|imports| WebpackCoreTool
    JSDemo -->|imports| WebpackCoreTool
    SCSSApp -->|imports| WebpackCoreTool
    SCSSVars -->|imports| WebpackCoreTool
    SCSSMixins -->|imports| WebpackCoreTool
    SCSSReset -->|imports| WebpackCoreTool
    SCSSPrint -->|imports| WebpackCoreTool
    SCSSFonts -->|imports| WebpackCoreTool
    SCSSDemo -->|imports| WebpackCoreTool
    SCSSHacks -->|imports| WebpackCoreTool
    HTML -->|template| WebpackCoreTool
    Fonts -->|asset| WebpackCoreTool
    ImagesContent -->|asset| WebpackCoreTool
    ImagesDesign -->|asset| WebpackCoreTool
    Videos -->|asset| WebpackCoreTool

    Babelrc -->|configures| Loaders
    PostCSS -->|configures| Plugins
    ESLintRC -->|linting| Actions
    SassLintRC -->|linting| Actions
    Package -->|metadata| Actions
    EnvModule -->|env| WebpackCoreTool
    WebpackCore -->|entry| WebpackCoreTool
    WebpackDev -->|extends| WebpackCoreTool
    WebpackProd -->|extends| WebpackCoreTool

    WebpackCoreTool -->|uses| Loaders
    WebpackCoreTool -->|uses| Plugins
    WebpackCoreTool -->|builds dev| DevServer
    DevServer -->|serves| Browser
    Browser -->|live reload| DevServer

    WebpackCoreTool -->|builds prod| Dist
    Browser -->|loads| Dist

    GitHub -->|push| Actions
    Actions -->|runs| ESLintRC
    Actions -->|runs| SassLintRC
    Actions -->|runs| WebpackCoreTool
    Actions -->|deploy| Pages
    Actions -->|analyze| CodeQL
    Actions -->|deploy| DeployWF

    Package -->|publish| NPM

    %% Click Events
    click EnvModule "https://github.com/weareathlon/frontend-webpack-boilerplate/blob/master/configuration/environment.js"
    click WebpackDev "https://github.com/weareathlon/frontend-webpack-boilerplate/blob/master/configuration/webpack.dev.config.js"
    click WebpackProd "https://github.com/weareathlon/frontend-webpack-boilerplate/blob/master/configuration/webpack.prod.config.js"
    click WebpackCore "https://github.com/weareathlon/frontend-webpack-boilerplate/blob/master/webpack.config.js"
    click Babelrc "https://github.com/weareathlon/frontend-webpack-boilerplate/blob/master/.babelrc"
    click PostCSS "https://github.com/weareathlon/frontend-webpack-boilerplate/blob/master/postcss.config.js"
    click ESLintRC "https://github.com/weareathlon/frontend-webpack-boilerplate/blob/master/.eslintrc"
    click SassLintRC "https://github.com/weareathlon/frontend-webpack-boilerplate/blob/master/.sasslintrc"
    click Package "https://github.com/weareathlon/frontend-webpack-boilerplate/blob/master/package.json"
    click CodeQL "https://github.com/weareathlon/frontend-webpack-boilerplate/blob/master/.github/workflows/codeql-analysis.yml"
    click DeployWF "https://github.com/weareathlon/frontend-webpack-boilerplate/blob/master/.github/workflows/deploy.yml"
    click JSApp "https://github.com/weareathlon/frontend-webpack-boilerplate/blob/master/src/js/app.js"
    click JSDemo "https://github.com/weareathlon/frontend-webpack-boilerplate/blob/master/src/js/demo.js"
    click SCSSApp "https://github.com/weareathlon/frontend-webpack-boilerplate/blob/master/src/scss/app.scss"
    click SCSSVars "https://github.com/weareathlon/frontend-webpack-boilerplate/blob/master/src/scss/base/_vars.scss"
    click SCSSMixins "https://github.com/weareathlon/frontend-webpack-boilerplate/blob/master/src/scss/base/_mixins.scss"
    click SCSSReset "https://github.com/weareathlon/frontend-webpack-boilerplate/blob/master/src/scss/base/_reset.scss"
    click SCSSPrint "https://github.com/weareathlon/frontend-webpack-boilerplate/blob/master/src/scss/base/_print.scss"
    click SCSSFonts "https://github.com/weareathlon/frontend-webpack-boilerplate/blob/master/src/scss/base/_fonts.scss"
    click SCSSDemo "https://github.com/weareathlon/frontend-webpack-boilerplate/blob/master/src/scss/demo.scss"
    click SCSSHacks "https://github.com/weareathlon/frontend-webpack-boilerplate/blob/master/src/scss/dirty/_hacks.scss"
    click HTML "https://github.com/weareathlon/frontend-webpack-boilerplate/blob/master/src/index.html"
    click Fonts "https://github.com/weareathlon/frontend-webpack-boilerplate/blob/master/src/fonts/DINPro-Regular.eot"
    click ImagesContent "https://github.com/weareathlon/frontend-webpack-boilerplate/tree/master/src/images/content"
    click ImagesDesign "https://github.com/weareathlon/frontend-webpack-boilerplate/tree/master/src/images/design"
    click Videos "https://github.com/weareathlon/frontend-webpack-boilerplate/blob/master/src/videos/video.webm"

    %% Styles
    classDef code fill:#D0E8FF,stroke:#005B96,color:#003F72
    classDef build fill:#DFF2BF,stroke:#4F8A10,color:#4F8A10
    classDef assets fill:#FFEFD5,stroke:#FF8C00,color:#8B4513
    classDef external fill:#E6E6FA,stroke:#9370DB,color:#4B0082
```
