# gabtapia/sistema_biblioteca_fullstack architecture

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

- Interactive diagram: https://gitdiagram.com/gabtapia/sistema_biblioteca_fullstack
- Repository: https://github.com/gabtapia/sistema_biblioteca_fullstack

## Overview

This is a full-stack library-catalog manager. Users create, browse, edit, and delete authors, literary genres, and books; book records reference an existing author and genre. The browser interface delegates API requests to a shared fetch client, while FastAPI routes validate and dispatch operations to CRUD logic backed by SQLAlchemy and SQLite. The README also documents cascade deletion for authors and restricted deletion for genres. Frontend wiring is supported by the sampled script and API client; route-to-CRUD wiring is shown for the sampled routes, with equivalent modules retained as documented capabilities.

Main entry points: [`backend/routes/autor_routes.py`](https://github.com/gabtapia/sistema_biblioteca_fullstack/blob/main/backend/routes/autor_routes.py) (Author routes), [`backend/routes/genero_routes.py`](https://github.com/gabtapia/sistema_biblioteca_fullstack/blob/main/backend/routes/genero_routes.py) (Genre routes), [`backend/routes/livro_routes.py`](https://github.com/gabtapia/sistema_biblioteca_fullstack/blob/main/backend/routes/livro_routes.py) (Book routes), [`backend/main.py`](https://github.com/gabtapia/sistema_biblioteca_fullstack/blob/main/backend/main.py) (FastAPI app)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Web interface"]
  node_pages["Catalog pages"]
  node_ui["UI interactions<br/>[script.js]"]
  node_client["Fetch client<br/>[api.js]"]
end

subgraph group_api["REST API"]
  node_app["FastAPI app<br/>[main.py]"]
  node_authors["Author routes<br/>[autor_routes.py]"]
  node_genres["Genre routes<br/>[genero_routes.py]"]
  node_books["Book routes<br/>[livro_routes.py]"]
  node_schemas["Request schemas<br/>[schemas.py]"]
end

subgraph group_persistence["Persistence"]
  node_crud["Catalog operations<br/>[crud.py]"]
  node_sessions["Session provider<br/>[dependencies.py]"]
  node_models["ORM models<br/>[models.py]"]
  node_sqlite[("SQLite catalog<br/>[models.py]")]
end

node_user(("Library user"))

node_user -->|"uses"| node_pages
node_pages -->|"loads"| node_ui
node_ui -->|"calls"| node_client
node_app -->|"registers"| node_authors
node_app -->|"registers"| node_genres
node_app -->|"registers"| node_books
node_authors -->|"serves requests"| node_client
node_genres -->|"serves requests"| node_client
node_books -->|"serves requests"| node_client
node_authors -->|"dispatches"| node_crud
node_genres -->|"dispatches"| node_crud
node_books -->|"dispatches"| node_crud
node_authors -->|"validates"| node_schemas
node_genres -->|"validates"| node_schemas
node_books -->|"validates"| node_schemas
node_authors -->|"requests session"| node_sessions
node_genres -->|"requests session"| node_sessions
node_books -->|"requests session"| node_sessions
node_sessions -->|"binds engine"| node_models
node_crud -->|"queries models"| node_models
node_models -->|"reads and writes"| node_sqlite
node_app -->|"creates tables"| node_models

click node_pages "https://github.com/gabtapia/sistema_biblioteca_fullstack/tree/main/pages"
click node_ui "https://github.com/gabtapia/sistema_biblioteca_fullstack/blob/main/src/script.js"
click node_client "https://github.com/gabtapia/sistema_biblioteca_fullstack/blob/main/src/api.js"
click node_app "https://github.com/gabtapia/sistema_biblioteca_fullstack/blob/main/backend/main.py"
click node_authors "https://github.com/gabtapia/sistema_biblioteca_fullstack/blob/main/backend/routes/autor_routes.py"
click node_genres "https://github.com/gabtapia/sistema_biblioteca_fullstack/blob/main/backend/routes/genero_routes.py"
click node_books "https://github.com/gabtapia/sistema_biblioteca_fullstack/blob/main/backend/routes/livro_routes.py"
click node_schemas "https://github.com/gabtapia/sistema_biblioteca_fullstack/blob/main/backend/schemas.py"
click node_crud "https://github.com/gabtapia/sistema_biblioteca_fullstack/blob/main/backend/crud.py"
click node_sessions "https://github.com/gabtapia/sistema_biblioteca_fullstack/blob/main/backend/dependencies.py"
click node_models "https://github.com/gabtapia/sistema_biblioteca_fullstack/blob/main/backend/models.py"
click node_sqlite "https://github.com/gabtapia/sistema_biblioteca_fullstack/blob/main/backend/models.py"

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_pages,node_ui,node_client,node_user toneBlue
class node_app,node_authors,node_genres,node_books,node_schemas toneAmber
class node_crud,node_sessions,node_models,node_sqlite toneMint
```

## Components

### Web interface

- [Catalog pages](https://github.com/gabtapia/sistema_biblioteca_fullstack/tree/main/pages): `pages`
- [UI interactions](https://github.com/gabtapia/sistema_biblioteca_fullstack/blob/main/src/script.js): `src/script.js`
- [Fetch client](https://github.com/gabtapia/sistema_biblioteca_fullstack/blob/main/src/api.js): `src/api.js`

### REST API

- [FastAPI app](https://github.com/gabtapia/sistema_biblioteca_fullstack/blob/main/backend/main.py): `backend/main.py`
- [Author routes](https://github.com/gabtapia/sistema_biblioteca_fullstack/blob/main/backend/routes/autor_routes.py): `backend/routes/autor_routes.py`
- [Genre routes](https://github.com/gabtapia/sistema_biblioteca_fullstack/blob/main/backend/routes/genero_routes.py): `backend/routes/genero_routes.py`
- [Book routes](https://github.com/gabtapia/sistema_biblioteca_fullstack/blob/main/backend/routes/livro_routes.py): `backend/routes/livro_routes.py`
- [Request schemas](https://github.com/gabtapia/sistema_biblioteca_fullstack/blob/main/backend/schemas.py): `backend/schemas.py`

### Persistence

- [Catalog operations](https://github.com/gabtapia/sistema_biblioteca_fullstack/blob/main/backend/crud.py): `backend/crud.py`
- [Session provider](https://github.com/gabtapia/sistema_biblioteca_fullstack/blob/main/backend/dependencies.py): `backend/dependencies.py`
- [ORM models](https://github.com/gabtapia/sistema_biblioteca_fullstack/blob/main/backend/models.py): `backend/models.py`
- [SQLite catalog](https://github.com/gabtapia/sistema_biblioteca_fullstack/blob/main/backend/models.py): `backend/models.py`

### Other components

- **Library user**

## Connections

- Library user → Catalog pages: uses
- Catalog pages → UI interactions: loads
- UI interactions → Fetch client: calls
- FastAPI app → Author routes: registers
- FastAPI app → Genre routes: registers
- FastAPI app → Book routes: registers
- Author routes → Fetch client: serves requests
- Genre routes → Fetch client: serves requests
- Book routes → Fetch client: serves requests
- Author routes → Catalog operations: dispatches
- Genre routes → Catalog operations: dispatches
- Book routes → Catalog operations: dispatches
- Author routes → Request schemas: validates
- Genre routes → Request schemas: validates
- Book routes → Request schemas: validates
- Author routes → Session provider: requests session
- Genre routes → Session provider: requests session
- Book routes → Session provider: requests session
- Session provider → ORM models: binds engine
- Catalog operations → ORM models: queries models
- ORM models → SQLite catalog: reads and writes
- FastAPI app → ORM models: creates tables
