
Editorial illustration.
Originally published 16 June 2023; rewritten and reviewed on 15 October 2026.
A user clicks “Confirm Order” in the browser, the server writes a record, and a background worker sends a WhatsApp or email receipt. To the person using the app, that is one button press. To the system, it crosses at least four boundaries—browser, edge proxy, application server, database, and background queue—each with its own failure modes.
Before picking a framework or drawing a twelve-box microservice diagram, you should be able to draw those boundaries on a whiteboard and explain what happens when each one fails.
Follow one user action across trust boundaries
Start by tracing a single write operation from the browser all the way to disk. Identify what the client sends, what your edge layer (such as Cloudflare or Nginx) terminates and caches, how the server authenticates the caller, and where business rules are enforced.
The most common architectural bug is trusting the wrong side of a boundary. Client-side validation in React or vanilla JS improves usability, but it is never a security control. In an ASP.NET Core or PHP/Laravel endpoint, the server must always re-verify ownership and state transitions against the database:
// Enforce ownership at the server boundary, never trust a client-supplied userId
var order = await _db.Orders
.FirstOrDefaultAsync(o => o.Id == request.OrderId && o.CustomerId == currentUserId);
if (order is null) return NotFound();
If an external payment gateway like Billplz, FPX, or Stripe calls your webhook, that is another untrusted boundary until you verify the HMAC signature and check whether the order was already marked paid.
Separate responsibilities without inventing network hops
Presentation, domain rules, and persistence deserve clean separation in code. That does not mean each one needs its own Docker container, API gateway, and message broker.
For most business applications serving a few thousand to tens of thousands of daily users, a well-structured modular monolith—say, one ASP.NET Core or Drupal/WordPress backend backed by PostgreSQL or SQL Server—is dramatically easier to deploy, debug, and back up than five small services with unclear ownership. Split a module into a separate network service only when you hit a real scaling bottleneck, an independent deployment cadence, or a strict security boundary—not because a blog post told you monoliths are unfashionable.
Move work into a background job only when it genuinely outlives an HTTP request or needs controlled retries: generating a PDF invoice, resizing uploaded images, or calling a flaky third-party API. Once code moves to the background, it still needs durable state (Queued, Processing, Completed, Failed), an owner, and a dead-letter path so silent failures do not pile up unnoticed.
Design the failure path alongside the happy path
Every boundary can fail in ways that leave half-finished state behind. Ask three questions for every critical flow:
- What if the database times out mid-write? Wrap multi-table updates in a single transaction so you never end up with a paid invoice that has zero line items.
- What if the same request arrives twice? Users double-click submit buttons on shaky mobile data, and payment webhooks retry automatically. Use an idempotency key or a unique constraint on the transaction reference so a duplicate request returns the existing result instead of charging twice.
- How do we trace a broken request? Pass a correlation ID (such as
X-Request-IDor ASP.NET’sActivity.TraceId) from Nginx or Cloudflare into structured application logs. Log the ID, HTTP status, and error code—never raw JWTs, passwords, or Malaysian IC numbers.
Make recovery part of the architecture
An architecture diagram is incomplete if nobody knows how to restore the system at 2:00 AM. Automated daily database dumps (pg_dump or SQL Server backups) are only half the job; if you have never tested restoring one into a staging instance, you do not have a backup strategy—you have a wish.
Good web architecture is rarely flashy. It is a set of clear boundaries where every team member can explain where rules live, how partial failures are spotted, and who can bring the service back cleanly when something breaks.