# alexanderthebored/book-animation-test architecture

> Architecture diagram of the GitHub repository alexanderthebored/book-animation-test, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-07-17). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/alexanderthebored/book-animation-test
- Repository: https://github.com/alexanderthebored/book-animation-test

## Overview

##### Project type and purpose
- This is a static, full-stack-lite web application for browsing and reading manga.
- It provides a library view (index.html) and a reader view (mangareader.html), uses a local JSON data file and image assets, and includes CLI tools for asset management.

##### File structure
- Top level:
- index.html (Library page)
- mangareader.html (Reader page)
- data/manga.json (Metadata store)
- assets/ (covers + per-manga chapter images)
- components/ (reusable UI modules: book-card, header, logo)
- styles/main.css (global styling)
- tools/ (Node scripts for downloading manga and generating JSON)
- dev-tools/admin.html (CLI command UI)
- No server-side code: static files are served by any HTTP server.

##### Key README insights
- The app loads manga.json, renders animated book cards, and on click navigates to the reader which fetches images by path.
- CLI tools automate downloading and organizing images and JSON metadata.

##### Main components & relationships
a. Frontend Pages
- Library Page (index.html)
- Reader Page (mangareader.html)
b. Data Layer
- manga.json (fetched via HTTP)
- assets/covers/*.jpg|png (cover images)
- assets/manga/[folder]/ch-X/page-NNN.jpg (chapter pages)
c. UI Components
- book-card (handles animation, click → openReader)
- header & logo (static branding)
d. Tooling
- Node scripts under tools/ (batch-download, generate JSON, etc.)
- dev-tools/admin.html (converts MangaDex links → CLI commands)

##### Interactions & Data Flow
- Browser requests index.html → loads CSS, book-card.js, fetches manga.json → renders book cards with cover images.
- On “Open Reader”: browser navigates to mangareader.html?slug=[manga] → fetches corresponding folder and chapter image assets.

##### Architectural patterns & principles
- Component-based UI (simple “vanilla” Web Components / JS modules).
- Clear separation: data (JSON & images) vs. presentation (HTML/CSS/JS).
- Static-only architecture: no backend; everything fetched over HTTP.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Static Hosting"
        Server["Static File Server (HTTP)"]:::server
    end

    subgraph "Client (Browser)"
        Browser["Browser"]:::frontend
        Browser --> Server
        Browser --> LibraryPage
        Browser --> ReaderPage
    end

    LibraryPage["index.html\n(Library Page)"]:::frontend
    ReaderPage["mangareader.html\n(Reader Page)"]:::frontend

    subgraph "UI Components"
        BookCardHTML["book-card.html"]:::frontend
        BookCardCSS["book-card.css"]:::frontend
        BookCardJS["book-card.js"]:::frontend
        HeaderHTML["header.html"]:::frontend
        HeaderCSS["header.css"]:::frontend
        LogoHTML["logo.html"]:::frontend
        LogoCSS["logo.css"]:::frontend
    end

    GlobalCSS["styles/main.css"]:::frontend

    subgraph "Data & Assets"
        MangaJSON["data/manga.json"]:::data
        CoversDir["assets/covers/"]:::data
        ChaptersDir["assets/manga/"]:::data
    end

    subgraph "CLI Toolset"
        BatchDL["batch-download-manga.js"]:::tool
        DownloadChap["download-chapter.js"]:::tool
        GenJSON["generate-manga-json.js"]:::tool
        MDLink["mangadex-link.js"]:::tool
        CmdRef["commands-reference.txt"]:::tool
        DevAdmin["dev-tools/admin.html"]:::tool
    end

    LibraryPage -->|HTTP GET| MangaJSON
    LibraryPage -->|HTTP GET| CoversDir
    ReaderPage -->|HTTP GET| ChaptersDir

    LibraryPage --> BookCardHTML
    LibraryPage --> HeaderHTML
    LibraryPage --> LogoHTML
    LibraryPage --> GlobalCSS

    ReaderPage --> HeaderHTML
    ReaderPage --> LogoHTML
    ReaderPage --> GlobalCSS

    BatchDL -->|file write| CoversDir
    BatchDL -->|file write| ChaptersDir
    DownloadChap -->|file write| ChaptersDir
    GenJSON -->|file write| MangaJSON
    MDLink -->|reads/writes| CmdRef
    DevAdmin -->|reads| CmdRef

    classDef frontend fill:#D0E1FF,stroke:#0366d6,color:#000
    classDef data fill:#C6F6D5,stroke:#2F855A,color:#000
    classDef tool fill:#FFE7C7,stroke:#DD6B20,color:#000
    classDef server fill:#E2E8F0,stroke:#4A5568,color:#000

    click LibraryPage "https://github.com/alexanderthebored/book-animation-test/blob/main/index.html"
    click ReaderPage "https://github.com/alexanderthebored/book-animation-test/blob/main/mangareader.html"
    click MangaJSON "https://github.com/alexanderthebored/book-animation-test/blob/main/data/manga.json"
    click CoversDir "https://github.com/alexanderthebored/book-animation-test/tree/main/assets/covers/"
    click ChaptersDir "https://github.com/alexanderthebored/book-animation-test/tree/main/assets/manga/"
    click BookCardHTML "https://github.com/alexanderthebored/book-animation-test/blob/main/components/book-card/book-card.html"
    click BookCardCSS "https://github.com/alexanderthebored/book-animation-test/blob/main/components/book-card/book-card.css"
    click BookCardJS "https://github.com/alexanderthebored/book-animation-test/blob/main/components/book-card/book-card.js"
    click HeaderHTML "https://github.com/alexanderthebored/book-animation-test/blob/main/components/header/header.html"
    click HeaderCSS "https://github.com/alexanderthebored/book-animation-test/blob/main/components/header/header.css"
    click LogoHTML "https://github.com/alexanderthebored/book-animation-test/blob/main/components/logo/logo.html"
    click LogoCSS "https://github.com/alexanderthebored/book-animation-test/blob/main/components/logo/logo.css"
    click GlobalCSS "https://github.com/alexanderthebored/book-animation-test/blob/main/styles/main.css"
    click BatchDL "https://github.com/alexanderthebored/book-animation-test/blob/main/tools/batch-download-manga.js"
    click DownloadChap "https://github.com/alexanderthebored/book-animation-test/blob/main/tools/download-chapter.js"
    click GenJSON "https://github.com/alexanderthebored/book-animation-test/blob/main/tools/generate-manga-json.js"
    click MDLink "https://github.com/alexanderthebored/book-animation-test/blob/main/tools/mangadex-link.js"
    click CmdRef "https://github.com/alexanderthebored/book-animation-test/blob/main/tools/commands-reference.txt"
    click DevAdmin "https://github.com/alexanderthebored/book-animation-test/blob/main/dev-tools/admin.html"
```
