# hlxsites/takeda-ihs architecture

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

- Interactive diagram: https://gitdiagram.com/hlxsites/takeda-ihs
- Repository: https://github.com/hlxsites/takeda-ihs

## Overview

##### Project Type and Purpose
- This is a Helix-based, component-driven static site built with the Adobe Franklin (Helix) boilerplate.
- It assembles reusable CSS/JS “blocks,” runs via the Helix Proxy in development, and is deployed as static assets behind a CDN in production.

##### File Structure
- Top-level directories:
- blocks/ – each subfolder is a self-contained UI component (CSS + JS)
- scripts/ – site-wide JavaScript utilities and Partytown integration
- styles/ – global CSS (resets, lazy loading, images)
- well-known/, head.html, fstab.yaml, helix-query.yaml – Helix/Franklin config
- Config files: package.json (dependencies & scripts), .github/workflows/run-tests.yaml (CI), renovation, linting, and ESLint/Stylelint configs.

##### Extract Key Architecture Insights from README
- Local workflow: developer runs “hlx up” → Franklin Proxy serves dynamic templates from the codebase + remote content
- CI/CD: GitHub Actions (run-tests.yaml) + helix-bot integrate to build & deploy to “preview” and “live” environments via Helix.

##### Main Components & Interactions
a. Developer Environment
- IDE & GitHub repo → commit → GitHub Actions & helix-bot
- Franklin Proxy (hlx-cli) → local dev URL (http://localhost:3000)
b. Build & Deployment Pipeline
- GitHub Actions workflow → lint & test → invoke Helix Build API → publish to Preview & Live
c. Content & Configuration
- helix-query.yaml → GraphQL or remote CMS queries for page content
- fstab.yaml → mount points mapping Git paths to URL paths
d. Static Assets & Runtime
- blocks/ → individual JS/CSS bundles
- scripts/partytown → isolates third-party scripts into Web Worker
- styles/ → global styling
e. Delivery
- Helix CDN (Fastly) caching layer → “preview” and “live” domains
- End-user browsers retrieving pre-rendered HTML, CSS, JS

##### Architectural Patterns & Principles
- Componentization: each “block” is an isolated UI module
- Static-site generation with dynamic content fetch at build time
- CI/CD as code: GitHub Actions + Helix Build API
- Edge caching via Fastly CDN for ultra-low latency

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Source Layer
    subgraph "Source Layer"
        direction TB
        Dev["Developer\n(IDE)"]:::source
        Repo["GitHub Repo"]:::source
    end

    %% Pipeline Layer
    subgraph "Pipeline Layer"
        direction TB
        Actions["GitHub Actions"]:::pipeline
        Proxy["Franklin Proxy\n(hlx up)"]:::pipeline
    end

    %% Build Layer
    subgraph "Build Layer"
        direction TB
        HelixAPI["Helix Build API"]:::build
        subgraph "Build Configuration"
            direction TB
            FSTAB["fstab.yaml"]:::build
            Query["helix-query.yaml"]:::build
            Head["head.html"]:::build
            Hlxignore[".hlxignore"]:::build
            Package["package.json"]:::build
        end
        subgraph "Static Assets"
            direction TB
            Blocks["Component Registry\n(blocks/)"]:::build
            subgraph "Global Styles"
                direction TB
                Reset["reset.css"]:::build
                Lazy["lazy-styles.css"]:::build
                Base["styles.css"]:::build
            end
            subgraph "Site-wide Scripts"
                direction TB
                ScriptsJS["scripts.js"]:::build
                FranklinLib["lib-franklin.js"]:::build
                Delayed["delayed.js"]:::build
                ThirdParty["third-party.js"]:::build
            end
            subgraph "Partytown Isolation"
                direction TB
                PT1["partytown.js"]:::build
                PT2["partytown-atomics.js"]:::build
                PT3["partytown-media.js"]:::build
                PT4["partytown-sw.js"]:::build
            end
        end
    end

    %% Delivery Layer
    subgraph "Delivery Layer"
        direction TB
        CDN["Fastly CDN\n(Preview & Live)"]:::runtime
    end

    %% Runtime Layer
    subgraph "Runtime Layer"
        direction TB
        Browser["End User Browser"]:::runtime
    end

    %% Connections
    Dev -->|"git push"| Repo
    Repo -->|"trigger"| Actions
    Actions -->|"hlx build"| HelixAPI
    HelixAPI -->|"uses config"| FSTAB
    HelixAPI -->|"uses config"| Query
    HelixAPI -->|"injects head"| Head
    HelixAPI -->|"reads ignore"| Hlxignore
    HelixAPI -->|"reads metadata"| Package
    HelixAPI -->|"bundles blocks"| Blocks
    HelixAPI -->|"includes styles"| Reset
    HelixAPI -->|"includes styles"| Lazy
    HelixAPI -->|"includes styles"| Base
    HelixAPI -->|"includes scripts"| ScriptsJS
    HelixAPI -->|"includes scripts"| FranklinLib
    HelixAPI -->|"includes scripts"| Delayed
    HelixAPI -->|"includes scripts"| ThirdParty
    HelixAPI -->|"sets up partytown"| PT1
    HelixAPI -->|"sets up partytown"| PT2
    HelixAPI -->|"sets up partytown"| PT3
    HelixAPI -->|"sets up partytown"| PT4
    Dev -->|"hlx up"| Proxy
    Proxy -->|"serves dynamic templates"| Browser
    HelixAPI -->|"deploys assets"| CDN
    Browser -->|"request site"| CDN
    CDN -->|"serves assets"| Browser

    %% Click Events
    click Blocks "https://github.com/hlxsites/takeda-ihs/tree/main/blocks/"
    click Reset "https://github.com/hlxsites/takeda-ihs/blob/main/styles/reset.css"
    click Lazy "https://github.com/hlxsites/takeda-ihs/blob/main/styles/lazy-styles.css"
    click Base "https://github.com/hlxsites/takeda-ihs/blob/main/styles/styles.css"
    click ScriptsJS "https://github.com/hlxsites/takeda-ihs/blob/main/scripts/scripts.js"
    click FranklinLib "https://github.com/hlxsites/takeda-ihs/blob/main/scripts/lib-franklin.js"
    click Delayed "https://github.com/hlxsites/takeda-ihs/blob/main/scripts/delayed.js"
    click ThirdParty "https://github.com/hlxsites/takeda-ihs/blob/main/scripts/third-party.js"
    click PT1 "https://github.com/hlxsites/takeda-ihs/blob/main/scripts/partytown/partytown.js"
    click PT2 "https://github.com/hlxsites/takeda-ihs/blob/main/scripts/partytown/partytown-atomics.js"
    click PT3 "https://github.com/hlxsites/takeda-ihs/blob/main/scripts/partytown/partytown-media.js"
    click PT4 "https://github.com/hlxsites/takeda-ihs/blob/main/scripts/partytown/partytown-sw.js"
    click FSTAB "https://github.com/hlxsites/takeda-ihs/blob/main/fstab.yaml"
    click Query "https://github.com/hlxsites/takeda-ihs/blob/main/helix-query.yaml"
    click Head "https://github.com/hlxsites/takeda-ihs/blob/main/head.html"
    click Actions "https://github.com/hlxsites/takeda-ihs/blob/main/.github/workflows/run-tests.yaml"
    click Package "https://github.com/hlxsites/takeda-ihs/blob/main/package.json"
    click Hlxignore "https://github.com/hlxsites/takeda-ihs/blob/main/.hlxignore"

    %% Styles
    classDef source fill:#AEDFF7,stroke:#333,stroke-width:1px;
    classDef pipeline fill:#FFC285,stroke:#333,stroke-width:1px;
    classDef build fill:#C1E1C1,stroke:#333,stroke-width:1px;
    classDef runtime fill:#F7E8AE,stroke:#333,stroke-width:1px;
```
