# redward42/tboi-bosses architecture

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

- Interactive diagram: https://gitdiagram.com/redward42/tboi-bosses
- Repository: https://github.com/redward42/tboi-bosses

## Overview

TBOI Bosses is a browser-based catalog for browsing The Binding of Isaac bosses. Users load a boss list, follow a boss link to its detail page, and the browser fetches the corresponding data from the Express API backed by PostgreSQL. A separate reset workflow rebuilds and seeds the table from the repository’s JSON data. The excerpts establish these API and database interactions; the HTML files are present in the tree, but their contents and script wiring were not sampled.

Main entry points: [`server/server.js`](https://github.com/RedWARd42/TBOI-Bosses/blob/main/server/server.js) (HTTP routes), [`server/config/database.js`](https://github.com/RedWARd42/TBOI-Bosses/blob/main/server/config/database.js) (Postgres connection pool), [`server/config/reset.js`](https://github.com/RedWARd42/TBOI-Bosses/blob/main/server/config/reset.js) (Table reset and seed), [`public/scripts.js`](https://github.com/RedWARd42/TBOI-Bosses/blob/main/public/scripts.js) (List loader)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Browser experience"]
  node_listing["Boss listing<br/>[index.html]"]
  node_list_loader["List loader<br/>[scripts.js]"]
  node_detail_page["Boss detail page<br/>[detail.html]"]
  node_detail_loader["Detail loader<br/>[detail.js]"]
end

subgraph group_backend["API and setup"]
  node_api["HTTP routes<br/>[server.js]"]
  node_env["Environment setup<br/>[dotenv.js]"]
  node_reset["Table reset and seed<br/>[reset.js]"]
end

subgraph group_storage["Data storage"]
  node_pool["Postgres connection pool<br/>[database.js]"]
  node_seed_data["Boss seed data<br/>[items.json]"]
  node_postgres[("PostgreSQL")]
end

node_visitor(("Visitor"))

node_visitor -->|"opens"| node_listing
node_visitor -->|"opens"| node_detail_page
node_list_loader -->|"fetches list"| node_api
node_detail_loader -->|"fetches detail"| node_api
node_api -->|"queries"| node_pool
node_api -->|"loads config"| node_env
node_reset -->|"creates and seeds"| node_pool
node_reset -->|"imports"| node_seed_data
node_pool -->|"connects to"| node_postgres

click node_listing "https://github.com/RedWARd42/TBOI-Bosses/blob/main/public/index.html"
click node_list_loader "https://github.com/RedWARd42/TBOI-Bosses/blob/main/public/scripts.js"
click node_detail_page "https://github.com/RedWARd42/TBOI-Bosses/blob/main/public/detail.html"
click node_detail_loader "https://github.com/RedWARd42/TBOI-Bosses/blob/main/public/detail.js"
click node_api "https://github.com/RedWARd42/TBOI-Bosses/blob/main/server/server.js"
click node_env "https://github.com/RedWARd42/TBOI-Bosses/blob/main/server/config/dotenv.js"
click node_reset "https://github.com/RedWARd42/TBOI-Bosses/blob/main/server/config/reset.js"
click node_pool "https://github.com/RedWARd42/TBOI-Bosses/blob/main/server/config/database.js"
click node_seed_data "https://github.com/RedWARd42/TBOI-Bosses/blob/main/server/data/items.json"

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_listing,node_list_loader,node_detail_page,node_detail_loader toneBlue
class node_api,node_env,node_reset toneAmber
class node_pool,node_seed_data,node_postgres toneMint
class node_visitor toneIndigo
```

## Components

### Browser experience

- [Boss listing](https://github.com/RedWARd42/TBOI-Bosses/blob/main/public/index.html): `public/index.html`
- [List loader](https://github.com/RedWARd42/TBOI-Bosses/blob/main/public/scripts.js): `public/scripts.js`
- [Boss detail page](https://github.com/RedWARd42/TBOI-Bosses/blob/main/public/detail.html): `public/detail.html`
- [Detail loader](https://github.com/RedWARd42/TBOI-Bosses/blob/main/public/detail.js): `public/detail.js`

### API and setup

- [HTTP routes](https://github.com/RedWARd42/TBOI-Bosses/blob/main/server/server.js): `server/server.js`
- [Environment setup](https://github.com/RedWARd42/TBOI-Bosses/blob/main/server/config/dotenv.js): `server/config/dotenv.js`
- [Table reset and seed](https://github.com/RedWARd42/TBOI-Bosses/blob/main/server/config/reset.js): `server/config/reset.js`

### Data storage

- [Postgres connection pool](https://github.com/RedWARd42/TBOI-Bosses/blob/main/server/config/database.js): `server/config/database.js`
- [Boss seed data](https://github.com/RedWARd42/TBOI-Bosses/blob/main/server/data/items.json): `server/data/items.json`
- **PostgreSQL**

### Other components

- **Visitor**

## Connections

- Visitor → Boss listing: opens (evidence: `README.md`)
- Visitor → Boss detail page: opens (evidence: `README.md`)
- List loader → HTTP routes: fetches list (evidence: `public/scripts.js`)
- Detail loader → HTTP routes: fetches detail (evidence: `public/detail.js`)
- HTTP routes → Postgres connection pool: queries (evidence: `server/server.js`)
- HTTP routes → Environment setup: loads config (evidence: `server/server.js`)
- Table reset and seed → Postgres connection pool: creates and seeds (evidence: `server/config/reset.js`)
- Table reset and seed → Boss seed data: imports (evidence: `server/config/reset.js`)
- Postgres connection pool → PostgreSQL: connects to (evidence: `server/config/database.js`)
