Server Side Rendering(ish) with zero HTML

application/nd-javascript
tutorial

This tutorial demonstrates how the
application/nd-javascript
MIME type could work, as a substitute for the beloved HTTP HTML stream. It simulates a stream of newline-delimited JavaScript statements and shows how they build & update a web application.
Jump right to the demo.
application/nd-javascript
itself is not interesting.
application/nd-javascript
is a means to discuss evolving beyond
text/html
for transmitting applications. Sadly, because this capability does not actually exist in browsers, the following demonstration is faked. Whether a real implementation uses
 application/binary
,
application/wasm
, or another similar MIME--any or all would be welcome.
application/nd-javascript
is used for simplicity and because of its proximity to existing browser APIs. The following document uses the term "app" or "application" to describe browser experiences that warrant JavaScript usage, and"document" to describe browser experiences that do not.
Why do this at all?
  • For many applications, we build executables whose core function is an interplay of generating DOM, responding to the user, and updating the DOM. Obeserve the distinct lack of HTML mentioned in the prior statement. Consider web application runtimes, such as
    react
    ,
    svelte
    ,
    solid
    , etc. These toolkits are for building applications--and ultimately, DOM nodes. Indeed, they can generate HTML, but that is an important secondary feature. HTML is side-effect of these frameworks' DOM CRUD. Their primary objective is to make application development easier by applying tools that result in a predictable & DX-friendly DOM tree. Thus, if we have established that our primary application toolkits excel at
    DOM-ops
    and handling user events, why is it then that we commonly burden ourselves with also generating HTML? Most senior web-devs have all heard of
    VirtualDOM
    by this point. Why is there no
    VirtualHTML
    (/s)? For server side rendering, why do we use DOM-first libraries, convert to HTML, then post-hydration, go right back to DOM? The answer is that we have to, not that we want to. Can we cut out the HTML middleman and operate with DOM from start to finish? HTML is wonderful DSL for documents, but for applications it is pure overhead. For applications, our community would likely operate on DOM directly if the browser would allow us. Imagine if all of the power backing browser's HTML engines were actually APIs that we could tap into at boot time!
  • Efficiency. Thousands to millions of servers exist in the wild with the nearly sole purpose of generating HTML. If applications could actually be compiled to static artifacts, they could be served by CDNs only, with optional runtime enhancement at edge computing layers, which often already exists. Large layers of compute could be erased in web infrastructure.
Let's explore a HTML-free web application load!
NDJavaScript Emulator - Follow steps below to begin
https://ndjavascript.cdaringe.com/

Step 1 - Start loading a page

GET https://ndjavascript.cdaringe.com/
user-action
Simulate starting a page load. On large viewports, you'll see the network request in the simulated devtools