# samheart564/test_ecgc_2 architecture

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

- Interactive diagram: https://gitdiagram.com/samheart564/test_ecgc_2
- Repository: https://github.com/samheart564/test_ecgc_2

## Overview

##### Project Type and Purpose
- This is an Astro project, meaning it’s primarily a static site generator built with Astro. The README confirms the use of Astro starter templates, so the front end is defined as a set of pages, layouts, and components.
- Beyond a simple static site, the file tree reveals a rich collection of data scripts and utilities under the "dev_tools" directory (including multiple parsing scripts, automated upload scripts, changelog generators, and data transformation scripts). In addition, there is a directory called "AzurLaneData" and specialized directories like "src/db" that store JSON assets. This indicates that the site serves as a hub for processing and presenting game-related data (likely related to ship data and rankings in Azur Lane).
- Thus, the purpose is dual: rendering a highly interactive and detailed website (with multiple pages – equipment, research, fleet technology, etc.) and supporting data ingestion, transformation, and caching using backend tools/scripts.

##### Analyzing the File Structure
- The top-level directories include:
- /src: Houses the main website code (pages, components, layouts, styles, utilities, and the database folder with cached JSON data).
- /dev_tools: Contains various scripts and utilities for data processing, including parsing various ship attributes (e.g., hull types, roles, locations), data uploading (possibly to ImgUr), changelog generation, and automated tasks.
- .github: Contains CI/CD workflows (deployment YAML).
- Configuration files like astro.config.ts, tailwind.config.ts, package.json, and bun-related files indicate build, lint, and deployment configuration.
- The project clearly separates concerns: runtime static website code (/src) is separated from data processing and utility scripts (/dev_tools), supporting a clean architecture that favors modularity.

##### Architectural Components to Capture
a. Frontend Layer (Static Website):
- Components: The /src/components folder is extensive, covering everything from common UI elements (e.g., Navbar, Ship Modal, Skeleton loaders) to specialized content (e.g., Changelog, Equipment, Shop Priority, etc.).
- Pages: The /src/pages folder shows routes (e.g., changelog, research, equipment, etc.).
- Layouts: Defined in /src/layouts to wrap pages consistently.
- Assets & Styling: /src/assets and /src/styles provide static content (images, CSS) along with utility styles.

b. Data Layer:
- Database/Caching: The /src/db folder stores processed JSON datasets for ship data, EHP (Effective Hit Points), rankings, etc. This acts as a local “database” for the static site.
- Data Processing Tools: Within /dev_tools, there are many scripts related to processing external data sources (e.g., parsing ship data, converting Google Sheets to images, automated image uploads). These are run during the build or update cycle to populate the cached data in /src/db or /dev_tools/ship_data.

c. Build & Deployment Infrastructure:
- CI/CD: The .github/workflows (deploy.yml) indicates automated deployment processes.
- Configurations: Files like astro.config.ts and tailwind.config.ts set up how the site is built and styled.

d. Development Utilities:
- Miscellaneous scripts in /dev_tools support non-runtime aspects such as changelog generation and various parsing operations that update resource JSON files.
- These tools serve as pipeline components for data ingestion, transformation, and updating the site’s “backend” content.

##### Relationships and Data Flow
- Data Processing Pipeline: Data comes in (possibly from external sources) and is processed through the various Python and TypeScript scripts in the dev_tools folder. The output is saved as JSON files in /src/db or similar locations.
- Frontend Rendering: The Astro pages, components, and layouts in /src access these JSON files (and possibly other data assets) to render pages dynamically at build time.
- CI/CD pipeline (via GitHub Actions) automates both the deployment of the site and possibly the execution of some of these data processing tasks.
- There is a clear separation—the static (client-side) representation and the build-time data ingestion/processing components interact at build time but remain modular and distinct.

##### Architectural Patterns/Design Principles
- Separation of Concerns: Dev_tools (backend data processing) are clearly separated from the front-end code.
- Static Site Generation (SSG): Astro’s SSG is used to pre-render the site, leveraging the processed JSON data.
- Modular and Component-Based Architecture: The extensive use of components in /src/components indicates a highly modular design improved by reusability (e.g., common resource components, modal windows, navigational elements).
- Pipeline Pattern: The dev_tools directory acts like a data processing pipeline that transforms raw data inputs into consumable static assets.

