# scratchjp/mcscrjp architecture

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

- Interactive diagram: https://gitdiagram.com/scratchjp/mcscrjp
- Repository: https://github.com/scratchjp/mcscrjp

## Overview

##### Project Type & Purpose
- This project is a statically generated website (mcscr.jp) powered by Eleventy. It serves as a content-rich website with pages related to “facilities”, “regions”, “railway”, etc.
- The README notes that the site generation is now handled by Eleventy (v2.0.0+), with deployment on Cloudflare Pages, while Node.js is used as the runtime environment for building and serving the site.

##### Breakdown of the File Structure
- Configuration & Build:
- ".eleventy.js" is the Eleventy configuration file dictating how content is compiled.
- "package.json" and "package-lock.json" define the Node.js dependencies and scripts (e.g., build, start).
- Data Files:
- The "_data" folder holds JSON files (facilities.json, navigation.json, etc.) that supply dynamic data to the templates.
- Templates & Layouts:
- The "_layouts" folder contains layout templates like "default.njk", "facility.njk", and "region.njk", which structure page designs.
- The "_includes" folder holds partials like "header.njk" and "footer.njk" that are reused across pages.
- Assets & Content:
- The "assets" folder stores static content such as images, organized into subdirectories.
- The "facility", "region", and "railway" directories each contain HTML files that likely correspond to individual pages or content categories.
- Supporting Files:
- Files like "index.html" and "server.html" provide entry points for the web pages.
- "scripts" and "styles" directories host JavaScript and CSS files to drive interactivity and styling.

##### Key Components
a. Core Build Environment:
- Node.js and npm (for dependency management and running Eleventy commands).
- Eleventy static site generator, which reads configuration from ".eleventy.js" and uses the templates, data, and pages to build static HTML.
b. Data & Template Layers:
- Data Layer: Represents the "_data" directory with its JSON files.
- Template Layer: Combines "_layouts" and "_includes" components to form the base layout and common UI elements.
c. Content/Static Files:
- Directories named "facility", "region", and "railway" which include the actual HTML content that might be enhanced or driven by the templates.
- Assets folder for images/media.
d. Client-Side Components:
- Scripts (JS files) and Styles (CSS files) that render on the client-side.

##### Relationships & Interactions
- The build process (initiated via npm commands or Eleventy CLI) pulls data from the "_data" folder.
- Eleventy uses templates from the "_layouts" and "_includes" directories to map content from various regions of the site (pages under "facility", "region", "railway").
- Process flow: Data and content are fed into templates → Eleventy builds static HTML pages → Assets, scripts, and styles are linked for a seamless frontend experience.
- After the build, the static site can be deployed to Cloudflare Pages, with the server.html optionally used for previewing or additional configurations.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Build Environment
    subgraph "Build Environment"
        NodeEnv["Node.js Environment"]:::config
        Eleventy["Eleventy Build Process"]:::config
    end

    %% Source Files
    subgraph "Source Files"
        Data["_data (Dynamic JSON)"]:::data
        subgraph "Templates & Layouts"
            Layouts["_layouts (Layout Templates)"]:::template
            Partials["_includes (Partials)"]:::template
        end
        subgraph "Content Pages"
            Facilities["facility (Facilities)"]:::content
            Regions["region (Regions)"]:::content
            Railway["railway (Railway)"]:::content
            Additional["Additional Pages (index, recruitment, server)"]:::content
        end
    end

    %% Build Output and Client Components
    Static["Static Site Output"]:::static
    subgraph "Client-Side Components"
        Assets["assets (Static Assets)"]:::client
        Scripts["scripts (JavaScript)"]:::client
        Styles["styles (CSS)"]:::client
    end

    %% Relationships
    NodeEnv -->|"executesBuild"| Eleventy
    Eleventy -->|"reads"| Data
    Eleventy -->|"reads"| Layouts
    Eleventy -->|"reads"| Partials
    Eleventy -->|"reads"| Facilities
    Eleventy -->|"reads"| Regions
    Eleventy -->|"reads"| Railway
    Eleventy -->|"reads"| Additional
    Eleventy -->|"generates"| Static
    Static -->|"dependsOn"| Assets
    Static -->|"dependsOn"| Scripts
    Static -->|"dependsOn"| Styles

    %% Click Events for Build Environment
    click NodeEnv "https://github.com/scratchjp/mcscrjp/blob/main/package.json"
    click Eleventy "https://github.com/scratchjp/mcscrjp/blob/main/.eleventy.js"

    %% Click Events for Data & Templates
    click Data "https://github.com/scratchjp/mcscrjp/tree/main/_data"
    click Layouts "https://github.com/scratchjp/mcscrjp/tree/main/_layouts"
    click Partials "https://github.com/scratchjp/mcscrjp/tree/main/_includes"

    %% Click Events for Content Pages
    click Facilities "https://github.com/scratchjp/mcscrjp/tree/main/facility"
    click Regions "https://github.com/scratchjp/mcscrjp/tree/main/region"
    click Railway "https://github.com/scratchjp/mcscrjp/tree/main/railway"
    click Additional "https://github.com/scratchjp/mcscrjp/blob/main/index.html"

    %% Click Events for Client-Side Components
    click Assets "https://github.com/scratchjp/mcscrjp/tree/main/assets"
    click Scripts "https://github.com/scratchjp/mcscrjp/tree/main/scripts"
    click Styles "https://github.com/scratchjp/mcscrjp/tree/main/styles"

    %% Styles
    classDef config fill:#FFCCCC,stroke:#333,stroke-width:2px;
    classDef data fill:#ADD8E6,stroke:#333,stroke-width:2px;
    classDef template fill:#90EE90,stroke:#333,stroke-width:2px;
    classDef content fill:#FFFF99,stroke:#333,stroke-width:2px;
    classDef client fill:#E6E6FA,stroke:#333,stroke-width:2px;
    classDef static fill:#D3D3D3,stroke:#333,stroke-width:2px;
```
