Decoupled Generator & Serving Layer
Staticraft eliminates traditional SSR vulnerabilities by isolating HTML compilation inside a private background daemon and serving immutable static files directly through Nginx or CDNs.
Decoupled Architecture
How Staticraft Operates
By severing the connection between public web traffic and your dynamic database backend, Staticraft delivers bulletproof security, zero-downtime updates, and sub-millisecond static response times.
Background Generator
A daemon process running inside a private network or CI/CD runner. It pulls data from DBs, CMS, or APIs and compiles static HTML.
Nginx / Caddy / CDN
The public web server serves pre-rendered static HTML files directly from `.raft/`. Zero Node.js runtime overhead on HTTP hits.
Core Architectural Principles
Four design guarantees that make Staticraft resilient, fast, and secure.
Private Generator Isolation
In production mode (staticraft start), the engine opens zero listening HTTP ports. Attackers cannot send malformed requests, SQL injections, or RCE payloads to the application backend because the backend is completely unexposed.
Atomic File Swapping
Pages are compiled into temporary staging files first. Once rendering completes successfully, Staticraft triggers an atomic rename(2) system call to swap the file into .raft/. Nginx never encounters empty or half-rendered pages.
Timer-Driven Revalidation
Routes specify their own background refresh intervals via revalidate: 600. The background ScheduleManager handles background timers seamlessly without needing complex CI/CD webhook triggers.
Sub-Millisecond TTFB
Nginx, Caddy, or CDNs serve pre-rendered static files directly from RAM or disk cache. Response times are bounded only by network latency (< 2ms TTFB), easily handling millions of requests.