# divya-elsa/chapterly architecture

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

- Interactive diagram: https://gitdiagram.com/divya-elsa/chapterly
- Repository: https://github.com/divya-elsa/chapterly

## Overview

1. **Overall shape**  
   Chapterly is split into two deployable subsystems: a React frontend in `frontend/` and a Spring Boot backend in `readingtracker/`. The main architecture is client → REST API → relational database.

2. **User-facing client**  
   The frontend is a single-page React app. It has a small page-based structure under `src/pages/` with `Landing`, `Dashboard`, `AddBook`, and `EditBook`. `App.js` is the main composition point, and `index.js` bootstraps the app.

3. **Frontend responsibilities**  
   The React app owns the UI for browsing the reading list, creating new books, editing existing books, and deleting books. The dashboard is the central screen where the book collection is viewed and managed.

4. **Frontend runtime and delivery**  
   In development it runs with Node/npm, and in production it is packaged behind Nginx. The presence of `frontend/Dockerfile` and `nginx.conf` indicates the built static assets are served as a containerized web frontend rather than through the React dev server.

5. **Backend service boundary**  
   The backend is a standalone Spring Boot service rooted at `com.example.readingtracker`. It exposes JSON REST endpoints and runs on port `8081` according to the repository documentation and configuration.

6. **Backend layering**  
   The backend is organized into the usual three layers: `controller/` for HTTP endpoints, `model/` for the `Book` domain object, and `repository/` for data access. `BookController` is the API entry point, `BookRepository` is the persistence abstraction, and `Book` is the entity being managed.

7. **Core data flow**  
   A typical request path is: browser action in React → HTTP request to `/api/books` endpoints → `BookController` → `BookRepository` → database. The primary operations are list, create, update, retrieve by id, and delete for books.

8. **Persistence and data setup**  
   The repository is designed around a relational database accessed via Spring Data/JPA. `dump.sql` provides schema/sample data, and `application.properties` holds the datasource and JPA settings. The README indicates MySQL or PostgreSQL is expected.

9. **Containerization and orchestration**  
   Both frontend and backend have their own Dockerfiles, and `docker-compose.yml` ties them together for local or deployment use. This makes the application a multi-container system with a separate web client, API service, and backing database.

10. **Build and test boundaries**  
   The frontend uses npm-based tooling and includes React test scaffolding. The backend uses Maven and has a Spring Boot test class under `src/test`. The `target/` directory shows backend build artifacts, which are generated output and not part of the source architecture.

11. **Important architectural dependency**  
   The frontend depends on the backend API URL being configured externally, so the UI is not self-contained. Its behavior is shaped by the backend’s REST contract and the database-backed book lifecycle exposed there.

