Web development
Front end vs back end: follow one click through the whole system
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.
- The front end presents the action and sends the request.
- The back end verifies the rule and records the outcome.
- The network carries messages; it does not guarantee that both sides share the same knowledge.
- Check the result with the server before reporting success or failure.
There is one place left. Try to book it.
Session EDK—0000
Fictional discovery workshop
1 place leftUnderstanding a web system
- Date
- 24 September · 10:00
- Format
- 45 minutes · online
Nothing has been sent yet.
The confirmation did not arrive. Is your place booked?
Make the request before choosing.
Here is the simulated journey of the request.
- 01Your browserWaiting
- 02RequestWaiting
- 03Server + dataWaiting
- 04ResponseWaiting
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.
Three views. One proven outcome.
The interface can now speak with the system’s evidence.
- Front end Screen updated
booking: confirmedThe interface has checked the result. - Server trace Operation found
POST /bookings · 201The same operation identifier is present. - MySQL One committed record
bookings · COMMIT · 1 rowThe shared state contains no duplicate.
Evidence aligned · EDK—0000The simulated result is now verified. The screen can display it.Confidence does not come from the animation. It comes from three observations that now describe the same operation.
Compare the other situationsNormal return, competing visitors, safe retry
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.
EDK—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.
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.
Presents the choice, collects input and explains the state it currently knows.
Carries requests and responses. Delay, interruption and duplication must be anticipated.
Applies rules that must remain true for every visitor, device and channel.
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.
| Need | Front-end role | Back-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. |
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.
Intent
The control has a clear action, works with keyboard and pointer, and prevents accidental repeated activation.
Request
The browser prepares the data and addresses the request. Session or authentication information lets the server identify the caller and verify authorisation.
Transport
DNS, connection, TLS, proxies and HTTP carry bytes. A timeout describes the client’s wait, not the server’s outcome.
Decision
The server authenticates the caller, validates the input and evaluates the current business rule.
Commit
The operation changes shared state atomically or leaves it unchanged. Partial success must be designed explicitly.
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.
| Architecture | What the browser receives | Where decisions happen | Useful 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.
Gives the document its structure and meaning. PHP can generate it on the server; the browser interprets the result.
Controls presentation and responsive layout after the document reaches the browser.
Handles browser-side interaction and can request data without replacing the whole page.
Coordinates server-side rules, permissions, services and responses. It can render pages, expose APIs or do both.
Expresses operations on relational data. PHP sends controlled queries through a database driver.
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.
| Mechanism | Example | What 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. |
- PHP starts a transaction and checks whether the operation identifier already has a result.
- If it is new, the application reserves capacity with a locking read or a conditional atomic update.
- It inserts the booking and records the operation result under a unique key.
- It commits once every rule that must remain true is respected; otherwise it rolls back the whole unit.
- 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).
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).
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.
- Give the operation one correlation identifier that can be followed from browser to logs and downstream services.
- Measure boundaries separately: interaction delay, request start, server duration, dependency duration, response transfer and render completion.
- Record the outcome as well as the duration. A fast refusal, a cached success and an unknown timeout need different interpretation.
- 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.
| Responsibility | Question to settle | Concrete 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.
- Action: did the browser register the click and build the intended request?
- Transport: did that request reach the expected endpoint, once or more than once?
- Processing: which rule ran, under which identity and with which input?
- Persistence: was the shared state committed, rejected or left unchanged?
- Response: what status and payload left the server, and did the browser receive them?
- 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.
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.
Full message to copy
No message is sent from this page.
Review and publish the post yourself on LinkedIn.
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.
Name uncertainty
Waiting, refused and unknown are different states. The interface should never invent certainty.
Protect shared truth
Availability, permission and payment rules belong where every request can be checked.
Make failure diagnosable
An operation identifier and an end-to-end trace turn an ambiguous symptom into a recoverable path.
Frequently asked questions
Additional answers to clarify the key points covered in this article.
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.