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

Node.js framework · Built on Express 5

A thin framework for sites that talk to each other.

File-based routes, safe defaults and signed service-to-service calls, built in. Nothing to assemble, nothing to build, no magic to unlearn.

npm install -g white-js@latest

Then create a site: white install example:site my-site

Get started Read the docs

Express 5the engine you know
0build steps
10runtime dependencies
Node 20.12+ESM, no transpiler
ISClicense

Why White.js

Everything a site needs, and nothing it does not.

01

Routes are files

server/routes/client/about.js is /about. [id], [...path], folder middleware and export const GET are built in, and the priority is deterministic.

02

Safe by default

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.

03

Services that talk

HMAC-signed calls between servers with retries, a circuit breaker, events, discovery and readiness. Switch it on with one mesh setting.

04

A lifecycle you can trust

A failed start-up rolls back what it opened. Shutdown drains requests, runs your onClose handlers and exits cleanly. /health and /ready exist from the start.

05

Great in the terminal

Live reload in white run dev, generators, white routes, a read-only white doctor, and an installer with live progress.

06

Typed, without a build

Declarations for white-js and white-js/test give plain JavaScript completion and checking. defineConfig, defineRoute, definePlugin.

Small surface

Read the whole framework in one sitting.

server/routes/api/items.js
// GET /api/items and 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)),
];
server/routes/client/blog/[slug].js
// GET /blog/:slug  ->  app/views/post.eta
export default (router, ctx) => {
  router.get('/', async (req, res) => {
    const post = await ctx.cache.wrap(`post:${req.params.slug}`, () => db.post(req.params.slug), '5m');
    res.render('post', { post, title: post.title });
  });
};
server/routes/api/admin/_middleware.js
// runs before every route in this folder and below it
import { ForbiddenError } from 'white-js';

export default (router, ctx) => {
  router.use((req, res, next) =>
    req.session?.admin ? next() : next(new ForbiddenError()));
};
white.config.js
import { defineConfig } from 'white-js';

export default defineConfig({
  trustProxy: 1,
  security: {
    cors: { origin: ['https://app.example.com'], credentials: true },
    rateLimit: { windowMs: 60_000, limit: 300 },
  },
  plugins: ['white-plugin-vercel'],
});

Services

One system, many servers. Every call signed.

A site and its API, several back-end services, or separate sites that share data. White.js signs each request, retries what is safe to retry, opens a circuit when a peer is down and carries one request id through every log.

  • HMAC-SHA256 over method, path, body, time, a one-time nonce, caller and receiver
  • Retries with backoff and jitter; circuit breaker after five failures
  • Events between services; /ready fails while a required peer is down
  • white mesh status checks every link from the command line

Read about services

web billing signed request JSON answer
web/white.config.js
// web/white.config.js
export default {
  mesh: {
    name: 'web',
    peers: {
      billing: {
        url: process.env.BILLING_URL,
        secret: process.env.BILLING_SECRET,
        required: true,   // /ready fails while billing is down
      },
    },
  },
};

// a route in web: signed, retried, traced by request id
const billing = ctx.mesh.peer('billing');
const invoices = await billing.json('GET', '/api/internal/invoices');

Command line

One binary for the whole loop.

white run dev

Start with restart on changes and live reload in the browser.

white make route "blog/[slug]"

Create a route and its view. Existing files are never overwritten.

white routes

List every method, URL and the file it comes from.

white doctor

Read-only diagnosis of config, routes, plugins and protocols.

white plugin add <name>

Install a plugin and enable it in white.config.js.

white migrate meta@3.0

Move to a new protocol generation: backed up, verified, reversible.

Deploy

From white run to Vercel in two commands.

The Vercel plugin builds a Build Output API bundle: static files on the CDN, your app as one function. No api/ folder to write, no config to copy.

Deploy to Vercel

terminal
# once per project
white plugin add vercel

# build and deploy a preview
npx white-vercel deploy

# or straight to production
npx white-vercel deploy --prod

Start in a minute.

Install the CLI once, then create as many sites as you like.

npm install -g white-js@latest

Read the guide