Level: Understand

Front end vs back end: follow one click through the whole system

An interactive experiment to understand where the interface stops, where the server decides, and why a missing confirmation proves nothing on its own.
Estimated reading time:
A paper interface is connected to logic and data compartments by a green loop.

Clicking “Book” looks simple. Behind it, several responsibilities must agree while messages can be delayed, lost or repeated. Run the 90-second experiment, then use the responsibility map and diagnostic trace on any web product.

Interactive experiment · about 90 seconds

Follow your click beyond the screen.

One place remains in a fictional workshop. You request it. The confirmation never reaches your screen. Was the booking made? Make a hypothesis or open the explanation directly, then inspect the simulated journey.

Teaching simulation: no real booking or personal data is sent.

The answer cannot be inferred from the screen alone.

The browser can send a request without receiving its response. In this scenario, the server assigns the place and the database records it, but the confirmation is lost on its way back. Retrying blindly could duplicate the effect unless the system recognises the repeated request.

  1. The front end presents the action and sends the request.
  2. The back end verifies the rule and records the outcome.
  3. The network carries messages; it does not guarantee that both sides share the same knowledge.
  4. Check the result with the server before reporting success or failure.
01 · Act

There is one place left. Try to book it.

Session EDK—0000

Fictional discovery workshop

1 place left

Understanding a web system

Date
24 September · 10:00
Format
45 minutes · online

Nothing has been sent yet.

02 · Hypothesis

The confirmation did not arrive. Is your place booked?

Read the essential explanation without running the experiment

Make the request before choosing.

03 · Trace

Here is the simulated journey of the request.

  1. 01
    Your browserWaiting
  2. 02
    RequestWaiting
  3. 03
    Server + dataWaiting
  4. 04
    ResponseWaiting

Scenario result

The booking exists. Your screen does not know it.

The server completed the operation, but the response was interrupted. A missing confirmation is therefore not proof of failure.

Compare the other situationsNormal return, competing visitors, safe retry
05 · Change one cause

Rewind the same click.

Only the selected condition changes.

System verdict

The action succeeded, the message failed.

After an uncertain response, the product must let the person check the status or safely repeat the same operation. It must not start a new independent booking blindly.

Booking ledgerEDK—0000 · 1 place · recorded once
  • Clean returnThe action succeeds and its confirmation reaches the browser.
  • Lost responseThe action may have succeeded while the browser still lacks its result.
  • Two visitorsTwo distinct requests must not obtain the same final place.
  • Repeated requestA recognised retry must not create a second booking.

What this experiment helps explainThe front end can report only what it knows. The back end must protect the real operation.

The durable distinction

Front end and back end separate responsibilities, not simply what is visible and invisible.

The front end is the part executed for the user, usually in the browser: structure, presentation, interaction, local validation and the display of known states. The back end is the server-side part that receives requests, applies shared rules, controls access, coordinates data and returns a response.

A hidden browser calculation is still front end. A server-generated page that you can see is still produced by back-end code. Visibility is therefore a poor boundary; execution and responsibility are the useful ones.

Browser

Presents the choice, collects input and explains the state it currently knows.

Network

Carries requests and responses. Delay, interruption and duplication must be anticipated.

Server

Applies rules that must remain true for every visitor, device and channel.

Persistence

Stores the shared state when the product needs one; it is not mandatory for every site.

The guarantee test

Put a rule where it can actually be guaranteed.

Decision table for a web responsibility
NeedFront-end roleBack-end role
Explain an error immediately
Show a clear, contextual message.
Return a precise, safe error state.
Protect the last available place
Disable repeat actions and show progress.
Make the final allocation atomic and authoritative.
Protect private data
Avoid exposing secrets; collect only what is needed.
Authenticate, authorise and filter every request.
Retry after a timeout
Reuse the same operation identifier and explain uncertainty.
Recognise that identifier and return the existing result.
Rule of thumb

The front end improves the experience. The back end protects any rule that must hold when the browser is modified, offline, stale or competing with another browser.

