veryfront/server

Import

TypeScript
import {  createHandler,  createProductionShutdownCoordinator,  createVeryfrontServer,  gracefullyShutdownProductionServer,  isHostedEnvironmentName,  isHostedHttpIsolationEnabled,} from "veryfront/server";

Examples

Composable service server

TypeScript
import { createVeryfrontServer } from "veryfront/server"; const server = createVeryfrontServer({  modules: [{    name: "agent",    handle: (request) => new Response(`Handled ${request.url}`),  }],}); await server.fetch(new Request("https://example.com/health"));

Exports

Components

NameDescriptionSource
HOSTED_ENVIRONMENT_NAMESEnvironment labels that {slug}.{environment}.veryfront.com actually routes.source
HOSTED_HTTP_ISOLATION_ENVHost flag that enables isolated hosted HTTP execution. Default off. Node.js 22 or newer only.source
ReloadNotifierRender reload notifier.source

Functions

NameDescriptionSource
createHandlerCreate a Veryfront request handler for development or production.source
createProductionShutdownCoordinatorCoordinates competing process shutdown triggers through one drain and exit.source
createVeryfrontServerCreate veryfront server.source
gracefullyShutdownProductionServerEnter lame-duck mode, mark readiness false, drain tracked requests and SSE response bodies, and stop a production server process.source
isHostedEnvironmentNameWhether {slug}.{name}.veryfront.com is a host the platform can route.source
isHostedHttpIsolationEnabledRead the hosted HTTP isolation flag from the host environment, excluding project env files. Unset, 0, false, no and off are off; 1, true, yes and on are on. Any other value throws, so a misspelled flag never silently leaves isolation off.source
parseProjectDomainExtract project slug and branch from domain/host headersource
parseShutdownCleanupTimeoutMsParse the configured post-drain cleanup timeout or return the production default.source
parseShutdownDrainTimeoutMsParse the configured request-drain timeout or return the production default.source
runProductionProcessOwnerOwn a production server from startup through one process exit.source
startDevServerStarts dev server.source
startNodeVeryfrontServerStarts node veryfront server.source
startProductionServerStarts production server.source
startServerStart a Veryfront server in development or production mode.source
startVeryfrontServerStarts veryfront server.source
toNodeHandlerConvert a Web API request handler into a Node.js HTTP listener.source

Classes

NameDescriptionSource
DevServerImplement dev server.source
RouteDiscoverysource

Types

NameDescriptionSource
BuildOptionsBuild System Type Definitions Consolidated from cli/commands/build/types.ts and server/build-types.tssource
BuildStatsPublic API contract for build stats.source
CreateVeryfrontServerOptionsOptions accepted by create veryfront server.source
DevServerHandlerPublic handler returned by a handler-only dev server.source
DevServerOptionsOptions accepted by dev server.source
DiscoveryOptionsConfiguration for AI primitives discovery during server startupsource
FileWatcherMetricsPublic API contract for file watcher metrics.source
GracefulProductionShutdownOptionsInputs required to drain and stop a production server process.source
HostedEnvironmentNamesource
MemoryRecycleEventProcess RSS sample and policy values when recycling is requested.source
NodeVeryfrontServiceServerPublic API contract for node veryfront service server.source
OwnedProductionServersource
ProductionProcessOwnerOptionssource
ProductionShutdownCoordinatorsource
ProductionShutdownCoordinatorOptionsCallbacks and finalization deadline for one coordinated process shutdown.source
ProductionShutdownReasonsource
RouteDirectoryPublic API contract for route directory.source
ServerHandlePublic API contract for server handle.source
StartDevModeOptionsOptions accepted by start dev mode.source
StartNodeVeryfrontServerOptionsOptions accepted by start node veryfront server.source
StartProductionModeOptionsOptions accepted by start production mode.source
StartProductionServerOptionsOptions accepted by start production server.source
StartServerOptionsServer options. Defaults to development mode with HMR. Set mode: "production" for a production server.source
StartVeryfrontServerOptionsOptions accepted by start veryfront server.source
VeryfrontHandlerWeb API request handler with WebSocket upgrade and HMR helpers.source
VeryfrontServerRunning server instance with lifecycle controls.source
VeryfrontServiceServerPublic API contract for veryfront service server.source
VeryfrontServiceServerFetchPublic API contract for veryfront service server fetch.source
VeryfrontServiceServerLoggerPublic API contract for veryfront service server logger.source
VeryfrontServiceServerModulePublic API contract for veryfront service server module.source
VeryfrontServiceServerModuleResponseResponse payload for veryfront service server module.source
VeryfrontServiceServerRuntimePublic API contract for veryfront service server runtime.source
VeryfrontServiceServerRuntimeKindPublic API contract for veryfront service server runtime kind.source

