Skip to main content

Core API Reference

API Documentation

The full API reference is generated automatically from the source code during the build process.

When you run pnpm docs:build, TypeDoc generates detailed documentation for all exported types, interfaces, classes, and functions.

Main Exports

MonolithServer

The main class for creating and managing a Serverless Monolith server.

import { MonolithServer } from '@serverless-monolith/core';

const server = MonolithServer.create('./monolith.config.ts', {
port: 4005,
cors: true,
});

await server.start();

createMonolith

Alternative factory function for creating a MonolithServer.

import { createMonolith } from '@serverless-monolith/core';

const server = createMonolith({
discovery: {
modulesDir: 'src/modules',
},
});

Adapters

ExportDescription
ExpressAdapterHTTP server adapter using Express
SQSAdapterSQS emulator adapter
LogsAdapterLogging adapter
ExpressHttpServerAdapterFull HTTP server implementation

Core Services

ExportDescription
ModuleDiscoveryModule and handler discovery service
ConfigManagerConfiguration loading and validation
SqsEmulatorSQS message queue emulator
EnvironmentLoaderEnvironment variable loading

Terminal Services

ExportDescription
ConsoleTerminalConsole-based terminal output
FileTerminalFile-based terminal output
TerminalFormatterTerminal output formatting
StartupDisplayServiceStartup message display

CLI

ExportDescription
StandaloneCliServiceStandalone CLI runner
ICommandCommand interface

Types

All configuration types are exported from @serverless-monolith/core:

import type { 
MonolithConfig,
MonolithServerOptions,
ModuleDiscoveryOptions,
LoggingOptions,
// ... and more
} from '@serverless-monolith/core';

See Also