WEB DEVELOPMENT

Modern Web Application Development: The Decisions That Shape Your Project

Frameworks get the attention, but a handful of early decisions about rendering, data, tooling and workflow decide whether a web app stays pleasant to work on. Here's what's worth understanding.

Mohamed Isak9 min read

Illustration of stacked browser windows on an indigo background with the title Modern Web Application Development
On this page
  1. Start with how each page gets its HTML
  2. Be clear about where data lives
  3. Know what your toolchain actually does
  4. Set up a workflow that survives a second developer
  5. Treat performance as a design constraint
  6. The problems tutorials leave out
  7. Where mobile fits in
  8. A short checklist
  9. Further reading

Most advice about building web applications starts with a framework. Pick React or Vue or Svelte, pick a meta-framework on top, and you're away.

The framework does matter, but less than you'd think. What tends to decide whether a project is still pleasant to work on a year later is a short list of decisions that often get made by accident in the first few weeks: how pages are rendered, where data lives, what the toolchain actually does, and how changes move from a laptop to production.

This guide walks through those decisions. It's aimed at developers who know how to build a page but want a clearer picture of the whole system, and at founders and leads who need to judge the choices their team is making.

Start with how each page gets its HTML

Every page a visitor sees has to become HTML at some point. The big architectural question is when that happens and where.

Diagram comparing four rendering strategies: static generation at build time, server rendering at request time, client rendering in the browser, and a hybrid of the three
Where and when the HTML for a page is produced

  • Static generation (SSG, or prerendering). HTML is produced once, at build time, and served as files. It's fast, cheap and easy to cache, but content only changes when you rebuild.
  • Server-side rendering (SSR). HTML is produced on every request (or on a cache miss). Content can be personal and current, but every page view now costs server time, and slow data sources slow the page.
  • Client-side rendering (CSR). The server sends a near-empty page and a JavaScript bundle, and the browser builds the interface. It works well behind a login, where search engines don't matter and the app is used for long sessions.
  • Hybrid approaches. Most modern frameworks let you mix the three, stream parts of a page as they become ready, or ship JavaScript only for the interactive "islands" of an otherwise static page.

The most useful rule here is to decide per route, not per application. A marketing page, a blog article and an account dashboard have different needs. The article should be static. The dashboard can be client-rendered. A product page with live stock levels might be static with a small piece of client-side data on top.

This site is a small example. Every page, including the article you're reading, is prerendered to plain HTML at build time, so it loads quickly and is readable by crawlers that don't run JavaScript. The JavaScript that follows only adds interactivity, like the search box on the blog page.

Hydration and the bugs it brings

When a page is rendered on the server and then made interactive in the browser, the framework "hydrates" it: it renders the same component tree on the client and attaches event handlers to the existing HTML. If the two renders disagree, you get a hydration mismatch. Depending on the framework, that's a console warning, a flash of changed content, or a part of the page being thrown away and rebuilt.

The usual culprits are things that differ between the server and the browser:

  • Dates and times formatted in the server's time zone on one side and the visitor's on the other
  • Random IDs or Math.random() used during render
  • Code that checks window or localStorage while rendering
  • Content that depends on the current time, such as "posted 3 minutes ago"

The fix is to make the first render deterministic and move anything browser-specific into an effect that runs after hydration. For dates, pin the locale and time zone:

js
// Same output on the server and in every visitor's browser
export function formatDate(isoDate) {
  return new Date(`${isoDate}T00:00:00Z`).toLocaleDateString('en-US', {
    year: 'numeric',
    month: 'short',
    day: 'numeric',
    timeZone: 'UTC'
  });
}

Be clear about where data lives

A lot of front-end complexity comes from treating two different kinds of state as one.

Server state is data that lives in your database and is only borrowed by the browser: products, orders, user profiles. It can go stale, other people can change it, and it needs caching, refetching and error handling.

Client state is data that only exists in the browser: whether a menu is open, what's typed into a form, which tab is selected.

Copying server state into a big global store and then trying to keep it in sync by hand is one of the most common sources of bugs in web apps. Data-fetching libraries such as TanStack Query and SWR, or the data-loading features built into frameworks, exist because caching, deduplication and invalidation are genuinely hard to get right yourself. Use one of them, and keep global client state small.

Watch for race conditions in the UI

A classic bug: a search box that fires a request on every keystroke. The user types "shoes", but the response for "sho" arrives after the response for "shoes" and overwrites it. The UI now shows results for a query the user never finished typing.

Cancelling the previous request fixes it:

js
let controller;

async function search(query) {
  controller?.abort();              // cancel the request still in flight
  controller = new AbortController();

  try {
    const res = await fetch(`/api/search?q=${encodeURIComponent(query)}`, {
      signal: controller.signal
    });
    if (!res.ok) throw new Error(`Search failed: ${res.status}`);
    return await res.json();
  } catch (err) {
    if (err.name === 'AbortError') return null; // superseded, not a real error
    throw err;
  }
}

Add a short debounce on top so you aren't sending a request for every keystroke in the first place.

Know what your toolchain actually does

Modern tooling hides a lot, which is mostly good until something breaks. It's worth knowing which piece is responsible for what.

