# sayaio/sibuku architecture

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

- Interactive diagram: https://gitdiagram.com/sayaio/sibuku
- Repository: https://github.com/sayaio/sibuku

## Overview

SIBUKU is a campus-library operations app: staff use its browser pages to manage books and members, record loans and returns/extensions, and review dashboard summaries; the Flask API validates changes and persists coordinated JSON state. The frontend API client and backend routes are excerpted, but the dashboard implementation and HTML wiring are not, so those relationships are represented only where documented by the README.

Main entry points: [`backend/app.py`](https://github.com/sayaio/sibuku/blob/main/backend/app.py) (JSON persistence), [`frontend/js/api.js`](https://github.com/sayaio/sibuku/blob/main/frontend/js/api.js) (API client and state), [`frontend/index.html`](https://github.com/sayaio/sibuku/blob/main/frontend/index.html) (Operations dashboard), [`frontend/books.html`](https://github.com/sayaio/sibuku/blob/main/frontend/books.html) (Book management)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Staff interface"]
  node_dashboard["Operations dashboard<br/>[index.html]"]
  node_bookpage["Book management<br/>[books.html]"]
  node_memberpage["Member management<br/>[members.html]"]
  node_loanpage["Loans and returns<br/>[borrowings.html]"]
  node_bookui["Book workflows<br/>[books.js]"]
  node_memberui["Member workflows<br/>[members.js]"]
  node_loanui["Loan workflows<br/>[borrowings.js]"]
end

subgraph group_client["Browser data layer"]
  node_clientapi["API client and state<br/>[api.js]"]
end

subgraph group_service["Library service"]
  node_flask["Flask API<br/>[app.py]"]
  node_catalog["Book catalog rules<br/>[app.py]"]
  node_members["Member rules<br/>[app.py]"]
  node_transactions["Loan lifecycle rules<br/>[app.py]"]
  node_summary["Dashboard aggregation<br/>[app.py]"]
  node_jsonstate["JSON persistence<br/>[app.py]"]
end

subgraph group_storage["Persistent data"]
  node_booksfile[("Books data<br/>[books.json]")]
  node_membersfile[("Members data<br/>[members.json]")]
  node_loansfile[("Borrowings data<br/>[borrowings.json]")]
end

node_staff(("Library staff"))

node_staff -->|"views"| node_dashboard
node_staff -->|"manages"| node_bookpage
node_staff -->|"manages"| node_memberpage
node_staff -->|"records loans"| node_loanpage
node_bookpage -.->|"hosts"| node_bookui
node_memberpage -.->|"hosts"| node_memberui
node_loanpage -.->|"hosts"| node_loanui
node_bookui -->|"saves through"| node_clientapi
node_memberui -->|"saves through"| node_clientapi
node_loanui -->|"saves through"| node_clientapi
node_clientapi -->|"sends REST requests"| node_flask
node_flask -->|"routes catalog"| node_catalog
node_flask -->|"routes members"| node_members
node_flask -->|"handles loans"| node_transactions
node_flask -->|"aggregates"| node_summary
node_catalog -.->|"persists changes"| node_jsonstate
node_members -.->|"persists changes"| node_jsonstate
node_transactions -.->|"persists transactions"| node_jsonstate
node_summary -.->|"reads state"| node_jsonstate
node_jsonstate -->|"reads/writes"| node_booksfile
node_jsonstate -->|"reads/writes"| node_membersfile
node_jsonstate -->|"reads/writes"| node_loansfile
node_dashboard -.->|"requests summary"| node_clientapi

click node_dashboard "https://github.com/sayaio/sibuku/blob/main/frontend/index.html"
click node_bookpage "https://github.com/sayaio/sibuku/blob/main/frontend/books.html"
click node_memberpage "https://github.com/sayaio/sibuku/blob/main/frontend/members.html"
click node_loanpage "https://github.com/sayaio/sibuku/blob/main/frontend/borrowings.html"
click node_bookui "https://github.com/sayaio/sibuku/blob/main/frontend/js/books.js"
click node_memberui "https://github.com/sayaio/sibuku/blob/main/frontend/js/members.js"
click node_loanui "https://github.com/sayaio/sibuku/blob/main/frontend/js/borrowings.js"
click node_clientapi "https://github.com/sayaio/sibuku/blob/main/frontend/js/api.js"
click node_flask "https://github.com/sayaio/sibuku/blob/main/backend/app.py"
click node_catalog "https://github.com/sayaio/sibuku/blob/main/backend/app.py"
click node_members "https://github.com/sayaio/sibuku/blob/main/backend/app.py"
click node_transactions "https://github.com/sayaio/sibuku/blob/main/backend/app.py"
click node_summary "https://github.com/sayaio/sibuku/blob/main/backend/app.py"
click node_jsonstate "https://github.com/sayaio/sibuku/blob/main/backend/app.py"
click node_booksfile "https://github.com/sayaio/sibuku/blob/main/backend/data/books.json"
click node_membersfile "https://github.com/sayaio/sibuku/blob/main/backend/data/members.json"
click node_loansfile "https://github.com/sayaio/sibuku/blob/main/backend/data/borrowings.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_dashboard,node_bookpage,node_memberpage,node_loanpage,node_bookui,node_memberui,node_loanui toneBlue
class node_clientapi toneAmber
class node_flask,node_catalog,node_members,node_transactions,node_summary,node_jsonstate toneMint
class node_booksfile,node_membersfile,node_loansfile toneRose
class node_staff toneIndigo
```

## Components

### Staff interface

- [Operations dashboard](https://github.com/sayaio/sibuku/blob/main/frontend/index.html): `frontend/index.html`
- [Book management](https://github.com/sayaio/sibuku/blob/main/frontend/books.html): `frontend/books.html`
- [Member management](https://github.com/sayaio/sibuku/blob/main/frontend/members.html): `frontend/members.html`
- [Loans and returns](https://github.com/sayaio/sibuku/blob/main/frontend/borrowings.html): `frontend/borrowings.html`
- [Book workflows](https://github.com/sayaio/sibuku/blob/main/frontend/js/books.js): `frontend/js/books.js`
- [Member workflows](https://github.com/sayaio/sibuku/blob/main/frontend/js/members.js): `frontend/js/members.js`
- [Loan workflows](https://github.com/sayaio/sibuku/blob/main/frontend/js/borrowings.js): `frontend/js/borrowings.js`

### Browser data layer

- [API client and state](https://github.com/sayaio/sibuku/blob/main/frontend/js/api.js): `frontend/js/api.js`

### Library service

- [Flask API](https://github.com/sayaio/sibuku/blob/main/backend/app.py): `backend/app.py`
- [Book catalog rules](https://github.com/sayaio/sibuku/blob/main/backend/app.py): `backend/app.py`
- [Member rules](https://github.com/sayaio/sibuku/blob/main/backend/app.py): `backend/app.py`
- [Loan lifecycle rules](https://github.com/sayaio/sibuku/blob/main/backend/app.py): `backend/app.py`
- [Dashboard aggregation](https://github.com/sayaio/sibuku/blob/main/backend/app.py): `backend/app.py`
- [JSON persistence](https://github.com/sayaio/sibuku/blob/main/backend/app.py): `backend/app.py`

### Persistent data

- [Books data](https://github.com/sayaio/sibuku/blob/main/backend/data/books.json): `backend/data/books.json`
- [Members data](https://github.com/sayaio/sibuku/blob/main/backend/data/members.json): `backend/data/members.json`
- [Borrowings data](https://github.com/sayaio/sibuku/blob/main/backend/data/borrowings.json): `backend/data/borrowings.json`

### Other components

- **Library staff**

## Connections

- Library staff → Operations dashboard: views (evidence: `README.md`)
- Library staff → Book management: manages (evidence: `README.md`)
- Library staff → Member management: manages (evidence: `README.md`)
- Library staff → Loans and returns: records loans (evidence: `README.md`)
- Book management → Book workflows: hosts
- Member management → Member workflows: hosts
- Loans and returns → Loan workflows: hosts
- Book workflows → API client and state: saves through (evidence: `frontend/js/books.js`)
- Member workflows → API client and state: saves through (evidence: `frontend/js/members.js`)
- Loan workflows → API client and state: saves through (evidence: `frontend/js/borrowings.js`)
- API client and state → Flask API: sends REST requests (evidence: `frontend/js/api.js`)
- Flask API → Book catalog rules: routes catalog (evidence: `backend/app.py`)
- Flask API → Member rules: routes members (evidence: `backend/app.py`)
- Flask API → Loan lifecycle rules: handles loans (evidence: `backend/app.py`)
- Flask API → Dashboard aggregation: aggregates (evidence: `backend/app.py`)
- Book catalog rules → JSON persistence: persists changes (evidence: `backend/app.py`)
- Member rules → JSON persistence: persists changes (evidence: `backend/app.py`)
- Loan lifecycle rules → JSON persistence: persists transactions (evidence: `backend/app.py`)
- Dashboard aggregation → JSON persistence: reads state (evidence: `backend/app.py`)
- JSON persistence → Books data: reads/writes (evidence: `README.md`)
- JSON persistence → Members data: reads/writes (evidence: `README.md`)
- JSON persistence → Borrowings data: reads/writes (evidence: `README.md`)
- Operations dashboard → API client and state: requests summary
