ObjectStackObjectStack

Http Server

Http Server protocol schemas

HTTP Server Protocol

Defines the runtime HTTP server configuration and capabilities.

Provides abstractions for HTTP server implementations (Express, Fastify, Hono, etc.)

Architecture alignment:

  • Kubernetes: Service and Ingress resources

  • AWS: API Gateway configuration

  • Spring Boot: Application properties

Source: packages/spec/src/system/http-server.zod.ts

TypeScript Usage

import { HttpServerConfig, MiddlewareConfig, MiddlewareType, RouteHandlerMetadata, ServerCapabilities, ServerEvent, ServerEventType, ServerStatus } from '@objectstack/spec/system';
import type { HttpServerConfig, MiddlewareConfig, MiddlewareType, RouteHandlerMetadata, ServerCapabilities, ServerEvent, ServerEventType, ServerStatus } from '@objectstack/spec/system';

// Validate data
const result = HttpServerConfig.parse(data);

HttpServerConfig

Properties

PropertyTypeRequiredDescription
portintegerPort number to listen on
hoststringHost address to bind to
corsObjectoptionalCORS configuration
requestTimeoutintegerRequest timeout in milliseconds
bodyLimitstringMaximum request body size
compressionbooleanEnable response compression
securityObjectoptionalSecurity configuration
staticObject[]optionalStatic file serving configuration
trustProxybooleanTrust X-Forwarded-* headers

MiddlewareConfig

Properties

PropertyTypeRequiredDescription
namestringMiddleware name (snake_case)
typeEnum<'authentication' | 'authorization' | 'logging' | 'validation' | 'transformation' | 'error' | 'custom'>Middleware type
enabledbooleanWhether middleware is enabled
orderintegerExecution order priority
configRecord<string, any>optionalMiddleware configuration object
pathsObjectoptionalPath filtering

MiddlewareType

Allowed Values

  • authentication
  • authorization
  • logging
  • validation
  • transformation
  • error
  • custom

RouteHandlerMetadata

Properties

PropertyTypeRequiredDescription
methodEnum<'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS'>HTTP method
pathstringURL path pattern
handlerstringHandler identifier or name
metadataObjectoptional
securityObjectoptional

ServerCapabilities

Properties

PropertyTypeRequiredDescription
httpVersionsEnum<'1.0' | '1.1' | '2.0' | '3.0'>[]Supported HTTP versions
websocketbooleanWebSocket support
ssebooleanServer-Sent Events support
serverPushbooleanHTTP/2 Server Push support
streamingbooleanResponse streaming support
middlewarebooleanMiddleware chain support
routeParamsbooleanURL parameter support (/users/:id)
compressionbooleanBuilt-in compression support

ServerEvent

Properties

PropertyTypeRequiredDescription
typeEnum<'starting' | 'started' | 'stopping' | 'stopped' | 'request' | 'response' | 'error'>Event type
timestampstringEvent timestamp (ISO 8601)
dataRecord<string, any>optionalEvent-specific data

ServerEventType

Allowed Values

  • starting
  • started
  • stopping
  • stopped
  • request
  • response
  • error

ServerStatus

Properties

PropertyTypeRequiredDescription
stateEnum<'stopped' | 'starting' | 'running' | 'stopping' | 'error'>Current server state
uptimeintegeroptionalServer uptime in milliseconds
serverObjectoptional
connectionsObjectoptional
requestsObjectoptional

On this page