Architecture & Internals

DriftJS is built from first principles to challenge traditional assumptions about web framework runtime architecture.

Rather than treating the browser DOM as an external side-effect of a tree diffing algorithm, DriftJS models UI rendering as a bytecode interpretation process operating on a fixed bank of virtual registers.


Architectural Map

┌────────────────────────────────────────────────────────────────────────┐
│                        COMPILATION PIPELINE                            │
│                                                                        │
│   .drift Source ──► DriftLexer ──► DriftParser ──► DriftTransformer    │
│                                                          │             │
│                                                          ▼             │
│                       CompiledModule ◄───────── DriftGenerator         │
│                       - Bytecode (Uint32Array)                         │
│                       - Constants Pool (Array)                         │
│                       - ReactiveBindings[]                             │
└──────────────────────────────────┬─────────────────────────────────────┘
                                   │
                    ┌──────────────┴──────────────┐
                    ▼                             ▼
       ┌────────────────────────┐    ┌────────────────────────┐
       │     DriftClientVM      │    │     DriftServerVM      │
       │   (Browser / Client)   │    │    (Server / Node)     │
       │                        │    │                        │
       │ - 256 Registers Bank   │    │ - 256 Registers Bank   │
       │ - Real DOM Nodes       │    │ - Virtual ServerNodes  │
       │ - LIS Keyed Reconciler │    │ - HTML String / Stream │
       │ - Microtask Batching   │    │ - Comment Hydration    │
       └────────────────────────┘    └────────────────────────┘

Topics in this Section