Skip to content

Decorators & public API

Hand-written overview; generated signatures live under TypeDoc API (from packages/bananajs/src/index.ts).

Routing

ExportRole
ControllerClass — base segment (no leading /; joined by the framework)
Get, Post, Put, Patch, DeleteMethod — path segment + optional route middlewares

Request validation

ExportRole
Body, Params, Query, HeadersValidation schemas (z.ZodType) per slice

Responses (success)

ExportRole
BaseControllerok / error helpers
SuccessResponse, PaginatedResponse, PaginationQuerySchemaTyped JSON / list query schema

Errors

ExportRole
ApiError + subclassesBadRequestError, UnauthorisedError, PaymentRequiredError, ForbiddenError, NotFoundError, ConflictError, TooManyRequestsError, InternalError, BadGatewayError, ServiceUnavailableError, GatewayTimeoutError
ApiError.handleMaps error type to HTTP response

Middleware

ExportRole
ErrorMiddleware, createErrorMiddlewareCentral error handler
requestContextMiddlewareAsyncLocalStorage context
createHealthEndpoint, createMetricsMiddleware, createMetricsEndpoint, createDevToolsEndpointOperational endpoints (see options)

Auth & security

ExportRole
Auth, Roles, PublicAuth decorators — see Authentication integration ( AuthGuard, @Public, @Roles, OpenAPI )
RateLimit, ThrottleRate limiting
Sanitize, CanInput sanitization, ABAC
UploadMultipart uploads

Tenancy & cache

ExportRole
Tenant, getTenantId, runWithTenant, createTenantMiddlewareMulti-tenancy
Cache, CacheEvict, CacheManagerMethod-level caching

OpenAPI

ExportRole
ApiTags, ApiOperation, ApiBody, ApiResponseDocSwagger / OpenAPI metadata

Full usage, inferred-schema details, and screenshots: OpenAPI / Swagger reference.

DI & app wiring

ExportRole
Injectable, isInjectabletsyringe / injectable metadata for DI
BananaApp, BananaRouterApplication entry, incremental Express adoption
BananaConfigTyped environment configuration (schema-based)

Plugin & adapter types

ExportRole
BananaPlugin, AppContextPlugin contract
FrameworkAdapter, RouteDefinitionFuture multi-framework support

Testing

ModuleRole
@banana-universe/bananajs/testingBananaTestApp and helpers (subpath export)

Implementation note

Decorators use explicit Reflect.defineMetadata — consistent with emitDecoratorMetadata: false in tsconfig.base.json.

Released under the MIT License.