GatewayConfig
Defined in: src/core/types.ts:17
Top-level gateway configuration
Properties
Section titled “Properties”adapter?
Section titled “adapter?”
optionaladapter:GatewayAdapter
Defined in: src/core/types.ts:65
Runtime adapter providing store implementations and runtime-specific capabilities
(e.g. waitUntil, dispatchBinding). Created via adapter factories like
cloudflareAdapter(), memoryAdapter(), etc.
admin?
Section titled “admin?”
optionaladmin:boolean|AdminConfig
Defined in: src/core/types.ts:73
Admin introspection API. Exposes ___gateway/* routes for operational visibility.
true— enable with defaults (no auth)AdminConfigobject — full customizationfalse/undefined— disabled (default)
basePath?
Section titled “basePath?”
optionalbasePath:string
Defined in: src/core/types.ts:21
Base path prefix for all routes (e.g. “/api”)
debug?
Section titled “debug?”
optionaldebug:string|boolean
Defined in: src/core/types.ts:48
Enable internal debug logging for gateway operators.
true— log all namespacesfalse/undefined— disabled (default, zero overhead)string— comma-separated glob patterns to filter namespaces
Namespaces: stoma:gateway, stoma:pipeline, stoma:upstream,
stoma:policy:* (e.g. stoma:policy:cache, stoma:policy:jwt-auth)
Output goes to console.debug() which is captured by wrangler tail
and Cloudflare Workers Logs.
Example
Section titled “Example”createGateway({ debug: true, ... }) // everythingcreateGateway({ debug: "stoma:gateway,stoma:upstream", ... }) // core onlycreateGateway({ debug: "stoma:policy:*", ... }) // policies onlydebugHeaders?
Section titled “debugHeaders?”
optionaldebugHeaders:boolean|DebugHeadersConfig
Defined in: src/core/types.ts:97
Enable client-requested debug headers.
When enabled, clients can send an x-stoma-debug request header listing
the debug values they want returned as response headers. Policies contribute
debug data via setDebugHeader from the SDK — only requested values
are included in the response.
true— enable with defaultsDebugHeadersConfig— full customization (request header name, allowlist)false/undefined— disabled (default, zero overhead)
Example
Section titled “Example”// Client request:GET /api/usersx-stoma-debug: x-stoma-cache-key, x-stoma-cache-ttl
// Response includes:x-stoma-cache-key: GET:http://example.com/api/usersx-stoma-cache-ttl: 300defaultErrorMessage?
Section titled “defaultErrorMessage?”
optionaldefaultErrorMessage:string
Defined in: src/core/types.ts:57
Default error message for unexpected (non-GatewayError) errors. Default: "An unexpected error occurred".
defaultMethods?
Section titled “defaultMethods?”
optionaldefaultMethods:HttpMethod[]
Defined in: src/core/types.ts:55
Default HTTP methods for routes that don’t specify methods.
Default: ["GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"].
defaultPolicyPriority?
Section titled “defaultPolicyPriority?”
optionaldefaultPolicyPriority:number
Defined in: src/core/types.ts:59
Default priority for policies that don’t specify one. Default: 100.
optionalname:string
Defined in: src/core/types.ts:19
Gateway name, used in logs and metrics
onError()?
Section titled “onError()?”
optionalonError: (error,c) =>Response|Promise<Response>
Defined in: src/core/types.ts:27
Global error handler
Parameters
Section titled “Parameters”Error
unknown
Returns
Section titled “Returns”Response | Promise<Response>
policies?
Section titled “policies?”
optionalpolicies:Policy[]
Defined in: src/core/types.ts:25
Global policies applied to all routes
requestIdHeader?
Section titled “requestIdHeader?”
optionalrequestIdHeader:string
Defined in: src/core/types.ts:50
Response header name for the request ID. Default: "x-request-id".
routes
Section titled “routes”routes:
RouteConfig[]
Defined in: src/core/types.ts:23
Route definitions