Main entry points: [`readingtracker/src/main/java/com/example/readingtracker/controller/BookController.java`](https://github.com/divya-elsa/chapterly/blob/main/readingtracker/src/main/java/com/example/readingtracker/controller/BookController.java) (Book API), [`frontend/src/App.js`](https://github.com/divya-elsa/chapterly/blob/main/frontend/src/App.js) (App shell), [`docker-compose.yml`](https://github.com/divya-elsa/chapterly/blob/main/docker-compose.yml) (Compose), [`readingtracker/src/main/java/com/example/readingtracker/ReadingtrackerApplication.java`](https://github.com/divya-elsa/chapterly/blob/main/readingtracker/src/main/java/com/example/readingtracker/ReadingtrackerApplication.java) (Spring app)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Frontend"]
  node_frontend_app["App shell<br/>React composition<br/>[App.js]"]
  node_frontend_boot["Bootstrap<br/>React entrypoint<br/>[index.js]"]
  node_frontend_landing["Landing<br/>page<br/>[Landing.js]"]
  node_frontend_dashboard["Dashboard<br/>page<br/>[Dashboard.js]"]
  node_frontend_add["Add book<br/>page<br/>[AddBook.js]"]
  node_frontend_edit["Edit book<br/>page<br/>[EditBook.js]"]
end

subgraph group_backend["Backend"]
  node_api_controller["Book API<br/>REST controller"]
  node_book_model["Book<br/>entity<br/>[Book.java]"]
  node_book_repository["Repository<br/>Spring Data"]
  node_spring_boot_app(("Spring app<br/>boot application"))
  node_backend_config["Config"]
  node_db_seed[("Seed data<br/>SQL dump<br/>[dump.sql]")]
end

subgraph group_delivery["Delivery"]
  node_frontend_docker["Frontend image<br/>container build"]
  node_frontend_nginx["Nginx config<br/>web server config<br/>[nginx.conf]"]
  node_backend_docker["Backend image<br/>container build"]
  node_compose["Compose<br/>orchestration<br/>[docker-compose.yml]"]
end

node_frontend_boot -->|"starts"| node_frontend_app
node_frontend_app -->|"routes to"| node_frontend_landing
node_frontend_app -->|"routes to"| node_frontend_dashboard
node_frontend_app -->|"routes to"| node_frontend_add
node_frontend_app -->|"routes to"| node_frontend_edit
node_frontend_dashboard -->|"CRUD calls"| node_api_controller
node_frontend_add -->|"create"| node_api_controller
node_frontend_edit -->|"update"| node_api_controller
node_api_controller -->|"uses"| node_book_repository
node_api_controller -->|"maps"| node_book_model
node_book_repository -->|"persists to"| node_db_seed
node_spring_boot_app -->|"hosts"| node_api_controller
node_spring_boot_app -->|"loads"| node_backend_config
node_compose -->|"builds"| node_frontend_docker
node_compose -->|"builds"| node_backend_docker
node_compose -->|"initializes"| node_db_seed
node_frontend_docker -->|"serves with"| node_frontend_nginx
node_frontend_app -.->|"depends on"| node_api_controller

click node_frontend_app "https://github.com/divya-elsa/chapterly/blob/main/frontend/src/App.js"
click node_frontend_boot "https://github.com/divya-elsa/chapterly/blob/main/frontend/src/index.js"
click node_frontend_landing "https://github.com/divya-elsa/chapterly/blob/main/frontend/src/pages/Landing.js"
click node_frontend_dashboard "https://github.com/divya-elsa/chapterly/blob/main/frontend/src/pages/Dashboard.js"
click node_frontend_add "https://github.com/divya-elsa/chapterly/blob/main/frontend/src/pages/AddBook.js"
click node_frontend_edit "https://github.com/divya-elsa/chapterly/blob/main/frontend/src/pages/EditBook.js"
click node_api_controller "https://github.com/divya-elsa/chapterly/blob/main/readingtracker/src/main/java/com/example/readingtracker/controller/BookController.java"
click node_book_model "https://github.com/divya-elsa/chapterly/blob/main/readingtracker/src/main/java/com/example/readingtracker/model/Book.java"
click node_book_repository "https://github.com/divya-elsa/chapterly/blob/main/readingtracker/src/main/java/com/example/readingtracker/repository/BookRepository.java"
click node_spring_boot_app "https://github.com/divya-elsa/chapterly/blob/main/readingtracker/src/main/java/com/example/readingtracker/ReadingtrackerApplication.java"
click node_backend_config "https://github.com/divya-elsa/chapterly/blob/main/readingtracker/src/main/resources/application.properties"
click node_db_seed "https://github.com/divya-elsa/chapterly/blob/main/dump.sql"
click node_frontend_docker "https://github.com/divya-elsa/chapterly/tree/main/frontend/Dockerfile"
click node_frontend_nginx "https://github.com/divya-elsa/chapterly/blob/main/frontend/nginx.conf"
click node_backend_docker "https://github.com/divya-elsa/chapterly/tree/main/readingtracker/Dockerfile"
click node_compose "https://github.com/divya-elsa/chapterly/blob/main/docker-compose.yml"

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_frontend_app,node_frontend_boot,node_frontend_landing,node_frontend_dashboard,node_frontend_add,node_frontend_edit toneBlue
class node_api_controller,node_book_model,node_book_repository,node_spring_boot_app,node_backend_config,node_db_seed toneAmber
class node_frontend_docker,node_frontend_nginx,node_backend_docker,node_compose toneMint
```

## Components

### Frontend

React single-page client and static web delivery

- [App shell](https://github.com/divya-elsa/chapterly/blob/main/frontend/src/App.js): React composition · Main React application composition and route wiring · `frontend/src/App.js`
- [Bootstrap](https://github.com/divya-elsa/chapterly/blob/main/frontend/src/index.js): React entrypoint · Client startup and render bootstrap · `frontend/src/index.js`
- [Landing](https://github.com/divya-elsa/chapterly/blob/main/frontend/src/pages/Landing.js): page · Public entry page · `frontend/src/pages/Landing.js`
- [Dashboard](https://github.com/divya-elsa/chapterly/blob/main/frontend/src/pages/Dashboard.js): page · Primary book list and management screen · `frontend/src/pages/Dashboard.js`
- [Add book](https://github.com/divya-elsa/chapterly/blob/main/frontend/src/pages/AddBook.js): page · Create-book form and flow · `frontend/src/pages/AddBook.js`
- [Edit book](https://github.com/divya-elsa/chapterly/blob/main/frontend/src/pages/EditBook.js): page · Edit-book form and flow · `frontend/src/pages/EditBook.js`

### Backend

Spring Boot API and persistence layer

- [Book API](https://github.com/divya-elsa/chapterly/blob/main/readingtracker/src/main/java/com/example/readingtracker/controller/BookController.java): REST controller · HTTP entry point for book CRUD endpoints · `readingtracker/src/main/java/com/example/readingtracker/controller/BookController.java`
- [Book](https://github.com/divya-elsa/chapterly/blob/main/readingtracker/src/main/java/com/example/readingtracker/model/Book.java): entity · Core book domain object · `readingtracker/src/main/java/com/example/readingtracker/model/Book.java`
- [Repository](https://github.com/divya-elsa/chapterly/blob/main/readingtracker/src/main/java/com/example/readingtracker/repository/BookRepository.java): Spring Data · Persistence abstraction for books · `readingtracker/src/main/java/com/example/readingtracker/repository/BookRepository.java`
- [Spring app](https://github.com/divya-elsa/chapterly/blob/main/readingtracker/src/main/java/com/example/readingtracker/ReadingtrackerApplication.java): boot application · Backend service bootstrap · `readingtracker/src/main/java/com/example/readingtracker/ReadingtrackerApplication.java`
- [Config](https://github.com/divya-elsa/chapterly/blob/main/readingtracker/src/main/resources/application.properties): runtime config · Datasource and JPA settings · `readingtracker/src/main/resources/application.properties`
- [Seed data](https://github.com/divya-elsa/chapterly/blob/main/dump.sql): SQL dump · Schema and sample data initialization · `dump.sql`

### Delivery

Container and compose orchestration

- [Frontend image](https://github.com/divya-elsa/chapterly/tree/main/frontend/Dockerfile): container build · Builds the static client for Nginx delivery · `frontend/Dockerfile`
- [Nginx config](https://github.com/divya-elsa/chapterly/blob/main/frontend/nginx.conf): web server config · Serves the built frontend assets · `frontend/nginx.conf`
- [Backend image](https://github.com/divya-elsa/chapterly/tree/main/readingtracker/Dockerfile): container build · Packages the Spring Boot service · `readingtracker/Dockerfile`
- [Compose](https://github.com/divya-elsa/chapterly/blob/main/docker-compose.yml): orchestration · Runs frontend, backend, and database together · `docker-compose.yml`

## Connections

- Bootstrap → App shell: starts · Bootstraps the React application
- App shell → Landing: routes to · Displays the landing page
- App shell → Dashboard: routes to · Displays the main book dashboard
- App shell → Add book: routes to · Opens add-book flow
- App shell → Edit book: routes to · Opens edit-book flow
- Dashboard → Book API: CRUD calls · Lists and manages books through the API
- Add book → Book API: create · Submits new books to the REST API
- Edit book → Book API: update · Sends book edits to the REST API
- Book API → Repository: uses · Delegates persistence operations
- Book API → Book: maps · Reads and writes book representations
- Repository → Seed data: persists to · Backed by relational schema and seeded data
- Spring app → Book API: hosts · Starts the HTTP API layer
- Spring app → Config: loads · Applies runtime datasource and JPA settings
- Compose → Frontend image: builds · Creates the client container
- Compose → Backend image: builds · Creates the API container
- Compose → Seed data: initializes · Provides database initialization input
- Frontend image → Nginx config: serves with · Static client is delivered by Nginx
- App shell → Book API: depends on · UI behavior relies on the REST contract
