Scenario in use throughout this explorer
A customer visits hearthstoneroastery.co.uk, selects a 250g bag of Kenya Nyeri, and clicks "Place Order". Select each stack layer below to see exactly what happens at that tier.
Layer 1 · Client-Side
Front-End Presentation Layer
Runs inside the user's browser — no server required for rendering
What happens at this layer?
When the customer lands on the product page, the browser has already downloaded the HTML, CSS, and JavaScript files from the server. From this point forward, the front-end operates entirely client-side. The product catalogue is rendered from a previous API response stored in memory.
When the customer clicks "Add to Basket", a JavaScript event listener
intercepts the click, updates the basket state in memory, and rewrites the basket
icon count in the DOM — instantly, without any network request. When they proceed
to checkout and click "Place Order", JavaScript collects the form data,
validates it, and dispatches a POST request via
fetch() to the back-end API.
Data Flow Route at this layer
Layer 2 · Server-Side
Back-End Business Logic Layer
Runs on a remote server — processes every request before touching the database
What happens at this layer?
The server receives the POST /api/orders request. The
first action is authentication: the session token in the request header is verified.
If it is invalid or expired, the server returns a
401 Unauthorized response immediately — no
database query is executed.
If authentication passes, the back-end validates the payload server-side — product
ID exists, quantity is valid, stock is available — then constructs and executes
a SQL query to write the new order record. It returns a
201 Created JSON response with the new
order ID.
Data Flow Route at this layer
Layer 3 · Data Persistence
Database Storage Layer
Persists all application state — survives server restarts and user sessions
What happens at this layer?
The database receives a parameterised SQL
INSERT query from the back-end. It
writes the new order record into the orders table,
simultaneously decrements the
inventory table's stock count for
Kenya Nyeri, and wraps both operations in a transaction so that a failure in either
step rolls back both.
The generated order_id primary key is returned
to the back-end as a query result. The back-end passes it to the front-end in the
JSON response. The front-end uses it to display the confirmation screen.
Data Flow Route at this layer
Interactive Demo
Simulate a Full Request-Response Cycle
Press "Run Simulation" to trace a coffee order through the full stack.