createApp Config Reference
Docs Home | Previous: Decorator Reference | Next: Examples Index
createApp(config) builds routes, OpenAPI spec, and docs endpoints.
Required
| Field | Type | Description |
|---|---|---|
| schema | SchemaAdapter | Adapter used for validation and JSON Schema conversion |
Core Runtime
| Field | Type |
|---|---|
| controllers | class[] |
| providers | Provider[] |
| imports | ModuleClass[] |
| validateResponse | boolean |
| errorFormatter | function |
Request Pipeline Extensions
| Field | Type |
|---|---|
| guards | CanActivate class[] |
| interceptors | Interceptor class[] |
| middlewares | MiddlewareFunction[] |
| securityGuards | Record<string, CanActivateSecurity class> |
OpenAPI and Docs
| Field | Type |
|---|---|
| openapi | OpenAPIConfig |
| docs | boolean or DocsConfig |
Set docs: true to enable both Swagger UI and module viewer with defaults.
Or use docs: { swagger: boolean | SwaggerUIConfig, modules: boolean | ModuleViewerConfig } for granular control.
docs.swaggerenables Swagger UI.SwaggerUIConfigsupportspathplus serializable Swagger UI options such asconfigUrl,deepLinking,docExpansion,maxDisplayedTags,operationsSorter, andlayout.docs.modulesenables the module viewer.ModuleViewerConfigsupportspathandsvgPath.
The modules viewer registers docs routes when there are imported modules or direct
app-level controllers/providers to visualize.
View Rendering
| Field | Type |
|---|---|
| viewEngine | ViewEngineConfig |
Return Value
createApp returns:
- routes: Bun route map
- fetch: fallback handler
- spec: generated OpenAPI document
See src/types.ts for complete type definitions.