System architecture

Shows the components the software of this system is made of and their dependencies, the use cases, entities and design decisions each component takes on, and the deployment.

Component diagram

flowchart BT
subgraph app["Bookstore Inventory System"]
  C01["Books"]
  C02["Stock"]
  C03["Receiving"]
  C04["Sales"]
  C05["Stocktaking"]
end
    C02 --> C01
    C03 --> C01
    C03 --> C02
    C04 --> C01
    C04 --> C02
    C05 --> C01
    C05 --> C02

An arrow points in the direction of the call. A component with no outgoing arrow is a foundation that calls no other component.

The system is a single web application running on one server, and holds five components, cut along units of business work, as modules within it. The components form two layers, the foundation of Books and Stock and, on top of it, Receiving, Sales and Stocktaking, and they share one database (D08).

Receiving, Sales and Stocktaking all delegate book lookup to Books and stock quantity updates to Stock (D07). Stock reads the records of deliveries, sales and stocktakes to show the movement history, but a reference that only reads event records does not count as a dependency (D08), so no arrow points upward from Stock.

Components

ID Component Responsibility Use cases Entities Design decisions
C01 Books Registers and looks up books. The other components call it to look a book up by ISBN, and the check for unregistered ISBNs is confined here. The identifier of a book is the ISBN; there is no number of the system's own. UC01 Book registration Book D03
C02 Stock The single path that moves stock quantities. Receiving, Sales and Stocktaking update stock quantities only through it (addition and subtraction by deliveries and sales, replacement by the counted quantity at a stocktake), and it refuses addition and subtraction while the stocktake status is in progress. It also answers stock inquiries and shows the movement history of a book, reading the records of deliveries, sales and stocktakes and their lines without writing them. UC06 Stock inquiry Book, Delivery, Delivery line, Sale, Sale line, Stocktake, Stocktake line D01, D05, D07
C03 Receiving Registers suppliers, records deliveries from suppliers with their lines, and adds to stock quantities on confirmation. There is no alteration or deletion after confirmation. UC02 Supplier registration, UC03 Delivery registration Delivery, Delivery line, Supplier D02
C04 Sales Accepts sales notifications from the payment service, records the sales and deducts from stock quantities. Notifications that include unregistered books are kept as pending and matched to registered books through a clerk's review. UC04 Sales posting, UC07 Pending sale review Sale, Sale line D02, D04
C05 Stocktaking Records a stocktake from start to confirmation, and replaces stock quantities with the counted quantities on confirmation. Starting and confirming switch the status of the stocktake (in progress / confirmed), and Stock checks it to refuse addition and subtraction. UC05 Stocktake Stocktake, Stocktake line D02, D05

The use cases column lists the use cases the component realises, the entities column the entities it reads and writes itself, and the design decisions column the design decisions it takes on. Reads and writes done by calling another component are not listed in the caller’s entities column, so the column is narrower than the rows of the CRUD matrix bundled per component. Decisions that apply to the whole system are placed on no component.

Deployment

The web application and the database share one server inside the store, and clerks use the system from the browsers of PCs and tablets over the store’s LAN (R15). The subject is a single store with 5 concurrent users (R17) and about 10,000 books (R16), well within what one server can handle. The server is not made redundant; recovery from a failure is by restoring the database from backup.

flowchart LR
  subgraph store["Store"]
    device["Clerk's device (PC / tablet browser)"]
    subgraph server["In-store server"]
      app["Web application"]
      db[("Database")]
    end
  end
  payment[["Payment service"]]
  device -- "Screen operations" --> app
  app --> db
  payment -- "Sales notifications" --> app

Sales notifications from the payment service reach the web application over the store’s connection. While the connection is down no notification arrives, but every use case other than sales posting (UC04) completes inside the store, so stock inquiries and delivery registration can continue (R19). How the notifications of sales made while the connection was down are delivered later is left to the agreement with the payment service and is not covered by this document.