# prestashop/hummingbird architecture

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

- Interactive diagram: https://gitdiagram.com/prestashop/hummingbird
- Repository: https://github.com/prestashop/hummingbird

## Overview

##### Main Components
- Modules: There is a large “modules” directory containing many PrestaShop modules (e.g., blockwishlist, ps_advertising, ps_banner, etc.). Represent each module as a separate subcomponent or group them functionally (e.g., customer account modules, catalog modules, etc.).
- Template System: The “templates” directory holds various .tpl files organized into sections (catalog, checkout, cms, customer, errors, layouts). Show this as the view layer responsible for rendering the front-end pages.
- Asset Pipeline:
- Source Code (src): This directory contains JavaScript (JS), TypeScript (TS definitions), SCSS files (styles), images, and helper files. It is the “raw” front-end asset source.
- Build Infrastructure (webpack, babel.config.js, postcss.config.js, package.json): Represent these as the asset bundling/compiling unit using Webpack and other tools. They process and compile JS/SCSS to deliver production-ready assets.
- Storybook & Stories (storybook, stories): These directories provide interactive documentation for UI components. Indicate them as the UI development/documentation layer.
- Configuration and CI/CD:
- Configuration files (e.g., .editorconfig, .eslintignore, .eslintrc.js, .stylelintignore, .stylelintrc, tsconfig.json) and CI workflows under “.github/workflows” are essential for code quality and continuous integration.
- Environment configuration for Webpack (the .env examples in the “webpack” folder) should be shown as part of the build/deployment configuration.
- External Services and Deployment:
- CI/CD: Represent the role of Github Actions (via the various YAML files in .github/workflows) which run linting, unit tests, type-checks, and deploy Storybook documentation.
- Continuous Deployment: The README mentions that Storybook gets deployed via Github Pages when code reaches master.

##### Relationships & Data Flow
- Flow from Development Sources → Asset Build → Generated assets that are then used by PrestaShop’s front-end rendering.
- How configuration and build tools (Webpack, Babel, PostCSS) process the raw assets (found in “src” and “stories”) into the compiled theme.

##### Architectural Patterns & Design Principles
- Modularity: The project is highly modular – each functionality is in its own module (both PrestaShop modules and separate JS/SCSS components). Highlight this by grouping related modules.
- Separation of Concerns: There is a clear separation between the backend templating (PHP, TPL files), the front-end assets (JS/SCSS), and the build/documentation pipelines.
- Build and Deployment Pipeline: The configuration files and GitHub workflows indicate a robust CI/CD process. Make sure to illustrate this automated pipeline.

