Skip to content
GuidesDocs 1.3.x

Server

createServer() is the composition boundary for a Connectum process. It registers service routes, protocols and interceptors, selects the transport, and owns startup and shutdown. This page is the mental model; configuration values and lifecycle details live in their focused guides and generated API.

Minimal server

typescript
import { createServer } from '@connectum/core';
import { Healthcheck } from '@connectum/healthcheck';
import { createDefaultInterceptors } from '@connectum/interceptors';
import { Reflection } from '@connectum/reflection';
import routes from '#gen/routes.js';

const server = createServer({
  services: [routes],
  port: 5000,
  protocols: [Healthcheck({ httpEnabled: true }), Reflection()],
  interceptors: createDefaultInterceptors(),
  shutdown: { autoShutdown: true, timeout: 30_000 },
});

await server.start();

Choose the owning guide

NeedCanonical destination
Understand states, events, and shutdownSignalLifecycle
Configure listen address, TLS, environment, or schema extensionConfiguration
Drain requests, coordinate hooks, and fit a deployment deadlineGraceful shutdown
Select HTTP/1.1, h2c, or TLS/ALPN behaviorTransport matrix
Find an exact server option or methodCreateServerOptions and core API

The stable state progression is created → starting → running → stopping → stopped. React to lifecycle events for application coordination; pass server.shutdownSignal to long-running work so cancellation follows the same shutdown boundary.

Module route

Use the @connectum/core module hub for installation, the smallest package example, related guides, source, and API entry points.