Production-ready clustered HTTP server with automatic scaling and crash recovery. Features:

  • Horizontal scaling across all CPU cores
  • Automatic worker restart on crashes
  • Zero external dependencies (no PM2 needed)
  • Pure event-driven architecture (zero timeouts)
  • Helper getters for process identification (isMainProcess, isWorkerProcess)
  • Memory leak prevention with proper event cleanup
  • Instant crash recovery without coordination delays

Hierarchy (view full)

Constructors

Accessors

  • get isMainProcess(): boolean
  • Check if current process is the cluster primary (main process).

    Returns boolean

    True if this is the primary process

  • get isSSL(): boolean
  • Check if SSL/HTTPS mode is enabled.

    Returns boolean

    True if server is running in HTTPS mode

  • get server(): Server<typeof IncomingMessage, typeof ServerResponse>
  • Get underlying HTTP server instance.

    Returns Server<typeof IncomingMessage, typeof ServerResponse>

    Node.js HTTP server

Methods

  • Protected

    Handle request processing errors.

    Parameters

    • err: Error

      Error that occurred

    • req: IncomingMessage

      Original request

    • res: ServerResponse<IncomingMessage>

      Response object

    Returns void

  • Start clustered server with automatic worker management.

    Parameters

    • port: number

      Port to listen on

    • Optionalhost: string = "0.0.0.0"

      Host to bind to

    Returns Promise<void>