##### Relevant Technologies, Frameworks, and Tools
- PrestaShop (8.1.x): The underlying commerce platform.
- Webpack, Babel, Node.js, and NPM: Tools used for building and bundling assets.
- Storybook: For interactive UI documentation.
- ESLint, Stylelint, and TypeScript: For enforcing coding standards and type checking.
- PHP and TPL: Used within modules and templates for dynamic content rendering.
- SCSS/CSS and JavaScript/TypeScript: For front-end component styling and behavior.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% PrestaShop Integration Layer
    subgraph "PrestaShop Integration Layer"
        Modules["Modules Directory"]:::integration
        Templates["Templates Directory"]:::integration
        ConfigFiles["Configuration Files"]:::integration
    end

    PrestaShopCMS["PrestaShop (CMS 8.1.x)"]:::integration

    Modules -->|"integrates"| PrestaShopCMS
    Templates -->|"renders view"| PrestaShopCMS
    ConfigFiles -->|"configures"| PrestaShopCMS

    %% Asset Pipeline
    subgraph "Asset Pipeline"
        SourceCode["Source Code (src)"]:::asset
        BuildInfra["Build Infrastructure"]:::asset
        CompiledAssets["Compiled Assets"]:::asset
        Storybook["Storybook & Stories"]:::documentation
    end

    SourceCode -->|"processed by"| BuildInfra
    BuildInfra -->|"produces"| CompiledAssets
    CompiledAssets -->|"supplies assets to"| PrestaShopCMS

    %% Build Infrastructure sub-nodes
    BuildInfra -->|"uses"| WebpackConfig["Webpack Config (webpack.config.js)"]:::asset
    BuildInfra -->|"uses"| WebpackDir["Webpack Directory (webpack)"]:::asset
    BuildInfra -->|"uses"| BabelConfig["Babel Config (babel.config.js)"]:::asset
    BuildInfra -->|"uses"| PostCSSConfig["PostCSS Config (postcss.config.js)"]:::asset
    BuildInfra -->|"uses"| PackageJson["Package.json"]:::asset

    %% Storybook sub-nodes
    Storybook -->|"documentation"| StorybookDir[".storybook Directory"]:::documentation
    Storybook -->|"documentation"| StoriesDir["Stories Directory"]:::documentation

    %% Configuration & CI/CD
    subgraph "Configuration & CI/CD"
        CodeQuality["Code Quality & Lint/TS Configs"]:::ci
        CIWorkflows["CI Workflows"]:::ci
    end

    CodeQuality -->|"ensures quality for"| BuildInfra
    CIWorkflows -->|"validates"| BuildInfra

    %% Code Quality Config Files
    CodeQuality -->|"includes"| EditorConfig["EditorConfig (.editorconfig)"]:::ci
    CodeQuality -->|"includes"| ESLintIgnore["ESLint Ignore (.eslintignore)"]:::ci
    CodeQuality -->|"includes"| ESLintConfig["ESLint Config (.eslintrc.js)"]:::ci
    CodeQuality -->|"includes"| StylelintIgnore["Stylelint Ignore (.stylelintignore)"]:::ci
    CodeQuality -->|"includes"| StylelintConfig["Stylelint Config (.stylelintrc)"]:::ci
    CodeQuality -->|"includes"| TSConfig["tsconfig.json"]:::ci

    CIWorkflows -->|"configured at"| Workflows["CI Workflows (.github/workflows)"]:::ci

    %% External Deployment
    subgraph "External Deployment"
        GitHubActions["GitHub Actions (CI/CD)"]:::deployment
        StorybookDeploy["Deployed Storybook Documentation"]:::deployment
        Readme["README Documentation"]:::deployment
    end

    CIWorkflows -->|"triggers"| GitHubActions
    GitHubActions -->|"deploys"| StorybookDeploy
    GitHubActions -->|"references"| Readme

    %% Click Events
    click Modules "https://github.com/prestashop/hummingbird/tree/develop/modules"
    click Templates "https://github.com/prestashop/hummingbird/tree/develop/templates"
    click ConfigFiles "https://github.com/prestashop/hummingbird/blob/develop/config/theme.yml"
    click SourceCode "https://github.com/prestashop/hummingbird/tree/develop/src"
    click WebpackConfig "https://github.com/prestashop/hummingbird/blob/develop/webpack.config.js"
    click WebpackDir "https://github.com/prestashop/hummingbird/tree/develop/webpack"
    click BabelConfig "https://github.com/prestashop/hummingbird/blob/develop/babel.config.js"
    click PostCSSConfig "https://github.com/prestashop/hummingbird/blob/develop/postcss.config.js"
    click PackageJson "https://github.com/prestashop/hummingbird/blob/develop/package.json"
    click StorybookDir "https://github.com/prestashop/hummingbird/blob/develop/.storybook"
    click StoriesDir "https://github.com/prestashop/hummingbird/tree/develop/stories"
    click EditorConfig "https://github.com/prestashop/hummingbird/blob/develop/.editorconfig"
    click ESLintIgnore "https://github.com/prestashop/hummingbird/blob/develop/.eslintignore"
    click ESLintConfig "https://github.com/prestashop/hummingbird/blob/develop/.eslintrc.js"
    click StylelintIgnore "https://github.com/prestashop/hummingbird/blob/develop/.stylelintignore"
    click StylelintConfig "https://github.com/prestashop/hummingbird/blob/develop/.stylelintrc"
    click TSConfig "https://github.com/prestashop/hummingbird/blob/develop/tsconfig.json"
    click Workflows "https://github.com/prestashop/hummingbird/tree/develop/.github/workflows"
    click Readme "https://github.com/prestashop/hummingbird/blob/develop/README.md"

    %% Styles
    classDef integration fill:#AED6F1,stroke:#1B4F72,stroke-width:2px;
    classDef asset fill:#A9DFBF,stroke:#1E8449,stroke-width:2px;
    classDef ci fill:#F9E79F,stroke:#B7950B,stroke-width:2px;
    classDef documentation fill:#F5B7B1,stroke:#922B21,stroke-width:2px;
    classDef deployment fill:#D2B4DE,stroke:#6C3483,stroke-width:2px;
```
