Deployment

One Web-Fetch handler powers Node, static export, Vercel, and Cloudflare. Pick an adapter in what.config.js; the ISR engine and actions come along for free.

All adapters are thin shells over one framework-agnostic core: (request) => Response. Match a route, intercept /__what_action and /__what_revalidate, consult the ISR engine, render, and emit cache headers. Choosing a target is a config line, not a rewrite.

Adapter matrix

AdapterBest forISR mechanismPoll scheduler
nodeLong-running server, full controlorigin store (memory/fs/redis)✓ in-process
staticPure SSG to any static hostbuild-time pre-render— (use external cron → webhook)
vercelServerless + edge ISRprerender + expiration— (Vercel Cron → webhook)
cloudflareWorkers at the edgeCache API / KV + waitUntil— (Cron Trigger → webhook)

Serverless & polling

Serverless platforms have no always-on process, so the in-process poll scheduler doesn't run there. Use the platform's cron to hit POST /__what_revalidate on a schedule — same effect, platform-native.

Node

import { createServer } from 'what-framework/server';
import { createCacheEngine, createMemoryStore } from 'what-isr';

const server = createServer({
  routes,
  cache: createCacheEngine({ store: createMemoryStore() }),
});
server.listen(3000);

Run it with what start (or node server.js). SIGTERM stops the scheduler cleanly.

Static export

Render every static/hybrid route (expanding getStaticPaths) to index.html + a __what_data.json for client navigation:

import { exportStatic } from 'what-framework/server';
await exportStatic({ routes, outDir: 'dist' });
// or: what build --static

Vercel

import { buildVercelOutput } from 'what-framework/server';
await buildVercelOutput({ routes }); // emits .vercel/output (Build Output API v3)

Static routes become prerenders with an expiration equal to revalidate; dynamic routes become a render function.

Cloudflare

import { createCloudflareHandler } from 'what-framework/server';
export default { fetch: createCloudflareHandler({ routes, cache }) };

ISR uses the Cache API (or KV) and ctx.waitUntil for background SWR.

Environment

  • WHAT_REVALIDATE_SECRET — required to authorize the revalidation webhook.
  • PORT — Node server port (default 3000).

See the blog and shop examples for complete, tested setups.