# julirey/catlibrary architecture

> Architecture diagram of the GitHub repository julirey/catlibrary, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-07). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/julirey/catlibrary
- Repository: https://github.com/julirey/catlibrary

## Overview

Catlibrary is a browser-based cat-breed library. Its main workflow fetches paginated breeds and images for a catalogue, lets a visitor open a breed’s details, and saves selected breeds in browser favorites; separate home and Explore views show cat-image slideshows and a masonry gallery. The graph also preserves shared page-template utilities and the join page visible in the tree, though its behavior is not described. Source excerpts support the JavaScript calls and API requests; page-to-script wiring and the join flow were not shown, so those links are omitted.

Main entry points: [`src/js/breedList.mjs`](https://github.com/julirey/catlibrary/blob/main/src/js/breedList.mjs) (Breed data and catalogue), [`src/js/utils.mjs`](https://github.com/julirey/catlibrary/blob/main/src/js/utils.mjs) (Shared utilities), [`src/js/cats.mjs`](https://github.com/julirey/catlibrary/blob/main/src/js/cats.mjs) (Cat image service), [`src/js/breedDetails.mjs`](https://github.com/julirey/catlibrary/blob/main/src/js/breedDetails.mjs) (Breed details)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_visitor_views["Visitor views"]
  node_home_page["Home page<br/>[index.html]"]
  node_home_controller["Home controller<br/>[home.js]"]
  node_explore_page["Explore page<br/>[index.html]"]
  node_explore_controller["Explore controller<br/>[explore.js]"]
  node_join_page["Join page<br/>[index.html]"]
  node_join_confirmation["Join confirmation<br/>[thankyou.html]"]
end

subgraph group_breed_features["Breed features"]
  node_catalogue_page["Catalogue page<br/>[index.html]"]
  node_catalogue_controller["Catalogue controller<br/>[catalogue.js]"]
  node_breed_page["Breed page<br/>[index.html]"]
  node_breed_controller["Breed controller<br/>[breed.js]"]
  node_breed_details["Breed details<br/>[breedDetails.mjs]"]
  node_breed_service["Breed data and catalogue<br/>[breedList.mjs]"]
  node_favorites_page["Favorites page<br/>[index.html]"]
  node_favorites_controller["Favorites controller<br/>[favorite.js]"]
end

subgraph group_image_gallery["Image gallery"]
  node_cat_images["Cat image service<br/>[cats.mjs]"]
  node_slideshow["Slideshow controls<br/>[slideshow.mjs]"]
end

subgraph group_shared_runtime["Shared runtime"]
  node_shared_utils["Shared utilities<br/>[utils.mjs]"]
  node_site_shell["Site shell controller<br/>[main.js]"]
end

node_visitor(("Visitor"))
node_cat_api["TheCatAPI"]
node_browser_storage[("Browser local storage")]

node_home_controller -->|"requests slideshow"| node_cat_images
node_explore_controller -->|"requests gallery"| node_cat_images
node_catalogue_controller -->|"reads page parameter"| node_shared_utils
node_catalogue_controller -->|"requests breed list"| node_breed_service
node_breed_controller -->|"reads breed parameter"| node_shared_utils
node_breed_controller -->|"requests breed image"| node_breed_service
node_breed_controller -->|"initializes details"| node_breed_details
node_breed_details -->|"loads breed"| node_breed_service
node_breed_details -->|"uses storage and stats"| node_shared_utils
node_breed_service -->|"fetches breed data"| node_cat_api
node_breed_service -->|"requests breed images"| node_cat_images
node_cat_images -->|"fetches cat images"| node_cat_api
node_cat_images -->|"controls slides"| node_slideshow
node_favorites_controller -->|"loads favorites"| node_shared_utils
node_favorites_controller -->|"renders favorites"| node_breed_service
node_breed_details -->|"reads and saves"| node_browser_storage
node_shared_utils -->|"reads and writes"| node_browser_storage
node_site_shell -->|"loads shared shell"| node_shared_utils

click node_home_page "https://github.com/julirey/catlibrary/blob/main/src/index.html"
click node_home_controller "https://github.com/julirey/catlibrary/blob/main/src/js/home.js"
click node_explore_page "https://github.com/julirey/catlibrary/blob/main/src/explore/index.html"
click node_explore_controller "https://github.com/julirey/catlibrary/blob/main/src/js/explore.js"
click node_catalogue_page "https://github.com/julirey/catlibrary/blob/main/src/catalogue/index.html"
click node_catalogue_controller "https://github.com/julirey/catlibrary/blob/main/src/js/catalogue.js"
click node_breed_page "https://github.com/julirey/catlibrary/blob/main/src/breed/index.html"
click node_breed_controller "https://github.com/julirey/catlibrary/blob/main/src/js/breed.js"
click node_breed_details "https://github.com/julirey/catlibrary/blob/main/src/js/breedDetails.mjs"
click node_breed_service "https://github.com/julirey/catlibrary/blob/main/src/js/breedList.mjs"
click node_favorites_page "https://github.com/julirey/catlibrary/blob/main/src/favorite/index.html"
click node_favorites_controller "https://github.com/julirey/catlibrary/blob/main/src/js/favorite.js"
click node_join_page "https://github.com/julirey/catlibrary/blob/main/src/join/index.html"
click node_join_confirmation "https://github.com/julirey/catlibrary/blob/main/src/join/thankyou.html"
click node_cat_images "https://github.com/julirey/catlibrary/blob/main/src/js/cats.mjs"
click node_slideshow "https://github.com/julirey/catlibrary/blob/main/src/js/slideshow.mjs"
click node_shared_utils "https://github.com/julirey/catlibrary/blob/main/src/js/utils.mjs"
click node_site_shell "https://github.com/julirey/catlibrary/blob/main/src/js/main.js"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_home_page,node_home_controller,node_explore_page,node_explore_controller,node_join_page,node_join_confirmation toneBlue
class node_catalogue_page,node_catalogue_controller,node_breed_page,node_breed_controller,node_breed_details,node_breed_service,node_favorites_page,node_favorites_controller,node_browser_storage toneAmber
class node_cat_images,node_slideshow,node_cat_api toneMint
class node_shared_utils,node_site_shell toneRose
class node_visitor toneIndigo
```

## Components

### Visitor views

- [Home page](https://github.com/julirey/catlibrary/blob/main/src/index.html): `src/index.html`
- [Home controller](https://github.com/julirey/catlibrary/blob/main/src/js/home.js): `src/js/home.js`
- [Explore page](https://github.com/julirey/catlibrary/blob/main/src/explore/index.html): `src/explore/index.html`
- [Explore controller](https://github.com/julirey/catlibrary/blob/main/src/js/explore.js): `src/js/explore.js`
- [Join page](https://github.com/julirey/catlibrary/blob/main/src/join/index.html): `src/join/index.html`
- [Join confirmation](https://github.com/julirey/catlibrary/blob/main/src/join/thankyou.html): `src/join/thankyou.html`

### Breed features

- [Catalogue page](https://github.com/julirey/catlibrary/blob/main/src/catalogue/index.html): `src/catalogue/index.html`
- [Catalogue controller](https://github.com/julirey/catlibrary/blob/main/src/js/catalogue.js): `src/js/catalogue.js`
- [Breed page](https://github.com/julirey/catlibrary/blob/main/src/breed/index.html): `src/breed/index.html`
- [Breed controller](https://github.com/julirey/catlibrary/blob/main/src/js/breed.js): `src/js/breed.js`
- [Breed details](https://github.com/julirey/catlibrary/blob/main/src/js/breedDetails.mjs): `src/js/breedDetails.mjs`
- [Breed data and catalogue](https://github.com/julirey/catlibrary/blob/main/src/js/breedList.mjs): `src/js/breedList.mjs`
- [Favorites page](https://github.com/julirey/catlibrary/blob/main/src/favorite/index.html): `src/favorite/index.html`
- [Favorites controller](https://github.com/julirey/catlibrary/blob/main/src/js/favorite.js): `src/js/favorite.js`

### Image gallery

- [Cat image service](https://github.com/julirey/catlibrary/blob/main/src/js/cats.mjs): `src/js/cats.mjs`
- [Slideshow controls](https://github.com/julirey/catlibrary/blob/main/src/js/slideshow.mjs): `src/js/slideshow.mjs`

### Shared runtime

- [Shared utilities](https://github.com/julirey/catlibrary/blob/main/src/js/utils.mjs): `src/js/utils.mjs`
- [Site shell controller](https://github.com/julirey/catlibrary/blob/main/src/js/main.js): `src/js/main.js`

### Other components

- **Visitor**
- **TheCatAPI**
- **Browser local storage**

## Connections

- Home controller → Cat image service: requests slideshow (evidence: `src/js/home.js`)
- Explore controller → Cat image service: requests gallery (evidence: `src/js/explore.js`)
- Catalogue controller → Shared utilities: reads page parameter (evidence: `src/js/catalogue.js`)
- Catalogue controller → Breed data and catalogue: requests breed list (evidence: `src/js/catalogue.js`)
- Breed controller → Shared utilities: reads breed parameter (evidence: `src/js/breed.js`)
- Breed controller → Breed data and catalogue: requests breed image (evidence: `src/js/breed.js`)
- Breed controller → Breed details: initializes details (evidence: `src/js/breed.js`)
- Breed details → Breed data and catalogue: loads breed (evidence: `src/js/breedDetails.mjs`)
- Breed details → Shared utilities: uses storage and stats (evidence: `src/js/breedDetails.mjs`)
- Breed data and catalogue → TheCatAPI: fetches breed data (evidence: `src/js/breedList.mjs`)
- Breed data and catalogue → Cat image service: requests breed images (evidence: `src/js/breedList.mjs`)
- Cat image service → TheCatAPI: fetches cat images (evidence: `src/js/cats.mjs`)
- Cat image service → Slideshow controls: controls slides (evidence: `src/js/cats.mjs`)
- Favorites controller → Shared utilities: loads favorites (evidence: `src/js/favorite.js`)
- Favorites controller → Breed data and catalogue: renders favorites (evidence: `src/js/favorite.js`)
- Breed details → Browser local storage: reads and saves (evidence: `src/js/breedDetails.mjs`)
- Shared utilities → Browser local storage: reads and writes (evidence: `src/js/utils.mjs`)
- Site shell controller → Shared utilities: loads shared shell (evidence: `src/js/main.js`)
