Everything an SPFN backend runs on: the HTTP server, the typed route DSL, Drizzle data access, codegen, validated env, background jobs, events, server-owned state, the ops surface, cache, and the Next.js RPC client. The only required package — everything else is opt-in. It is the shape an AI coding agent fills in — the same four files per feature, every time.
HTTP server entry point — config builder and lifecycle.
Type-safe route DSL and router composition.
Type-safe PostgreSQL data access on Drizzle ORM.
Type-safe Next.js RPC client and proxy.
Route-map generation and custom generators.
Schema-validated environment variable management.
The kernel's own validated env config.
Serializable HTTP/DB error classes, cross-boundary.
Error handling, request logging, proxy-guard, rate limiting.
Pub/sub events over SSE and WebSocket, with subscribe grants.
pg-boss background jobs, typed payloads.
Singleton Valkey/Redis connection, graceful-degrading.
Zero-dependency structured logger, child loggers.
Safe outbound requests — SSRF-hardened safeFetch.
A server-owned state declared once, kept in sync in the browser.
Route contracts and the build gate for separately shipped clients.
The operations surface spfn ops discovers and runs.
A command surface on any namespace, beside /_ops.
Ownership guards — load a resource, check it belongs to the caller.
Reads spfn.config.js — the app's ports and host, in one place.