The useful exception

A website can work without an application back end.

A static site can deliver HTML, CSS, JavaScript and media without server-side application processing on every visit or storing modifiable business data. A portfolio, documentation site or campaign page may need no database and no custom API.

A back end becomes useful when the experience needs a shared truth: accounts, stock, permissions, payments, saved content, personalisation or coordination between users. Many products also combine static delivery with a small number of serverless or third-party services.

Anatomy of one click

Between the button and the confirmation, six contracts must hold.

A click does not travel as a click. The front end interprets an event, reads the current form state, builds a request and changes the interface to acknowledge the action. From that point on, the product crosses several boundaries. Each boundary can succeed while the next one fails.

  1. Intent

    The control has a clear action, works with keyboard and pointer, and prevents accidental repeated activation.

  2. Request

    The browser prepares the data and addresses the request. Session or authentication information lets the server identify the caller and verify authorisation.

  3. Transport

    DNS, connection, TLS, proxies and HTTP carry bytes. A timeout describes the client’s wait, not the server’s outcome.

  4. Decision

    The server authenticates the caller, validates the input and evaluates the current business rule.

  5. Commit

    The operation changes shared state atomically or leaves it unchanged. Partial success must be designed explicitly.

  6. Explanation

    The response returns a stable status and useful data; the front end translates both into a state the person can act on.

The important gap: “the browser stopped waiting” and “the server did nothing” are not equivalent statements. This is why payment, booking and order interfaces often provide a status lookup instead of presenting an immediate retry as the only option.

For a deeper reading: the following sections show how these responsibilities translate into an architecture and a PHP/MySQL example. You do not need them to retain the essential distinction.

Architectures in practice

The boundary moves, but the responsibilities remain.

How common architectures distribute the work
ArchitectureWhat the browser receivesWhere decisions happenUseful when
Static site
Files already built
Mostly at build time; optional external services
Content changes less often than it is read.
Server-rendered site
HTML produced for the request
Server before the page is returned
Content, identity or SEO benefits from ready HTML.
Single-page application + API
An application shell, then data
Browser for presentation; API for shared rules
Rich, stateful interactions dominate the experience.
Hybrid or edge-rendered
A mix of prebuilt, streamed and interactive fragments
Build, edge, server and browser according to the route
Teams need different rendering strategies inside one product.

“Front end” therefore does not mean “single-page application”, and “back end” does not mean “database”. A back end can return HTML. A front end can contain complex local logic. An API can be owned by a separate team or shaped specifically for one interface through a backend-for-frontend.

The right architecture follows the constraints: how fresh the data must be, whether users share state, what must work before JavaScript, where latency occurs, which team operates the system and how failures are recovered. Framework names come after these questions.

Concrete example · PHP

What does PHP actually do when the browser sends a request?

PHP is a server-side language. The browser does not download the PHP source and does not execute it. A web server routes the request to the PHP application; PHP reads the request, calls the required code, may query a database or another service, then produces a response. The browser receives the result — often HTML or JSON — without receiving the server program that created it.

For the fictional booking, JavaScript can react to the button and send POST /bookings. PHP can authenticate the visitor, validate the workshop identifier, start a transaction, verify the remaining capacity, record the booking and associate the operation identifier with the result. It then returns a status such as 201 Created, 409 Conflict or an existing booking for a recognised retry.

HTML

Gives the document its structure and meaning. PHP can generate it on the server; the browser interprets the result.

CSS

Controls presentation and responsive layout after the document reaches the browser.

JavaScript

Handles browser-side interaction and can request data without replacing the whole page.

PHP

Coordinates server-side rules, permissions, services and responses. It can render pages, expose APIs or do both.

SQL

Expresses operations on relational data. PHP sends controlled queries through a database driver.

The precise distinction

PHP is not “the back end” by itself. A back end also includes its HTTP contract, domain rules, data stores, queues, caches, external services, security controls, deployment and observability. PHP is the language that can coordinate those parts.

