Start
Introduction
What White.js is, what it gives you out of the box and what it deliberately leaves out.
White.js is a thin web framework built on Express 5. It is made for sites and services that talk to each other: signed calls between servers, events and health checks are part of the framework, not something you assemble from packages.
It stays small on purpose. Routes are files, views are Eta templates, static files are served from one folder, and everything else is a plain Express app that you already know how to extend.
#What you get
- File-based routing.
server/routes/client/about.jsis/about.[id]and[...path]segments, folder middleware (_middleware.js) and method exports (export const GET) are built in. - Safe defaults. Security headers with a per-request CSP nonce, rate limits, a CSRF origin check, signed cookies, request ids and body limits are on before you write a line.
- Services that talk to each other. HMAC-signed requests, retries, a circuit breaker, events and discovery between servers. Turn it on with one
meshsetting. - Clean lifecycle. Failed start-ups roll back what was opened, shutdown drains requests and runs your
onClosehandlers, health and readiness endpoints exist from the start. - Great terminal experience. Live reload in
white run dev, generators,white doctor,white routes, and an installer with live progress. - Versioned contracts. Protocols and migrations let libraries and your app move between generations of a contract in a separate, reviewable, reversible step.
- Types without a build step. Declarations for
white-jsandwhite-js/testgive editors completion even in plain JavaScript.
#A route in full
// server/routes/api/items.js -> GET /api/items, POST /api/items
export const GET = async (req, res) => res.json(await req.ctx.cache.wrap('items', loadItems, '30s'));
export const POST = [validate({ body: schema }), (req, res) => res.status(201).json(create(req.valid.body))];#Requirements
- Node.js 20.12 or newer
- Git, only to install examples
#Where to go next
- Getting started installs the CLI and creates a site.
- Configuration lists every setting and its default.
- Routing explains the file layout.
- Deploy to Vercel puts a site online with the Vercel plugin.