Search lands in PR-5.1 (Pagefind).

Explanation Beginner

Chapter 2 Updated

JavaScript on the Server

Servers, V8, ECMAScript, and how your JavaScript gets to machine code.

  • Full 22m
  • Revision 5m
  • Flow 2m

JavaScript on the Server — from request to CPU

flowchart TD
    subgraph NET [Network loop]
        C["<b>i · Client</b><br/>Browser / app<br/>knows server IP"]
          -->|"REQUEST"| S["<b>ii · Server</b><br/>Node.js process<br/>on a remote host"]
        S -->|"RESPONSE<br/>HTML · JSON · bytes"| C
    end
 
    S --> RT["<b>iii · Runtime</b><br/>Node.js = C++ app<br/>with V8 embedded"]
    RT --> V8["<b>iv · V8 engine</b><br/>Parses JS → AST<br/>Ignition + TurboFan"]
    RT --> API["<b>v · Node APIs</b><br/>fs · http · net · os<br/>the 'superpowers'"]
    V8 --> MC["<b>vi · Machine code</b><br/>Assembly / binary<br/>0110 1010 1111…"]
    MC --> CPU["<b>vii · CPU</b><br/>Executes natively<br/>x64 · IA-32 · ARM"]
 
    classDef net fill:#eaf2f8,stroke:#3a6ea5,stroke-width:2px,color:#1a1915;
    classDef core fill:#f5efe1,stroke:#6a8a4f,stroke-width:2px,color:#1a1915;
    classDef v8 fill:#fdecd3,stroke:#c2410c,stroke-width:2px,color:#1a1915;
    classDef hw fill:#ece5f5,stroke:#6b46c1,stroke-width:2px,color:#1a1915;
    class C,S net
    class RT,API core
    class V8,MC v8
    class CPU hw
  • Client (device)

    Browser or app. Holds the server IP and initiates the request.

  • Server

    Remote computer running a Node.js process that answers on a port.

  • Node.js runtime

    C++ application with V8 embedded — provides the JS runtime the process uses.

  • V8 engine

    Parses JS into an AST, then compiles hot paths via Ignition + TurboFan.

  • Node APIs

    The "superpowers" V8 lacks: fs, http, net, os, crypto, stream, child_process.

  • Machine code

    Assembly mnemonics (MOV, ADD, JMP) lowered to raw binary the CPU can execute.

  • CPU

    Your processor runs the machine code natively on x64, IA-32, or ARM.

Comments

Comments are disabled in this environment. Set PUBLIC_GISCUS_REPO, PUBLIC_GISCUS_REPO_ID, and PUBLIC_GISCUS_CATEGORY_ID to enable.