Constants

NameDescriptionSource
defaultDistributedCacheInitializersDefault wiring of distributed-cache initializers, assembled at the server composition root.source

Deep imports

These import paths group focused functionality under this module. Each is a separate barrel; import only what you need.

veryfront/server/http-host

TypeScript
import {  createHostedHttpComposition,  createRefreshingSourceRecordLookup,  detectHostedHttpRuntime,} from "veryfront/server/http-host";

Components

NameDescriptionSource
HOSTED_HTTP_ISOLATION_ENVHost flag that enables isolated hosted HTTP execution. Default off. Node.js 22 or newer only.source

Functions

NameDescriptionSource
createHostedHttpCompositionCompose the hosted HTTP allocator client, TLS transport, broker, resolver and ingress from host configuration only. Node.js 22 or newer only: on any other runtime it refuses to start rather than serve without isolation. Refuses to start while the shared host-execution override is set. The broker token file is read on every allocator call so rotation applies. The source records file is read at startup and again at most once a minute, so a newly published release is refused for up to one minute and a broken file refuses every release.source
createRefreshingSourceRecordLookupServe tenant-source records from a host file that is read again at most once per refresh interval. Until the first lookup after the interval, releases published since the last read are refused. A failed read or parse refuses every lookup until a later read succeeds; stale records are never served after a failed read.source
detectHostedHttpRuntimeThe allocator client and the TLS pre-shared-key transport need Node.js 22 or newer. Deno, including the compiled Deno binary, and Bun are unsupported.source
isHostedHttpIsolationEnabledRead the hosted HTTP isolation flag from the host environment, excluding project env files. Unset, 0, false, no and off are off; 1, true, yes and on are on. Any other value throws, so a misspelled flag never silently leaves isolation off.source
readHostedHttpCompositionConfigRead hosted HTTP settings from the host environment, excluding project env files. Returns undefined when the flag is unset or off. An unrecognized flag value or an incomplete configuration is a startup error, never a silent fallback.source
readHostFilePrefixRead at most maxBytes + 1 bytes of a host file, so an oversized file is detected without loading it whole. The read buffer is wiped before the handle closes, and a failed or stalled close wipes the returned copy too, so no exit leaves the bytes behind.source
settleWithinSettle with work, or reject when signal aborts or timeoutMs passes. On rejection work is detached, so a read that never settles cannot hold its caller.source

Types

NameDescriptionSource
HostedHttpCompositionHosted HTTP ingress options and the owner of their executor broker.source
HostedHttpCompositionConfigHost-owned settings, read once from the host process environment.source
HostedHttpRuntimeSupportWhether this process can run the hosted HTTP host, and how to name it in errors.source

veryfront/server/http-resolver

TypeScript
import {  buildHostedHttpGenerationBindingInput,  createHostedHttpResolver,  createHostedHttpSourceRecordLookup,} from "veryfront/server/http-resolver";

Functions

NameDescriptionSource
buildHostedHttpGenerationBindingInputDerive the authorized parts of a render generation binding from one resolved input. The digest-pinned tenant-source image is the source snapshot identity. Framework, runtime, dependency, artifact and execution-policy identities come from the image receipt and operator policy, which this resolver does not observe.source
createHostedHttpResolverBuild the hosted HTTP resolve() callback. Each call authorizes the project, its slug, the named environment and its active release with the request's source token, binds the published tenant-source image to that exact project release, and then reads the authorized project environment. Any mismatch rejects; the ingress turns rejection into a non-cacheable unavailable response with no host execution.source
createHostedHttpSourceRecordLookupServe publication records produced by the tenant-source lookup from a host-owned snapshot. Records are indexed by exact project and release; differing records for one release are refused. The resolver binds image to the authorized project release, and the executor session refuses an allocation whose running image differs from that digest.source

Types

NameDescriptionSource
HostedHttpGenerationBindingInputImmutable generation identity inputs known after authorization, for generation-bound executors.source
HostedHttpResolverApiVeryfront API reads, each authenticated with the request's source token.source
HostedHttpResolverOptionssource