never-rest

Documentation

An opinionated architectural choice — never-rest puts Result-based railway-oriented programming at the API boundary. Whether either side uses railway style internally is up to that team; the contract assumes at least one side wants Result at the edge.

A ContractDef where handlers return Result instead of throwing. serve projects that onto HTTP. ./local runs the same contract in-process, or behind a host that already carries the operation as a string. Errors carry their cause chain across boundaries. Disclosure is graded by caller trust.

DocTopic
ConceptsRailway at the boundary, HTTP and local transports, no middleware, errors as data, trust circles
Railway patternsFull railway/neverthrow pattern catalogue + white-label tenant kitchen sink
Advanced usagedefinePolicy, mid-chain composers, host wraps
Security boundariesAdmission order, deployment-owned controls, what never-rest does not ship
API referenceEvery public export, signature, example — including ./local
ExamplesExpress, Next, SvelteKit, Hono, Workers, gateway, files-and-streams, cancellation, MCP stdio
Files and streamsJSON on the railway; multipart and SSE on the host
Errors as intelligencenextStep, origin, retryable, ctx, gateway chains
Comparisonvs ts-rest, oRPC, tRPC, and Hono RPC
Migrating0.6 → 0.7, then ts-rest, oRPC, throwing handlers
MCP adapterContract → MCP tools; policy stays on createDispatcher
Type performanceInstantiation budget and CI gate

Package: @eddy-works/never-rest · Source: project-eddy/never-rest

On this page