ToolWhat it's forWhat to know
Package manager and lockfileInstalling exact dependency versionsCommit the lockfile. Without it, two machines can install different code.
Dev server and bundler (e.g. Vite)Fast local development and optimised production buildsDevelopment and production are built differently. Test the production build before you ship.
TypeScriptCatching type errors before runtimeMany bundlers strip types without checking them. Run tsc --noEmit in CI.
Linter and formatterConsistent code, fewer obvious mistakesAutomate them so code review is about logic, not semicolons.
Test runnersUnit, component and end-to-end testsA few end-to-end tests on critical flows catch more than hundreds of shallow unit tests.

Two points from that table catch teams out more than any others.

First, the development server is not the production build. Vite, for example, serves your source files as native ES modules during development and bundles them for production. Code-splitting, minification, environment variables and asset paths all behave differently. A bug that only appears in production is often a bug that only appears in the build. Run the production build locally (vite build && vite preview) before you deploy anything significant.

Second, environment variables are not automatically secret. In most front-end tooling, variables with a public prefix (VITE_ in Vite, NEXT_PUBLIC_ in Next.js) are written into the JavaScript bundle at build time. Anyone can read them in their browser. API keys for paid services belong on a server, not behind a prefix.

Set up a workflow that survives a second developer

Workflows that are fine for one person tend to break when a second joins. A few habits keep things calm:

  • Short-lived branches. Merge small changes often instead of keeping a feature branch alive for weeks.
  • Preview deployments. Most hosting platforms can deploy every pull request to its own URL. Reviewers can click through the change instead of imagining it.
  • CI that blocks merges. Type-check, lint, test and build on every pull request. If the build can fail, it should fail before merge, not after.
  • One command to run the project. A new developer should be able to clone the repository and run it with one documented command.

A minimal GitHub Actions workflow that covers the basics:

yaml
name: CI
on: [pull_request]

jobs:
  check:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: 22
          cache: npm
      - run: npm ci
      - run: npx tsc --noEmit
      - run: npm run lint
      - run: npm test
      - run: npm run build

None of this is sophisticated, and that's the point. Boring, automatic checks free up review time for the questions that need a person: is this the right change, and is it understandable?

Treat performance as a design constraint

Performance work is much cheaper at the start than as a clean-up project. Google's Core Web Vitals are a reasonable shared target because they describe what users feel:

  • Largest Contentful Paint (LCP) measures how long the main content takes to appear. Aim for 2.5 seconds or less.
  • Interaction to Next Paint (INP) measures how quickly the page responds to taps, clicks and key presses. Aim for 200 milliseconds or less.
  • Cumulative Layout Shift (CLS) measures how much the page jumps around while loading. Aim for 0.1 or less.

Each is assessed at the 75th percentile of real visits, so a fast laptop on office Wi-Fi tells you very little. The levers that matter most are unglamorous:

  • Ship less JavaScript. Split code by route and lazy-load heavy components that aren't needed straight away.
  • Give images dimensions. A width and height (or an aspect-ratio) lets the browser reserve space, which removes most layout shift.
  • Load fonts deliberately. Self-host them, preload the one used for your largest text, and use font-display: swap.
  • Audit third-party scripts. Chat widgets, tag managers and analytics are frequent causes of poor INP. Each one should earn its place.

Lab tools such as Lighthouse are good for catching regressions during development. Field data from real users, such as Chrome's user experience report or your own monitoring, tells you whether the site is actually fast for the people using it.

The problems tutorials leave out

Some of the hardest parts of web development don't appear in getting-started guides:

  • Dependency upgrades. Small, regular upgrades are much less painful than one large one every two years. Automated update pull requests help, as long as CI is trustworthy enough to merge them.
  • Authentication edge cases. Expired sessions mid-checkout, logins across subdomains, cookies blocked in embedded contexts. Decide early whether you're using cookie-based sessions or tokens, and understand the SameSite cookie attribute before it surprises you.
  • Time zones and locales. Store timestamps in UTC, convert at the edges, and test with a user in a different time zone.
  • Errors you can't see. Users rarely report bugs; they leave. Add error tracking and structured server logs before launch, not after the first angry email.
  • Accessibility. Retrofitting keyboard support and semantic HTML onto a finished interface is slow. Building with semantic elements from the start costs almost nothing.

Where mobile fits in

Sooner or later, most products that start on the web get asked about a mobile app. The right answer depends on what the app needs to do. A responsive website is the foundation either way. From there, the options range from a progressive web app, to a native shell around your website, to fully native apps with their own codebase.

We build WebAppStudio, which takes the middle path for stores and content sites: the website stays the source of truth, while the cart, checkout and notifications run natively. WebAppStudio's own blog has a clear explanation of WebView, hybrid and native apps if you're weighing the trade-offs.

A short checklist

If you're starting a web application, or inheriting one, these questions are worth answering explicitly:

  1. How is each route rendered, and why?
  2. Which data is server state and which is client state? What caches the server state?
  3. Does CI type-check, lint, test and build every change?
  4. Has anyone run the production build locally this week?
  5. Are any secrets sitting behind a public environment variable prefix?
  6. Do you know your LCP, INP and CLS from real users?
  7. Will you find out about a production error before a customer tells you?

None of these depend on which framework you picked. They're what separates a project that's easy to change from one that everyone is afraid to touch. When you're ready to go deeper on structure, our guide to building scalable, maintainable web applications picks up where this one leaves off.

Further reading

  • Web development
  • Architecture
  • Performance
  • Tooling

Share

XLinkedInEmail
Back to all articles