##### Detailed Elements
- Each main component should be clearly labeled.
- Optionally, mark configuration points (CI/CD workflows, Astro config) with annotations referencing their specific files (e.g., .github/workflows/deploy.yml, astro.config.ts).
- Distinguish between static build-time processes (data ingestion and transformation) and runtime serving (front-end presentation).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend (Static Website)
    subgraph "Frontend (Static Website)"
        Pages["Pages (/src/pages)"]:::frontend
        Components["Components (/src/components)"]:::frontend
        Layouts["Layouts (/src/layouts)"]:::frontend
        Assets["Assets (/src/assets)"]:::frontend
        Styles["Styles (/src/styles)"]:::frontend
        Build["Astro Build Process"]:::frontend
        Published["Published Website (/dist)"]:::frontend
    end

    %% Data Layer (JSON Database & Caching)
    subgraph "Data Layer (JSON Database & Caching)"
        DB["JSON Data (/src/db)"]:::data
        RawData["Raw Data (AzurLaneData)"]:::data
    end

    %% Data Processing Pipeline (Dev Tools)
    subgraph "Data Processing Pipeline (Dev Tools)"
        DevTools["Dev Tools (/dev_tools)"]:::pipeline
        aaParsing["aa_parsing (/dev_tools/aa_parsing)"]:::pipeline
        Changelog["changelog (/dev_tools/changelog)"]:::pipeline
        EHPParsing["ehp_parsing (/dev_tools/ehp_parsing)"]:::pipeline
        EndGameAL["end_game_al_rankings (/dev_tools/end_game_al_rankings)"]:::pipeline
        GSheets2Img["gsheets2img (/dev_tools/gsheets2img)"]:::pipeline
        ReplaceLinks["replace_links (/dev_tools/replace_links)"]:::pipeline
        Samvaluation["samvaluation (/dev_tools/samvaluation)"]:::pipeline
        ShipDataTools["ship_data (/dev_tools/ship_data)"]:::pipeline
        Ships["ships (/dev_tools/ships)"]:::pipeline
        TOC["toc_generator (/dev_tools/toc_generator)"]:::pipeline
        AutomatedImgur["automated_imgur_upload (/dev_tools/automated_imgur_upload)"]:::pipeline
    end

    %% Build & Deployment Infrastructure
    subgraph "Build & Deployment Infrastructure"
        CI["CI/CD (.github/workflows/deploy.yml)"]:::infra
        AstroConfig["astro.config.ts"]:::infra
        TailwindConfig["tailwind.config.ts"]:::infra
        Package["package.json"]:::infra
        BunLock["bun.lock"]:::infra
        Bunfig["bunfig.toml"]:::infra
    end

    %% Data Flow Connections
    RawData ---|"feeds"| DevTools
    DevTools ---|"contains"| aaParsing
    DevTools ---|"contains"| Changelog
    DevTools ---|"contains"| EHPParsing
    DevTools ---|"contains"| EndGameAL
    DevTools ---|"contains"| GSheets2Img
    DevTools ---|"contains"| ReplaceLinks
    DevTools ---|"contains"| Samvaluation
    DevTools ---|"contains"| ShipDataTools
    DevTools ---|"contains"| Ships
    DevTools ---|"contains"| TOC
    DevTools ---|"contains"| AutomatedImgur
    DevTools ---|"processes"| DB
    DB ---|"supplies"| Build

    %% Frontend Build Process Composition
    Pages ---|"usedBy"| Build
    Components ---|"usedBy"| Build
    Layouts ---|"usedBy"| Build
    Assets ---|"usedBy"| Build
    Styles ---|"usedBy"| Build
    Build ---|"generates"| Published

    %% Build & Deployment influence
    CI ---|"triggers"| DevTools
    CI ---|"triggers"| Build
    AstroConfig ---|"configures"| Build
    TailwindConfig ---|"configures"| Build
    Package ---|"manages"| Build
    BunLock ---|"locks"| Build
    Bunfig ---|"defines"| Build

    %% Click Events for Frontend
    click Pages "https://github.com/samheart564/test_ecgc_2/tree/main/src/pages"
    click Components "https://github.com/samheart564/test_ecgc_2/tree/main/src/components"
    click Layouts "https://github.com/samheart564/test_ecgc_2/tree/main/src/layouts"
    click Assets "https://github.com/samheart564/test_ecgc_2/tree/main/src/assets"
    click Styles "https://github.com/samheart564/test_ecgc_2/tree/main/src/styles"

    %% Click Events for Data Layer
    click DB "https://github.com/samheart564/test_ecgc_2/tree/main/src/db"
    click RawData "https://github.com/samheart564/test_ecgc_2/tree/main/AzurLaneData"

    %% Click Events for Data Processing Pipeline
    click DevTools "https://github.com/samheart564/test_ecgc_2/tree/main/dev_tools"
    click aaParsing "https://github.com/samheart564/test_ecgc_2/tree/main/dev_tools/aa_parsing"
    click Changelog "https://github.com/samheart564/test_ecgc_2/tree/main/dev_tools/changelog"
    click EHPParsing "https://github.com/samheart564/test_ecgc_2/tree/main/dev_tools/ehp_parsing"
    click EndGameAL "https://github.com/samheart564/test_ecgc_2/tree/main/dev_tools/end_game_al_rankings"
    click GSheets2Img "https://github.com/samheart564/test_ecgc_2/tree/main/dev_tools/gsheets2img"
    click ReplaceLinks "https://github.com/samheart564/test_ecgc_2/tree/main/dev_tools/replace_links"
    click Samvaluation "https://github.com/samheart564/test_ecgc_2/tree/main/dev_tools/samvaluation"
    click ShipDataTools "https://github.com/samheart564/test_ecgc_2/tree/main/dev_tools/ship_data"
    click Ships "https://github.com/samheart564/test_ecgc_2/tree/main/dev_tools/ships"
    click TOC "https://github.com/samheart564/test_ecgc_2/tree/main/dev_tools/toc_generator"
    click AutomatedImgur "https://github.com/samheart564/test_ecgc_2/tree/main/dev_tools/automated_imgur_upload"

    %% Click Events for Build & Deployment Infrastructure
    click CI "https://github.com/samheart564/test_ecgc_2/blob/main/.github/workflows/deploy.yml"
    click AstroConfig "https://github.com/samheart564/test_ecgc_2/blob/main/astro.config.ts"
    click TailwindConfig "https://github.com/samheart564/test_ecgc_2/blob/main/tailwind.config.ts"
    click Package "https://github.com/samheart564/test_ecgc_2/blob/main/package.json"
    click BunLock "https://github.com/samheart564/test_ecgc_2/blob/main/bun.lock"
    click Bunfig "https://github.com/samheart564/test_ecgc_2/blob/main/bunfig.toml"

    %% Styling Classes
    classDef frontend fill:#C7E9FF,stroke:#0275d8,stroke-width:2px;
    classDef data fill:#d0f0c0,stroke:#5cb85c,stroke-width:2px;
    classDef pipeline fill:#FFE4B5,stroke:#f0ad4e,stroke-width:2px;
    classDef infra fill:#F7D08A,stroke:#f0ad4e,stroke-width:2px;
```
