Writing
The browser is not the enemy
Somewhere along the way, the browser became the place where we put everything.
It fetches the data, owns the state, renders the interface, handles navigation and often knows more about the application than the server does. That can be the right design. It can also be a reflex that makes a simple page harder to ship, harder to inspect and harder to keep accessible.
I still like server-rendered pages. Not because I am nostalgic for a web that never existed, but because a browser is very good at rendering a document, and a server is very good at deciding what that document should contain.
The page is already a program
A browser is not a passive viewer. It parses HTML, applies CSS, runs JavaScript, manages focus, handles form state and exposes all of it to assistive technology. Even a page with no client-side framework is a small runtime.
The question is not whether JavaScript belongs in the browser. It is what the browser should own. For a content-heavy site, the answer can be very little. For an editor or a live dashboard, the answer changes completely.
I try to choose the boundary before choosing the framework. That sounds obvious. It is easy to forget once a component library is open.
Delivery is part of the design
When the server sends the first useful HTML, the browser can render something before the JavaScript has finished its conversation with the network.
That does not make the page static. It makes the first moment honest: the content exists before the interaction layer arrives.
Server rendering is not a moral position
Server rendering is a trade-off, not a badge. It gives me a small first response, a clear canonical URL and a form that works without a client router. It also means the server owns more of the rendering path, and I have to think about caching, templates and request time.
The benefit is not that the page is “old school”. The benefit is that the important content has fewer moving parts between the request and the screen.
For a portfolio, a documentation site or a content-heavy product, those moving parts are often unnecessary. For an application with deep local state and frequent partial updates, they may be exactly what the interface needs.
The client should earn its keep
JavaScript is not free. It has to be downloaded, parsed, executed and kept working across browsers. A small script can be a good trade. A large one should have a reason that survives a second look.
I ask three questions before adding a client-side feature:
- Does it improve the interaction in a way the server cannot provide?
- Does it work when it arrives late, fails or is blocked?
- Can the page still communicate its primary purpose without it?
If the answer to the third question is no, the feature is no longer an enhancement. It is the product, and the architecture should say so.
Progressive enhancement is a budget
Progressive enhancement is often presented as a moral requirement. I prefer to treat it as a budget. The base layer is HTML, CSS and the browser's own behavior. The next layer is a small amount of JavaScript for interaction. The final layer is the code that only runs when the network, the device and the user allow it.
A form is a useful example. It can submit normally, validate on the server and show a confirmation page. JavaScript can make the same form smoother, but it does not have to become the only way to send a message.
That approach also helps when something breaks. A failed script should not remove the content. A blocked request should not leave the page blank. The fallback is not a lesser version of the product. It is the product at its most reliable.
A policy is only real when it is enforced
A strict Content Security Policy is not a decoration for a security checklist. It changes how templates, scripts and asset URLs are built.
No inline styles, no third-party scripts, no convenient CDN. The constraints are annoying for a day and useful for the next few years.
What strict constraints actually change
A strict CSP makes certain shortcuts impossible. Inline styles disappear. A script from a CDN has to become a local dependency. A JSON-LD block needs a nonce. Images and fonts have to be served from a known origin.
At first this feels like friction. Then it becomes a design tool. The page cannot quietly accumulate a dozen remote requests. The asset pipeline has to be explicit. The HTML has to carry the structure, not a pile of injected behavior.
The result is not automatically fast or accessible. It is simply easier to reason about. That is worth something.
When a SPA is the right tool
A single-page application is the right tool when the interface is the product: an editor with rich local state, a real-time workspace, a dashboard where many panels update independently. In those cases, a client-side model can reduce complexity instead of adding it.
The mistake is using the same architecture for a page whose main job is to be read. A content page does not need a client router. A contact form does not need a state library. A portfolio does not need a hydration boundary around every heading.
The browser is not the enemy. The enemy is making it carry decisions that belong somewhere else.
The browser is a rendering target
I want the server to be responsible for the first answer, the browser to be responsible for the interaction, and the boundary between them to be visible in the code. That boundary is where performance, accessibility and failure behavior live.
When the first response is useful HTML, the page has already done its job. Everything after that is an improvement. That is a much better place to start than a blank screen and a promise that the application will arrive later.