# onsdigital/sdg-indicators architecture

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

- Interactive diagram: https://gitdiagram.com/onsdigital/sdg-indicators
- Repository: https://github.com/onsdigital/sdg-indicators

## Overview

##### Main Components

a) Frontend Layer:
- Jekyll Static Site Generator (evident from _config.yml and Jekyll-specific directories)
- Custom Components (_includes/components/)
- Layout Templates (_layouts/)
- Static Assets (assets/)
- Custom Styling (_sass/)

b) Integration Components:
- Analytics Integration (Google Analytics, Hotjar)
- Cookie Management System
- Accessibility Features

c) Content Management:
- Data Storage (_data/)
- Posts System (_posts/)
- Pages System (_pages/)

d) CI/CD Pipeline:
- GitHub Actions Workflows (.github/workflows/)
- Development/Staging/Production Environments

**[User Browser Layer]**
- ↓
**[Content Delivery Layer]**
- ↓
**[Static Site Generation Layer]**
- ↓
**[Data Management Layer]**

##### Key Relationships to Highlight

a) Build Process Flow:
- Jekyll processing of _includes, _layouts, and _sass
- Configuration management between environments
- GitHub Actions deployment workflow

b) Frontend Components:
- Custom components integration
- Analytics and tracking implementation
- Cookie management system

c) Content Management:
- Data flow from _data to rendered pages
- Blog posts and updates system
- Static asset serving

##### Additional Elements

- Component types and their relationships
- Environment-specific configurations
- Custom implementation areas
- Third-party service integrations

Remember to include:
- Clear separation of concerns between content, presentation, and functionality
- Integration points with external services (Analytics, Hotjar)
- Custom components and their relationship to the core system
- Build and deployment pipelines for different environments

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph User["User Layer"]
        Browser["Web Browser"]
    end

    subgraph CDN["Content Delivery Layer"]
        StaticAssets["Static Assets"]:::frontend
        CookieSystem["Cookie Management"]:::frontend
        Analytics["Analytics & Tracking"]:::integration
    end

    subgraph SSG["Static Site Generation Layer"]
        Jekyll["Jekyll Engine"]:::core
        
        subgraph Components["Component Layer"]
            CustomComponents["Custom Components"]:::frontend
            Layouts["Layout Templates"]:::frontend
            Styling["Custom Styling"]:::frontend
        end
        
        subgraph Integration["Integration Layer"]
            GoogleAnalytics["Google Analytics"]:::integration
            Hotjar["Hotjar"]:::integration
            AccessibilityTests["Accessibility Testing"]:::integration
        end
    end

    subgraph Data["Data Management Layer"]
        DataStorage["Data Storage"]:::data
        Posts["Posts System"]:::data
        Pages["Pages System"]:::data
    end

    subgraph CICD["CI/CD Pipeline"]
        GithubActions["GitHub Actions"]:::pipeline
        
        subgraph Environments["Environments"]
            Staging["Staging"]:::pipeline
            Production["Production"]:::pipeline
        end
    end

    Browser --> StaticAssets
    Browser --> CookieSystem
    Browser --> Analytics

    StaticAssets --> Jekyll
    CookieSystem --> Jekyll
    Analytics --> Integration

    Jekyll --> Components
    Jekyll --> Integration
    Jekyll --> Data

    GithubActions --> Staging
    GithubActions --> Production
    
    %% Component Mappings
    click Jekyll "https://github.com/ONSdigital/sdg-indicators/blob/develop//_config.yml"
    click CustomComponents "https://github.com/ONSdigital/sdg-indicators/tree/develop//_includes/components/"
    click Layouts "https://github.com/ONSdigital/sdg-indicators/blob/develop//_layouts/page.html"
    click StaticAssets "https://github.com/ONSdigital/sdg-indicators/tree/develop//assets/css/"
    click Styling "https://github.com/ONSdigital/sdg-indicators/blob/develop//_sass/custom.scss"
    click Analytics "https://github.com/ONSdigital/sdg-indicators/blob/develop//analytics.txt"
    click CookieSystem "https://github.com/ONSdigital/sdg-indicators/blob/develop//_includes/cookies-config.js"
    click AccessibilityTests "https://github.com/ONSdigital/sdg-indicators/tree/develop//scripts/accessibility-test/"
    click DataStorage "https://github.com/ONSdigital/sdg-indicators/blob/develop//_data/site_config.yml"
    click Posts "https://github.com/ONSdigital/sdg-indicators/tree/develop//_posts/"
    click Pages "https://github.com/ONSdigital/sdg-indicators/tree/develop//_pages/"
    click GithubActions "https://github.com/ONSdigital/sdg-indicators/blob/develop//.github/workflows/deploy-to-production.yml"
    click Production "https://github.com/ONSdigital/sdg-indicators/blob/develop//_config_prod.yml"

    %% Styling
    classDef frontend fill:#3498db,stroke:#2980b9,color:white
    classDef integration fill:#e67e22,stroke:#d35400,color:white
    classDef core fill:#2ecc71,stroke:#27ae60,color:white
    classDef data fill:#95a5a6,stroke:#7f8c8d,color:white
    classDef pipeline fill:#9b59b6,stroke:#8e44ad,color:white

    %% Legend
    subgraph Legend
        Frontend["Frontend Component"]:::frontend
        IntegrationService["Integration Service"]:::integration
        CoreSystem["Core System"]:::core
        DataComponent["Data Component"]:::data
        PipelineComponent["Pipeline Component"]:::pipeline
    end
```
