Skip to content

Type Definitions

The types module contains the authoritative TypeScript definitions, interfaces, and type contracts used across the entire gateway codebase. It defines request contexts, route specifications, plugin signatures, identity models, and server configuration layouts. These types provide compile-time guarantees and full autocomplete ergonomics for gateway consumers.

SymbolKindSignaturePurpose
ConfigFileinterfaceinterface ConfigFile extends GatewayConfigConfiguration file format
ValidationResultinterfaceinterface ValidationResultConfiguration validation result
ValidationErrorinterfaceinterface ValidationErrorConfiguration validation error
ConfigLoaderOptionsinterfaceinterface ConfigLoaderOptionsConfiguration loader options
ConfigChangeEventinterfaceinterface ConfigChangeEventConfiguration change event
ConfigWatcherCallbacktypetype ConfigWatcherCallback = (event: ConfigChangeEvent) => void | Promise<void>Configuration watcher callback
{ GatewayConfig, ServerConfig, PerformanceConfig, UpstreamTarget, Route, PluginConfig }typetype { GatewayConfig, ServerConfig, PerformanceConfig, UpstreamTarget, Route, PluginConfigType export for { GatewayConfig, ServerConfig, PerformanceConfig, UpstreamTarget, Route, PluginConfig }.
HttpMethodtypetype HttpMethod = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS'HTTP methods supported by the gateway
RequestContextinterfaceinterface RequestContextPooled request context object This object is reused across requests to minimize allocations Enhanced with route matching
RouteMatchinterfaceinterface RouteMatchRoute match result
RouteHandlertypetype RouteHandler = (ctx: RequestContext) => Promise<void> | voidRoute handler function signature Handlers should be monomorphic for V8 optimization
Routeinterfaceinterface RouteRoute definition
UpstreamTargetinterfaceinterface UpstreamTargetUpstream service target definition
HealthCheckConfiginterfaceinterface HealthCheckConfigHealth check configuration
LoadBalancerStrategytypetype LoadBalancerStrategy =Load balancing strategies
CircuitBreakerStateenumenum CircuitBreakerStateCircuit breaker states
CircuitBreakerConfiginterfaceinterface CircuitBreakerConfigCircuit breaker configuration
WorkerMessageTypeenumenum WorkerMessageTypeWorker message types for master-worker communication
WorkerMessageinterfaceinterface WorkerMessageWorker message protocol
MetricsSnapshotinterfaceinterface MetricsSnapshotPerformance metrics snapshot Designed for lock-free atomic operations
ServerConfiginterfaceinterface ServerConfigServer configuration
GatewayConfiginterfaceinterface GatewayConfigGateway configuration (root)
PluginConfiginterfaceinterface PluginConfigPlugin configuration
PerformanceConfiginterfaceinterface PerformanceConfigPerformance tuning configuration
BodyParserConfiginterfaceinterface BodyParserConfigBody parser configuration
ConnectionPoolConfiginterfaceinterface ConnectionPoolConfigConnection pool configuration
HealthCheckTypetypetype HealthCheckType = 'active' | 'passive' | 'hybrid'Health check type
HealthStatusenumenum HealthStatusHealth status
LoadBalancerConfiginterfaceinterface LoadBalancerConfigLoad balancer configuration
MonitoringConfiginterfaceinterface MonitoringConfigMonitoring configuration
ApiKeysConfiginterfaceinterface ApiKeysConfigInterface export for ApiKeysConfig.
UpstreamCredentialsConfiginterfaceinterface UpstreamCredentialsConfigInterface export for UpstreamCredentialsConfig.
WithIdentityinterfaceinterface WithIdentity extends GatewayConfigInterface export for WithIdentity.
PluginHookenumenum PluginHookPlugin lifecycle hooks
Plugininterfaceinterface PluginPlugin interface All plugins must implement this interface
PluginMetadatainterfaceinterface PluginMetadataPlugin metadata
PluginExecutionContextinterfaceinterface PluginExecutionContextPlugin execution context Used internally by plugin executor
PluginStatsinterfaceinterface PluginStatsPlugin execution statistics
PluginLoaderConfiginterfaceinterface PluginLoaderConfigPlugin loader configuration

The primary schema contract describing server ports, upstream pools, routes, and plugins.

The mutable execution context passed through router, policies, and plugins.

The lifecycle contract defining onRequest, onResponse, and onError handler hooks.

  • src/types/config.ts
  • src/types/core.ts
  • src/types/identity.ts
  • src/types/plugin.ts