# robber-as/sistema_notebooks architecture

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

- Interactive diagram: https://gitdiagram.com/robber-as/sistema_notebooks
- Repository: https://github.com/robber-as/sistema_notebooks

## Overview

This is a notebook-and-equipment lending system: administrators sign in, manage teachers and assets, record loans and returns, and review operational reports. The primary implementation is a React frontend backed by an Express API and PostgreSQL on Supabase; the README also documents the older PHP API and a Business Model Canvas presentation. The graph emphasizes the React/Express workflow and documented capabilities. Some route internals were not excerpted, so route-to-database edges rely on the SOURCE INDEX; the presentation’s slide content and wiring are not shown.

Main entry points: [`backend/server.js`](https://github.com/robber-as/sistema_notebooks/blob/main/backend/server.js) (HTTP server and routes), [`frontend/src/pages/Admin.jsx`](https://github.com/robber-as/sistema_notebooks/blob/main/frontend/src/pages/Admin.jsx) (Admin workspace), [`backend/config/db.js`](https://github.com/robber-as/sistema_notebooks/blob/main/backend/config/db.js) (Postgres pool), [`frontend/src/api.js`](https://github.com/robber-as/sistema_notebooks/blob/main/frontend/src/api.js) (API client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["React administration"]
  node_app["React routes<br/>[App.jsx]"]
  node_authpages["Login and register<br/>[Login.jsx]"]
  node_adminui["Admin workspace<br/>[Admin.jsx]"]
  node_dashboard["Dashboard<br/>[Dashboard.jsx]"]
  node_assets["Notebooks and teachers<br/>[Notebooks.jsx]"]
  node_loans["Notebook loans<br/>[Loans.jsx]"]
  node_items["Item inventory and loans<br/>[ItemLoans.jsx]"]
  node_returns["Returns and history<br/>[Returns.jsx]"]
  node_reports["Reports<br/>[Reports.jsx]"]
  node_returnform["Return form<br/>[ReturnModal.jsx]"]
  node_client["API client<br/>[api.js]"]
end

subgraph group_api["Express API"]
  node_server["HTTP server and routes<br/>[server.js]"]
  node_authroute["Authentication<br/>[auth.js]"]
  node_authmw["JWT middleware<br/>[auth.js]"]
  node_notebooksroute["Notebook routes<br/>[notebooks.js]"]
  node_teachersroute["Teacher routes<br/>[teachers.js]"]
  node_loansroute["Loan routes<br/>[loans.js]"]
  node_returnsroute["Return routes<br/>[returns.js]"]
  node_reportsroute["Report routes<br/>[reports.js]"]
  node_itemsroute["Item routes<br/>[items.js]"]
  node_itemloansroute["Item-loan routes<br/>[itemLoans.js]"]
end

subgraph group_storage["Persistence"]
  node_db["Postgres pool<br/>[db.js]"]
  node_postgres[("Supabase PostgreSQL")]
end

subgraph group_extras["Legacy and presentation"]
  node_php["Legacy PHP API"]
  node_slides["Canvas slides<br/>[slides.js]"]
end

node_admin(("Administrator"))

node_admin -->|"opens"| node_app
node_app -->|"routes to"| node_authpages
node_app -->|"routes to"| node_adminui
node_admin -.->|"uses"| node_adminui
node_adminui -->|"renders"| node_dashboard
node_adminui -->|"renders"| node_assets
node_adminui -->|"renders"| node_loans
node_adminui -->|"renders"| node_items
node_adminui -->|"renders"| node_returns
node_adminui -->|"renders"| node_reports
node_adminui -->|"loads data"| node_client
node_loans -->|"requests"| node_client
node_items -->|"requests"| node_client
node_returns -->|"requests"| node_client
node_returns -->|"opens"| node_returnform
node_returnform -->|"records return"| node_client
node_reports -.->|"requests"| node_client
node_authpages -->|"authenticates"| node_client
node_client -->|"calls API"| node_server
node_server -->|"mounts"| node_authroute
node_server -->|"protects routes"| node_authmw
node_server -->|"mounts"| node_notebooksroute
node_server -->|"mounts"| node_teachersroute
node_server -->|"mounts"| node_loansroute
node_server -->|"mounts"| node_returnsroute
node_server -->|"mounts"| node_reportsroute
node_server -->|"mounts"| node_itemsroute
node_server -->|"mounts"| node_itemloansroute
node_authroute -->|"queries"| node_db
node_notebooksroute -->|"queries"| node_db
node_teachersroute -.->|"queries"| node_db
node_loansroute -->|"queries"| node_db
node_returnsroute -.->|"queries"| node_db
node_reportsroute -.->|"queries"| node_db
node_itemsroute -->|"queries"| node_db
node_itemloansroute -->|"queries"| node_db
node_db -->|"connects"| node_postgres
node_admin -.->|"legacy option"| node_php
node_admin -.->|"opens presentation"| node_slides

click node_app "https://github.com/robber-as/sistema_notebooks/blob/main/frontend/src/App.jsx"
click node_authpages "https://github.com/robber-as/sistema_notebooks/blob/main/frontend/src/pages/Login.jsx"
click node_adminui "https://github.com/robber-as/sistema_notebooks/blob/main/frontend/src/pages/Admin.jsx"
click node_dashboard "https://github.com/robber-as/sistema_notebooks/blob/main/frontend/src/sections/Dashboard.jsx"
click node_assets "https://github.com/robber-as/sistema_notebooks/blob/main/frontend/src/sections/Notebooks.jsx"
click node_loans "https://github.com/robber-as/sistema_notebooks/blob/main/frontend/src/sections/Loans.jsx"
click node_items "https://github.com/robber-as/sistema_notebooks/blob/main/frontend/src/sections/ItemLoans.jsx"
click node_returns "https://github.com/robber-as/sistema_notebooks/blob/main/frontend/src/sections/Returns.jsx"
click node_reports "https://github.com/robber-as/sistema_notebooks/blob/main/frontend/src/sections/Reports.jsx"
click node_returnform "https://github.com/robber-as/sistema_notebooks/blob/main/frontend/src/components/ReturnModal.jsx"
click node_client "https://github.com/robber-as/sistema_notebooks/blob/main/frontend/src/api.js"
click node_server "https://github.com/robber-as/sistema_notebooks/blob/main/backend/server.js"
click node_authroute "https://github.com/robber-as/sistema_notebooks/blob/main/backend/routes/auth.js"
click node_authmw "https://github.com/robber-as/sistema_notebooks/blob/main/backend/middleware/auth.js"
click node_notebooksroute "https://github.com/robber-as/sistema_notebooks/blob/main/backend/routes/notebooks.js"
click node_teachersroute "https://github.com/robber-as/sistema_notebooks/blob/main/backend/routes/teachers.js"
click node_loansroute "https://github.com/robber-as/sistema_notebooks/blob/main/backend/routes/loans.js"
click node_returnsroute "https://github.com/robber-as/sistema_notebooks/blob/main/backend/routes/returns.js"
click node_reportsroute "https://github.com/robber-as/sistema_notebooks/blob/main/backend/routes/reports.js"
click node_itemsroute "https://github.com/robber-as/sistema_notebooks/blob/main/backend/routes/items.js"
click node_itemloansroute "https://github.com/robber-as/sistema_notebooks/blob/main/backend/routes/itemLoans.js"
click node_db "https://github.com/robber-as/sistema_notebooks/blob/main/backend/config/db.js"
click node_php "https://github.com/robber-as/sistema_notebooks/tree/main/api"
click node_slides "https://github.com/robber-as/sistema_notebooks/blob/main/js/slides.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_app,node_authpages,node_adminui,node_dashboard,node_assets,node_loans,node_items,node_returns,node_reports,node_returnform,node_client toneBlue
class node_server,node_authroute,node_authmw,node_notebooksroute,node_teachersroute,node_loansroute,node_returnsroute,node_reportsroute,node_itemsroute,node_itemloansroute toneAmber
class node_db,node_postgres toneMint
class node_php,node_slides toneRose
class node_admin toneIndigo
```

## Components

### React administration

- [React routes](https://github.com/robber-as/sistema_notebooks/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Login and register](https://github.com/robber-as/sistema_notebooks/blob/main/frontend/src/pages/Login.jsx): `frontend/src/pages/Login.jsx`
- [Admin workspace](https://github.com/robber-as/sistema_notebooks/blob/main/frontend/src/pages/Admin.jsx): `frontend/src/pages/Admin.jsx`
- [Dashboard](https://github.com/robber-as/sistema_notebooks/blob/main/frontend/src/sections/Dashboard.jsx): `frontend/src/sections/Dashboard.jsx`
- [Notebooks and teachers](https://github.com/robber-as/sistema_notebooks/blob/main/frontend/src/sections/Notebooks.jsx): `frontend/src/sections/Notebooks.jsx`
- [Notebook loans](https://github.com/robber-as/sistema_notebooks/blob/main/frontend/src/sections/Loans.jsx): `frontend/src/sections/Loans.jsx`
- [Item inventory and loans](https://github.com/robber-as/sistema_notebooks/blob/main/frontend/src/sections/ItemLoans.jsx): `frontend/src/sections/ItemLoans.jsx`
- [Returns and history](https://github.com/robber-as/sistema_notebooks/blob/main/frontend/src/sections/Returns.jsx): `frontend/src/sections/Returns.jsx`
- [Reports](https://github.com/robber-as/sistema_notebooks/blob/main/frontend/src/sections/Reports.jsx): `frontend/src/sections/Reports.jsx`
- [Return form](https://github.com/robber-as/sistema_notebooks/blob/main/frontend/src/components/ReturnModal.jsx): `frontend/src/components/ReturnModal.jsx`
- [API client](https://github.com/robber-as/sistema_notebooks/blob/main/frontend/src/api.js): `frontend/src/api.js`

### Express API

- [HTTP server and routes](https://github.com/robber-as/sistema_notebooks/blob/main/backend/server.js): `backend/server.js`
- [Authentication](https://github.com/robber-as/sistema_notebooks/blob/main/backend/routes/auth.js): `backend/routes/auth.js`
- [JWT middleware](https://github.com/robber-as/sistema_notebooks/blob/main/backend/middleware/auth.js): `backend/middleware/auth.js`
- [Notebook routes](https://github.com/robber-as/sistema_notebooks/blob/main/backend/routes/notebooks.js): `backend/routes/notebooks.js`
- [Teacher routes](https://github.com/robber-as/sistema_notebooks/blob/main/backend/routes/teachers.js): `backend/routes/teachers.js`
- [Loan routes](https://github.com/robber-as/sistema_notebooks/blob/main/backend/routes/loans.js): `backend/routes/loans.js`
- [Return routes](https://github.com/robber-as/sistema_notebooks/blob/main/backend/routes/returns.js): `backend/routes/returns.js`
- [Report routes](https://github.com/robber-as/sistema_notebooks/blob/main/backend/routes/reports.js): `backend/routes/reports.js`
- [Item routes](https://github.com/robber-as/sistema_notebooks/blob/main/backend/routes/items.js): `backend/routes/items.js`
- [Item-loan routes](https://github.com/robber-as/sistema_notebooks/blob/main/backend/routes/itemLoans.js): `backend/routes/itemLoans.js`

### Persistence

- [Postgres pool](https://github.com/robber-as/sistema_notebooks/blob/main/backend/config/db.js): `backend/config/db.js`
- **Supabase PostgreSQL**

### Legacy and presentation

- [Legacy PHP API](https://github.com/robber-as/sistema_notebooks/tree/main/api): `api`
- [Canvas slides](https://github.com/robber-as/sistema_notebooks/blob/main/js/slides.js): `js/slides.js`

### Other components

- **Administrator**

## Connections

- Administrator → React routes: opens
- React routes → Login and register: routes to (evidence: `frontend/src/App.jsx`)
- React routes → Admin workspace: routes to (evidence: `frontend/src/App.jsx`)
- Administrator → Admin workspace: uses
- Admin workspace → Dashboard: renders (evidence: `frontend/src/pages/Admin.jsx`)
- Admin workspace → Notebooks and teachers: renders (evidence: `frontend/src/pages/Admin.jsx`)
- Admin workspace → Notebook loans: renders (evidence: `frontend/src/pages/Admin.jsx`)
- Admin workspace → Item inventory and loans: renders (evidence: `frontend/src/pages/Admin.jsx`)
- Admin workspace → Returns and history: renders (evidence: `frontend/src/pages/Admin.jsx`)
- Admin workspace → Reports: renders (evidence: `frontend/src/pages/Admin.jsx`)
- Admin workspace → API client: loads data (evidence: `frontend/src/pages/Admin.jsx`)
- Notebook loans → API client: requests (evidence: `frontend/src/sections/Loans.jsx`)
- Item inventory and loans → API client: requests (evidence: `frontend/src/sections/ItemLoans.jsx`)
- Returns and history → API client: requests (evidence: `frontend/src/sections/Returns.jsx`)
- Returns and history → Return form: opens (evidence: `frontend/src/sections/Returns.jsx`)
- Return form → API client: records return (evidence: `frontend/src/components/ReturnModal.jsx`)
- Reports → API client: requests
- Login and register → API client: authenticates (evidence: `frontend/src/pages/Login.jsx`)
- API client → HTTP server and routes: calls API (evidence: `frontend/src/api.js`)
- HTTP server and routes → Authentication: mounts (evidence: `backend/server.js`)
- HTTP server and routes → JWT middleware: protects routes (evidence: `backend/server.js`)
- HTTP server and routes → Notebook routes: mounts (evidence: `backend/server.js`)
- HTTP server and routes → Teacher routes: mounts (evidence: `backend/server.js`)
- HTTP server and routes → Loan routes: mounts (evidence: `backend/server.js`)
- HTTP server and routes → Return routes: mounts (evidence: `backend/server.js`)
- HTTP server and routes → Report routes: mounts (evidence: `backend/server.js`)
- HTTP server and routes → Item routes: mounts (evidence: `backend/server.js`)
- HTTP server and routes → Item-loan routes: mounts (evidence: `backend/server.js`)
- Authentication → Postgres pool: queries (evidence: `backend/routes/auth.js`)
- Notebook routes → Postgres pool: queries (evidence: `backend/routes/notebooks.js`)
- Teacher routes → Postgres pool: queries (evidence: `backend/routes/teachers.js`)
- Loan routes → Postgres pool: queries (evidence: `backend/routes/loans.js`)
- Return routes → Postgres pool: queries (evidence: `backend/routes/returns.js`)
- Report routes → Postgres pool: queries (evidence: `backend/routes/reports.js`)
- Item routes → Postgres pool: queries (evidence: `backend/routes/items.js`)
- Item-loan routes → Postgres pool: queries (evidence: `backend/routes/itemLoans.js`)
- Postgres pool → Supabase PostgreSQL: connects (evidence: `backend/config/db.js`)
- Administrator → Legacy PHP API: legacy option
- Administrator → Canvas slides: opens presentation
