Import
TypeScript
1import {2 createHandler,3 createProductionShutdownCoordinator,4 createVeryfrontServer,5 gracefullyShutdownProductionServer,6 isHostedEnvironmentName,7 isHostedHttpIsolationEnabled,8} from "veryfront/server";Examples
Composable service server
TypeScript
1import { createVeryfrontServer } from "veryfront/server";2 3const server = createVeryfrontServer({4 modules: [{5 name: "agent",6 handle: (request) => new Response(`Handled ${request.url}`),7 }],8});9 10await server.fetch(new Request("https://example.com/health"));Exports
Components
| Name | Description | Source |
|---|---|---|
HOSTED_ENVIRONMENT_NAMES | Environment labels that {slug}.{environment}.veryfront.com actually routes. | source |
HOSTED_HTTP_ISOLATION_ENV | Host flag that enables isolated hosted HTTP execution. Default off. Node.js 22 or newer only. | source |
ReloadNotifier | Render reload notifier. | source |
Functions
| Name | Description | Source |
|---|---|---|
createHandler | Create a Veryfront request handler for development or production. | source |
createProductionShutdownCoordinator | Coordinates competing process shutdown triggers through one drain and exit. | source |
createVeryfrontServer | Create veryfront server. | source |
gracefullyShutdownProductionServer | Enter lame-duck mode, mark readiness false, drain tracked requests and SSE response bodies, and stop a production server process. | source |
isHostedEnvironmentName | Whether {slug}.{name}.veryfront.com is a host the platform can route. | source |
isHostedHttpIsolationEnabled | Read 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 |
parseProjectDomain | Extract project slug and branch from domain/host header | source |
parseShutdownCleanupTimeoutMs | Parse the configured post-drain cleanup timeout or return the production default. | source |
parseShutdownDrainTimeoutMs | Parse the configured request-drain timeout or return the production default. | source |
runProductionProcessOwner | Own a production server from startup through one process exit. | source |
startDevServer | Starts dev server. | source |
startNodeVeryfrontServer | Starts node veryfront server. | source |
startProductionServer | Starts production server. | source |
startServer | Start a Veryfront server in development or production mode. | source |
startVeryfrontServer | Starts veryfront server. | source |
toNodeHandler | Convert a Web API request handler into a Node.js HTTP listener. | source |
Classes
Types
| Name | Description | Source |
|---|---|---|
BuildOptions | Build System Type Definitions Consolidated from cli/commands/build/types.ts and server/build-types.ts | source |
BuildStats | Public API contract for build stats. | source |
CreateVeryfrontServerOptions | Options accepted by create veryfront server. | source |
DevServerHandler | Public handler returned by a handler-only dev server. | source |
DevServerOptions | Options accepted by dev server. | source |
DiscoveryOptions | Configuration for AI primitives discovery during server startup | source |
FileWatcherMetrics | Public API contract for file watcher metrics. | source |
GracefulProductionShutdownOptions | Inputs required to drain and stop a production server process. | source |
HostedEnvironmentName | source | |
MemoryRecycleEvent | Process RSS sample and policy values when recycling is requested. | source |
NodeVeryfrontServiceServer | Public API contract for node veryfront service server. | source |
OwnedProductionServer | source | |
ProductionProcessOwnerOptions | source | |
ProductionShutdownCoordinator | source | |
ProductionShutdownCoordinatorOptions | Callbacks and finalization deadline for one coordinated process shutdown. | source |
ProductionShutdownReason | source | |
RouteDirectory | Public API contract for route directory. | source |
ServerHandle | Public API contract for server handle. | source |
StartDevModeOptions | Options accepted by start dev mode. | source |
StartNodeVeryfrontServerOptions | Options accepted by start node veryfront server. | source |
StartProductionModeOptions | Options accepted by start production mode. | source |
StartProductionServerOptions | Options accepted by start production server. | source |
StartServerOptions | Server options. Defaults to development mode with HMR. Set mode: "production" for a production server. | source |
StartVeryfrontServerOptions | Options accepted by start veryfront server. | source |
VeryfrontHandler | Web API request handler with WebSocket upgrade and HMR helpers. | source |
VeryfrontServer | Running server instance with lifecycle controls. | source |
VeryfrontServiceServer | Public API contract for veryfront service server. | source |
VeryfrontServiceServerFetch | Public API contract for veryfront service server fetch. | source |
VeryfrontServiceServerLogger | Public API contract for veryfront service server logger. | source |
VeryfrontServiceServerModule | Public API contract for veryfront service server module. | source |
VeryfrontServiceServerModuleResponse | Response payload for veryfront service server module. | source |
VeryfrontServiceServerRuntime | Public API contract for veryfront service server runtime. | source |
VeryfrontServiceServerRuntimeKind | Public API contract for veryfront service server runtime kind. | source |
Constants
| Name | Description | Source |
|---|---|---|
defaultDistributedCacheInitializers | Default 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
1import {2 createHostedHttpComposition,3 createRefreshingSourceRecordLookup,4 detectHostedHttpRuntime,5} from "veryfront/server/http-host";Components
| Name | Description | Source |
|---|---|---|
HOSTED_HTTP_ISOLATION_ENV | Host flag that enables isolated hosted HTTP execution. Default off. Node.js 22 or newer only. | source |
Functions
| Name | Description | Source |
|---|---|---|
createHostedHttpComposition | Compose 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 |
createRefreshingSourceRecordLookup | Serve 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 |
detectHostedHttpRuntime | The 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 |
isHostedHttpIsolationEnabled | Read 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 |
readHostedHttpCompositionConfig | Read 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 |
readHostFilePrefix | Read 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 |
settleWithin | Settle 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
| Name | Description | Source |
|---|---|---|
HostedHttpComposition | Hosted HTTP ingress options and the owner of their executor broker. | source |
HostedHttpCompositionConfig | Host-owned settings, read once from the host process environment. | source |
HostedHttpRuntimeSupport | Whether this process can run the hosted HTTP host, and how to name it in errors. | source |
veryfront/server/http-resolver
TypeScript
1import {2 buildHostedHttpGenerationBindingInput,3 createHostedHttpResolver,4 createHostedHttpSourceRecordLookup,5} from "veryfront/server/http-resolver";Functions
| Name | Description | Source |
|---|---|---|
buildHostedHttpGenerationBindingInput | Derive 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 |
createHostedHttpResolver | Build 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 |
createHostedHttpSourceRecordLookup | Serve 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 |