# jozieliosantiago/anime-library architecture

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

- Interactive diagram: https://gitdiagram.com/jozieliosantiago/anime-library
- Repository: https://github.com/jozieliosantiago/anime-library

## Overview

##### Project type and purpose
- This is a frontend-focused full-stack (Next.js) React/TypeScript web application called “Anime Library.”
- Purpose: Display a catalog of anime titles on a home page and detailed views per anime (synopsis, categories, trailer, episode list). It fetches data at runtime (SSR/CSR) from the external Kitsu API.

##### File structure
- Top-level config and meta:
- next.config.js, tsconfig.json, .eslintrc.json, package.json
- README.md, .gitignore, .github folder (CI, LICENSE)
- Public assets:
- Source code under src/:
- pages/ — Next.js file-based routes (_app.tsx, index.tsx, anime/[id].tsx)
- components/ — UI building blocks (Header, Carousel, MovieCard, AnimeSynopsis, EpisodeDetails, Loading, etc.)
- services/ — API client (kitsuApi.ts)
- styles/ — global.scss and per-page SASS modules
- types.ts and utils/ (helper functions)

##### README for additional insights
- Architecture: Standard Next.js SSR/CSR, no custom backend.
- Dependencies: ReactJS, TypeScript, NextJS, Ant Design, SASS.
- Deployment targets: Vercel or Heroku.
- Runtime behavior:
- On each page request, Next.js may fetch data via kitsuApi (Axios or fetch)
- Props are hydrated into React components

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Layers and Entities
    subgraph "User Agent"
        Browser["Browser"]:::infra
    end

    subgraph "Next.js Application"
        direction TB

        subgraph "Pages Layer"
            direction TB
            App["_app.tsx"]:::pages
            Document["_document.tsx"]:::pages
            Home["index.tsx"]:::pages
            AnimePage["[id].tsx"]:::pages
        end

        subgraph "UI Components Layer"
            direction TB
            Header["Header"]:::components
            Carousel["Carousel"]:::components
            MovieCard["MovieCard"]:::components
            AnimeSynopsis["AnimeSynopsis"]:::components
            EpisodeDetails["EpisodeDetails"]:::components
            AverageRating["AverageRating"]:::components
            Loading["Loading"]:::components
        end

        subgraph "Service Layer"
            kitsuApi["kitsuApi.ts"]:::service
        end

        subgraph "Styles & Types"
            direction TB
            GlobalStyles["global.scss"]:::styles
            HomeStyles["home.module.scss"]:::styles
            Utils["getAgeRatingGuide.ts"]:::utils
            Types["types.ts"]:::utils
        end
    end

    subgraph "External Services"
        KitsuAPI["Kitsu REST API"]:::external
    end

    subgraph "Deployment Platform"
        Vercel["Vercel/Heroku"]:::external
    end

    %% Connections
    Browser -->|"HTTP GET page request"| App
    App -->|"Render Page"| Browser
    App -->|"Uses file-based routing"| Home
    App -->|"Uses file-based routing"| AnimePage
    Home -->|"Imports components"| Header
    Home -->|"Imports components"| Carousel
    AnimePage -->|"Imports components"| AnimeSynopsis
    AnimePage -->|"Imports components"| EpisodeDetails
    AnimeSynopsis -->|"Uses rating data"| AverageRating
    Home -->|"Uses MovieCard"| MovieCard
    Home -->|"Shows loading"| Loading
    App -->|"Loads styles"| GlobalStyles
    Home -->|"Loads styles"| HomeStyles
    App -->|"Hydrates types"| Types
    App -->|"Uses utils"| Utils

    App -->|"Server-side fetch"| kitsuApi
    kitsuApi -->|"Fetch JSON"| KitsuAPI
    KitsuAPI -->|"Return JSON"| kitsuApi
    Browser -->|"Client-side fetch"| kitsuApi

    Vercel -->|"Deploy Next.js Application"| App

    %% Click Events for component files
    click App "https://github.com/jozieliosantiago/anime-library/blob/main/src/pages/_app.tsx"
    click Document "https://github.com/jozieliosantiago/anime-library/blob/main/src/pages/_document.tsx"
    click Home "https://github.com/jozieliosantiago/anime-library/blob/main/src/pages/index.tsx"
    click AnimePage "https://github.com/jozieliosantiago/anime-library/blob/main/src/pages/anime/[id].tsx"
    click Header "https://github.com/jozieliosantiago/anime-library/blob/main/src/components/Header/index.tsx"
    click Carousel "https://github.com/jozieliosantiago/anime-library/blob/main/src/components/Carousel/index.tsx"
    click MovieCard "https://github.com/jozieliosantiago/anime-library/blob/main/src/components/MovieCard/index.tsx"
    click AnimeSynopsis "https://github.com/jozieliosantiago/anime-library/blob/main/src/components/AnimeSynopsis/indext.tsx"
    click EpisodeDetails "https://github.com/jozieliosantiago/anime-library/blob/main/src/components/EpisodeDetails/index.tsx"
    click AverageRating "https://github.com/jozieliosantiago/anime-library/blob/main/src/components/AverageRating/index.tsx"
    click Loading "https://github.com/jozieliosantiago/anime-library/blob/main/src/components/Loading/index.tsx"
    click kitsuApi "https://github.com/jozieliosantiago/anime-library/blob/main/src/services/kitsuApi.ts"
    click GlobalStyles "https://github.com/jozieliosantiago/anime-library/blob/main/src/styles/global.scss"
    click HomeStyles "https://github.com/jozieliosantiago/anime-library/blob/main/src/styles/home.module.scss"
    click Utils "https://github.com/jozieliosantiago/anime-library/blob/main/utils/getAgeRatingGuide.ts"
    click Types "https://github.com/jozieliosantiago/anime-library/blob/main/src/types.ts"

    %% Styles
    classDef infra fill:#d3d3d3,stroke:#333,stroke-width:1px
    classDef pages fill:#cce5ff,stroke:#0056b3,stroke-width:1px
    classDef components fill:#b3e6b3,stroke:#238823,stroke-width:1px
    classDef service fill:#ffebcc,stroke:#cc7a00,stroke-width:1px
    classDef styles fill:#e6ccff,stroke:#663399,stroke-width:1px
    classDef utils fill:#ffe6e6,stroke:#cc0000,stroke-width:1px
    classDef external fill:#d9f2d9,stroke:#2e7d32,stroke-width:1px
```