Modern PHP applications are not limited to full-page reloads. The same codebase can render an accessible first page, answer JSON requests, process background jobs and expose command-line tasks. Frameworks can organise routing, dependency injection, validation and persistence, but the fundamental lifecycle stays readable: request in, rules applied, response out.

PHP is a strong choice when a team values mature hosting, server-rendered content, a broad ecosystem and direct integration with relational data. A site delivered as static files does not need to execute PHP on every visit, although PHP may still generate those files beforehand. It is not automatically the best answer for every real-time or compute-intensive workload. The decision belongs to the product’s constraints and the team that will operate it.

Concrete example · MySQL

MySQL keeps the shared state, but the database is not the whole back end.

MySQL is a relational database management system. It stores structured data in tables, links records through keys and can enforce rules that must remain true even when several requests arrive together. PHP communicates with it through a driver such as PDO; the browser should never receive database credentials or connect directly to the production database.

A minimal booking model might separate workshop, booking and operation. The workshop carries its capacity. A booking links one person to one workshop. The operation stores the request identifier and the result already produced. Sending the same identifiable intent several times without creating several bookings is called idempotency. Names vary; the important point is that identity, relationships and uniqueness are explicit.

What protects the booking at each layer
MechanismExampleWhat it prevents
Primary key
One stable identifier per booking
Ambiguous or unaddressable records.
Foreign key
Every booking references an existing workshop
Orphaned relationships.
Unique constraint
One operation result per idempotency key
The same intent being committed twice.
Transaction
Check capacity and record the booking as one unit
A half-applied operation.
Lock or atomic update
Only one request can consume the final capacity
Two visitors receiving the same last place.
Prepared statement
Values are bound separately from SQL
User input changing the structure of the query.
  1. PHP starts a transaction and checks whether the operation identifier already has a result.
  2. If it is new, the application reserves capacity with a locking read or a conditional atomic update.
  3. It inserts the booking and records the operation result under a unique key.
  4. It commits once every rule that must remain true is respected; otherwise it rolls back the whole unit.
  5. If the HTTP response is lost, a retry with the same key reads the committed result instead of inserting again.

Important limit. Repeated requests with the same key may arrive concurrently. An initial lookup is not enough: the implementation must represent an operation in progress, handle uniqueness conflicts and return the result already committed. The sequence above explains the contract; it is not a complete algorithm. See the primary guidance on MySQL locking reads (opens in a new tab) and safe idempotent retries (opens in a new tab).

Shared responsibility

PHP expresses the business intention and decides which error to return. MySQL enforces data integrity and transaction boundaries. The strongest design uses both instead of relying on a disabled button or on a prior availability check.

Trust boundary

Client-side validation helps people. Server-side validation protects the system.

The browser can detect an empty email field, explain a format and avoid a needless round trip. That makes the interaction faster and clearer. It cannot prove that an email is authorised, that a price is legitimate or that stock still exists. Browser code and requests can be changed outside the intended interface.

The server must therefore validate every value that affects identity, permission, money, availability or stored data, and verify authorisation on every request. It should reject by default, expose only the data required by the caller and return errors that are useful without revealing secrets. The front end then turns those errors into recovery: correct a field, sign in, choose another slot or check an operation already in progress. OWASP Authorization Cheat Sheet (opens in a new tab).

Two validations, two jobs

Duplicating a rule in the browser can improve immediacy. The authoritative version still lives on the server. When the two disagree, the server’s decision wins and the interface must explain it.

Performance and observability

A slow screen does not identify the slow layer.

A user experiences one duration, but engineers need a decomposition. Time can be spent before the request leaves, in connection setup, at a gateway, in application code, waiting for another service, querying data, transferring the response or rendering the new state. Optimising the wrong segment may change a laboratory score without changing the delay people feel.

  1. Give the operation one correlation identifier that can be followed from browser to logs and downstream services.
  2. Measure boundaries separately: interaction delay, request start, server duration, dependency duration, response transfer and render completion.
  3. Record the outcome as well as the duration. A fast refusal, a cached success and an unknown timeout need different interpretation.
  4. Keep retries visible. A good average can hide duplicate work, cascading load or a small group of very slow requests.

