↑ ↓ to move · Enter to open · Esc to close

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.js is /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 mesh setting.
  • Clean lifecycle. Failed start-ups roll back what was opened, shutdown drains requests and runs your onClose handlers, 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-js and white-js/test give editors completion even in plain JavaScript.

#A route in full

js
// 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