Catch-all Next.js route handler.
Registered contract inputs.
Create app context from next/headers for Server Components.
Build a fully assembled request context from a framework-neutral request.
Build a fully assembled service context for schedules, outbox drains, commands, and background work.
Requires context.service to be declared in createNextServer(...).
Final app ports after provider setup.
Build a Next.js route handler for a route that cannot be a contract — webhooks, third-party auth callbacks, streaming endpoints — that still runs the whole server pipeline: hooks (rate limiting, idempotency, CORS, logging, error reporting), context creation, instrumentation, and framework error mapping.
Request parsing and validation are skipped and the request body is left
unconsumed, so the handler owns body reading — for example webhook
signature verification over the exact raw bytes. Metadata-driven hooks
read init.metadata. Raw routes are not added to the route registry;
export the returned handler from the route file that owns the path.
Register and build a single Next.js route handler imperatively.
Build a service context and run fn inside a scoped ambient correlation
frame, returning its result.
This is the script-safe counterpart to createServiceContext(...).
Requires context.service to be declared in createNextServer(...).
Stop installed providers.
Beignet server adapted for Next.js route handlers and server components.