Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Deno 12 min read How-to mediumAdept

The Future (and the Past) of the Web is Server Side Rendering

Server-side rendering is presented as the answer to bloated client-side apps, with median page weight up 388% on desktop and 1288% on mobile over ten years. The post traces the path from PHP-era server rendering through SPAs and client-side rendering, then back to SSR, weighing the tradeoffs of hydration and favouring islands architecture (used by Deno's Fresh) to ship less JavaScript. A walkthrough in Deno with Oak builds three versions of the same list app: plain Handlebars templating, server-rendered HTML with client-side updates, and isomorphic JavaScript that shares one render function between server (via deno_dom) and client.

Assumes: JavaScript basicsHTTP routingDOM manipulation

Related posts

  • A Gentle Introduction to Islands

    Deno mediumAdept

    Islands architecture renders pages as static HTML and hydrates only isolated interactive Preact components, avoiding the whole-page, top-down hydration that ships framework JS even for static content. Fresh implements it by reading islands from the generated fresh.gen.ts manifest and using Preact's options.vnode hook during SSR to wrap each island in frsh-id:index HTML comments. It then emits a hydration script only when islands were encountered. In the browser, a revive function walks the DOM for those comments and renders each component with its serialized props, so pages with no islands ship zero JavaScript. Astro's client directives, partial hydration in Marko, React Server Components and Qwik's resumability are compared as alternative approaches.

  • A Whole Website in a Single JavaScript File

    Deno mediumAdept

    A demo multi-page website fits entirely in one JavaScript file and is server-rendered on demand at the edge with Deno. Routing uses a small `router` module built on `URLPattern`, and JSX is rendered server-side with `nanossr`, which styles via twind. Triple-slash reference comments select exactly which TypeScript libs (dom, dom.asynciterable, deno.ns) are loaded. Hosted on Deno Deploy, the site gets a perfect PageSpeed score and is served from 29 data centers over an anycast IP at no cost.

  • Fresh 1.4 – Faster Page Loads, Layouts and More

    Deno mediumAdept

    Fresh 1.4 adds optional ahead-of-time asset compilation via `deno task build`, which serves island assets roughly 45-60x faster on serverless cold starts than on-the-fly JIT compilation; a ~30kB search island that took 4.28s now revives near-instantly. The development server still uses JIT. The release also lets `_app.tsx` render the full html/head/body document, with a fallback to the old template when no html tag is rendered. New features include nested and async `_layout` files with opt-out config, `defineRoute`/`defineLayout`/`defineApp` typing helpers, parenthesized route groups that don't affect URLs, and private `(_components)` and `(_islands)` folders for colocating code.

  • Fresh 1.0

    Deno mediumAdept

    Fresh is a full stack web framework for Deno that renders pages just-in-time on the server and ships zero JavaScript to the client by default, using the islands architecture so only explicitly opted-in components are hydrated in the browser. It uses Preact and JSX/TSX on both server and client, has file-system routing with handlers for custom responses and async data loading, and has no build step: TypeScript and JSX are transpiled on demand, so deployments are near-instant. Version 1.0 is declared production-ready and is well suited to edge runtimes such as Deno Deploy, Netlify Edge Functions and Supabase Edge Functions.

  • How we built JSR

    Deno mediumAdept

    JSR, the JavaScript Registry, splits into components with different reliability targets: a highly available Postgres cluster behind a Rust/Hyper API on Google Cloud Run targeting 99.9%, and a global CDN for package source and npm tarballs targeting 100% uptime. The jsr.io site uses Fresh's server-side rendering with island hydration and plain HTML forms. TTFB for users far from the US region was cut by eliminating request waterfalls, so no route needs more than one roundtrip between the render server and the API. At publish time, diverse module resolution styles are normalized into an explicit ESM format so consumers never depend on probing.

The quest for software engineering knowledge.

Look:
Layout: