# basilbarakat15/a-multi-tier-online-book-store architecture

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

- Interactive diagram: https://gitdiagram.com/basilbarakat15/a-multi-tier-online-book-store
- Repository: https://github.com/basilbarakat15/a-multi-tier-online-book-store

## Overview

Bazar.com is a small three-tier book store. A client uses the frontend’s search, information, and purchase endpoints; the frontend also serves the browser page. The catalog owns book details and stock, while the order service records purchases and asks the catalog to sell a copy. The README also documents price and stock updates, catalog and order queries, and JSON data persisted under data/. Relationships shown here are based on README statements only; source excerpts were not available.

Main entry points: [`src/main/java/org/example/FrontendService.java`](https://github.com/basilbarakat15/a-multi-tier-online-book-store/blob/main/src/main/java/org/example/FrontendService.java) (Frontend API), [`src/main/java/org/example/OrderService.java`](https://github.com/basilbarakat15/a-multi-tier-online-book-store/blob/main/src/main/java/org/example/OrderService.java) (Order service), [`src/main/java/org/example/CatalogService.java`](https://github.com/basilbarakat15/a-multi-tier-online-book-store/blob/main/src/main/java/org/example/CatalogService.java) (Catalog service), [`src/main/resources/public/index.html`](https://github.com/basilbarakat15/a-multi-tier-online-book-store/blob/main/src/main/resources/public/index.html) (Store page)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_presentation["Presentation"]
  node_frontend["Frontend API"]
  node_webpage["Store page<br/>[index.html]"]
end

subgraph group_catalog["Book catalog"]
  node_catalog_service["Catalog service"]
  node_book_model["Book records<br/>[Book.java]"]
  node_books_store[("Books data<br/>[books.json]")]
end

subgraph group_orders["Orders"]
  node_order_service["Order service<br/>[OrderService.java]"]
  node_orders_store[("Order log<br/>[orders.json]")]
end

node_shopper(("Shopper"))

node_shopper -->|"uses API"| node_frontend
node_shopper -->|"opens"| node_webpage
node_frontend -->|"serves page"| node_webpage
node_frontend -->|"requests catalog"| node_catalog_service
node_frontend -->|"requests purchase"| node_order_service
node_order_service -->|"sells copy"| node_catalog_service
node_catalog_service -->|"owns data"| node_books_store
node_order_service -->|"owns log"| node_orders_store

click node_frontend "https://github.com/basilbarakat15/a-multi-tier-online-book-store/blob/main/src/main/java/org/example/FrontendService.java"
click node_webpage "https://github.com/basilbarakat15/a-multi-tier-online-book-store/blob/main/src/main/resources/public/index.html"
click node_catalog_service "https://github.com/basilbarakat15/a-multi-tier-online-book-store/blob/main/src/main/java/org/example/CatalogService.java"
click node_book_model "https://github.com/basilbarakat15/a-multi-tier-online-book-store/blob/main/src/main/java/org/example/Book.java"
click node_books_store "https://github.com/basilbarakat15/a-multi-tier-online-book-store/blob/main/data/books.json"
click node_order_service "https://github.com/basilbarakat15/a-multi-tier-online-book-store/blob/main/src/main/java/org/example/OrderService.java"
click node_orders_store "https://github.com/basilbarakat15/a-multi-tier-online-book-store/blob/main/data/orders.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_frontend,node_webpage toneBlue
class node_catalog_service,node_book_model,node_books_store toneAmber
class node_order_service,node_orders_store toneMint
class node_shopper toneIndigo
```

## Components

### Presentation

- [Frontend API](https://github.com/basilbarakat15/a-multi-tier-online-book-store/blob/main/src/main/java/org/example/FrontendService.java): `src/main/java/org/example/FrontendService.java`
- [Store page](https://github.com/basilbarakat15/a-multi-tier-online-book-store/blob/main/src/main/resources/public/index.html): `src/main/resources/public/index.html`

### Book catalog

- [Catalog service](https://github.com/basilbarakat15/a-multi-tier-online-book-store/blob/main/src/main/java/org/example/CatalogService.java): `src/main/java/org/example/CatalogService.java`
- [Book records](https://github.com/basilbarakat15/a-multi-tier-online-book-store/blob/main/src/main/java/org/example/Book.java): `src/main/java/org/example/Book.java`
- [Books data](https://github.com/basilbarakat15/a-multi-tier-online-book-store/blob/main/data/books.json): `data/books.json`

### Orders

- [Order service](https://github.com/basilbarakat15/a-multi-tier-online-book-store/blob/main/src/main/java/org/example/OrderService.java): `src/main/java/org/example/OrderService.java`
- [Order log](https://github.com/basilbarakat15/a-multi-tier-online-book-store/blob/main/data/orders.json): `data/orders.json`

### Other components

- **Shopper**

## Connections

- Shopper → Frontend API: uses API (evidence: `README.md`)
- Shopper → Store page: opens (evidence: `README.md`)
- Frontend API → Store page: serves page (evidence: `README.md`)
- Frontend API → Catalog service: requests catalog (evidence: `README.md`)
- Frontend API → Order service: requests purchase (evidence: `README.md`)
- Order service → Catalog service: sells copy (evidence: `README.md`)
- Catalog service → Books data: owns data (evidence: `README.md`)
- Order service → Order log: owns log (evidence: `README.md`)
