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
| Export | Description |
|---|---|
ExpressAdapter | HTTP server adapter using Express |
SQSAdapter | SQS emulator adapter |
LogsAdapter | Logging adapter |
ExpressHttpServerAdapter | Full HTTP server implementation |
Core Services
| Export | Description |
|---|---|
ModuleDiscovery | Module and handler discovery service |
ConfigManager | Configuration loading and validation |
SqsEmulator | SQS message queue emulator |
EnvironmentLoader | Environment variable loading |
Terminal Services
| Export | Description |
|---|---|
ConsoleTerminal | Console-based terminal output |
FileTerminal | File-based terminal output |
TerminalFormatter | Terminal output formatting |
StartupDisplayService | Startup message display |
CLI
| Export | Description |
|---|---|
StandaloneCliService | Standalone CLI runner |
ICommand | Command interface |
Types
All configuration types are exported from @serverless-monolith/core:
import type {
MonolithConfig,
MonolithServerOptions,
ModuleDiscoveryOptions,
LoggingOptions,
// ... and more
} from '@serverless-monolith/core';