Practical reading: browser tools show what the client sent and received; server traces show what the system processed. You need both to explain the whole transaction.

Working agreement

The interface between teams matters as much as the interface between programs.

Questions that prevent front-end/back-end integration failures
ResponsibilityQuestion to settleConcrete contract
Product and design
Which states can the person encounter?
Loading, empty, partial, refused, unknown, success and recovery states.
Front end
What does each response mean on screen?
Accessible controls, state machine, messages and retry behaviour.
Back end
Which rules must always remain true?
Authorisation, validation, transactions, idempotency and stable error codes.
Operations
How is one transaction followed?
Correlation identifiers, logs, traces, alerts and retention.
Quality
Which failure paths are exercised?
Slow response, lost response, duplicate request, expired session and concurrent action.

A useful API contract describes failure, not only success. Status codes, error identifiers, field errors, idempotency rules and examples let the interface recover without parsing an improvised message.

A diagnostic method

Do not guess from the symptom. Trace the transaction.

  1. Action: did the browser register the click and build the intended request?
  2. Transport: did that request reach the expected endpoint, once or more than once?
  3. Processing: which rule ran, under which identity and with which input?
  4. Persistence: was the shared state committed, rejected or left unchanged?
  5. Response: what status and payload left the server, and did the browser receive them?
  6. Rendering: did the interface translate that response into the correct state?

Concurrency and retry solve different failures. Concurrency control prevents two valid requests from both taking one scarce resource. Idempotency makes a repeated request produce the effect of one request. A robust booking flow often needs both.

Sources and limits

A model to reason with, not a map of every architecture.

The simulation deliberately compresses queues, caches, gateways, authentication, distributed databases and third-party services into four stages. Its purpose is to reveal responsibility and uncertainty, not to reproduce a production stack.

Primary reading
Prompt, full source and citation

Explore this analysis.

Choose a task, review the prompt and take it to your AI.

Front end vs back end: follow one click through the whole systemUpdated September 21, 2026

Read the full prompt

Your inputs stay in this browser until you paste them into your AI. No analysis runs here.

Your AI cannot read the link?

Copy the full source or download the document, then attach it to your conversation.

Edikka perspective

A trustworthy interface knows when it does not know.

Quality comes from a clear contract between what the browser can explain and what the server must guarantee.

01State

Name uncertainty

Waiting, refused and unknown are different states. The interface should never invent certainty.

02Rule

Protect shared truth

Availability, permission and payment rules belong where every request can be checked.

03Trace

Make failure diagnosable

An operation identifier and an end-to-end trace turn an ambiguous symptom into a recoverable path.

Article FAQ

Frequently asked questions

Additional answers to clarify the key points covered in this article.

4 selected questions View all FAQs

What is the difference between front end and back end?

The front end runs for the user, usually in the browser, and presents the state it knows. The back end runs on servers, applies shared rules, controls access, coordinates data and returns responses. The useful boundary is responsibility and execution, not visibility.

How can I tell whether a problem is in the front end or back end?

A symptom alone cannot identify the responsible layer. For a failed form, inspect the browser interaction, the request, its transport, server processing, persisted state, the response and its rendering. A correlation identifier helps connect these observations. Follow the traces, not only where the problem becomes visible.

Can a website work without a back end?

Yes. A static site can serve HTML, CSS, JavaScript and media without server-side application processing on each visit or a database. A back end becomes useful when the product needs accounts, permissions, payments, stored data or another shared state.

What is the difference between a race condition and an unsafe retry?

A race condition occurs when concurrent requests influence the outcome, such as two people requesting one place. An unsafe retry repeats an operation after an uncertain response and can duplicate its effect. Atomic allocation addresses the first; idempotency addresses the second.

Web solutions designed to perform

Strategy. Design. Code. SEO. AI. Clearer, faster, and more compelling digital experiences.

Related articles to continue the analysis