NIM · COMPILE-TIME · REACTIVE

Nexum

◆

A compile-time reactive web framework for Nim.

Experimental · Design Phase
Get StartedGitHub

What is Nexum

Nexum generates fine-grained DOM updates at compile time using Nim's macro system. No virtual DOM. No diffing algorithm. Just precise, signal-driven mutations emitted directly from your templates.

The same component code compiles to both a C server binary emitting HTML strings and a JS client bundle mounting real DOM.

Compile-Time Codegen

Templates are parsed into IR and lowered to imperative DOM or string-builder code at compile time.

Fine-Grained Signals

Signal reads auto-track dependencies. Effects rerun only when their sources change, Solid.js-style.

Isomorphic by Default

One source file, two backends. SSR emits HTML; the client hydrates only the islands you mark.

Zero-JS Static Pages

Unmarked components ship zero JavaScript. Only island-marked components are sent to the browser.

See It In Action

Nexum templates look like HTML but compile to zero-overhead DOM operations.

Reactive signalsNim
let count = signal(0)

proc Counter(): auto =
  buildHtml:
    button(
      onclick = proc(ev: Event) = count.set(count() + 1)
    ): "Clicked " & $count() & " times"
Live Result

Signal Counter

0 times
Data bindingNim
let name = signal("")

proc Greeting(): auto =
  buildHtml:
    input(
      type = "text",
      oninput = proc(ev: Event) =
        name.set($ev.target.value)
    )
    p: "Hello, " & $name()
Live Result

Data Binding

Hello, !

Characters: 0

Control flowNim
let show = signal(true)

proc Conditional(): auto =
  buildHtml:
    if show():
      p: "Visible!"
    else:
      p: "Hidden"
    for i in 1..3:
      li: $i
Live Result

Conditional Rendering

Status: ✨ Visible!

Under The Hood

Three stages. Three layers. One source file. Two compiled outputs.

The Pipeline

01

Parse

buildHtml DSL is parsed into an intermediate representation at compile time.

→
02

Analyze

The analyzer detects dynamic text, attributes, events, and islands.

→
03

Codegen

Backend-specific codegen emits DOM code (JS) or string builders (C).

The Stack

1

App Layer

@component · @page · buildHtml · Signal

2

Compiler Layer

Parser → Analyzer → Codegen (Client / Server)

3

Runtime Layer

Signals · DOM Runtime · SSR Renderer · Hydrator

The parser transforms the buildHtml DSL into an intermediate representation. The analyzer detects dynamic text, attributes, events, and islands. Backend-specific codegen emits either DOM creation code (JS) or fast string-building code (C). Components marked with @island are emitted with hydration markers so the client only rehydrates the interactive parts.

The Numbers

Compile-time codegen eliminates the runtime overhead that other frameworks carry.

RuntimeVDOMSSRHydrationLang
React~40 KBYesYesFullJS
Vue~30 KBYesYesFullJS
Svelte~5 KBNoYesFullJS
Solid~7 KBNoYesFullJS
Nexum0 KBNoYesIslandsNim

Get Started

Install

nimble install nexum

Define a component

proc greeting(): auto =
  buildHtml:
    h2: "Hello, Nexum"

Render on the server

echo greeting()  # → 

Hello, Nexum