BananaAppOptions
BananaApp is created with one object: either controllers (via defineBananaControllers) or modules (from createModule) plus BananaAppOptions fields.
typescript
import { BananaApp, defineBananaControllers } from '@banana-universe/bananajs'
new BananaApp({
controllers: defineBananaControllers(UserController),
// ...BananaAppOptions
})Use BananaApp.create({ ... }) when you need async plugin registration (plugins array).
Declarative bootstrap (optional)
defineBananaControllers(...controllers)— returns the controller list for thecontrollerspropertydefineBananaAppOptions({ modules: [...], plugins, ... })— preferred for feature slices: each module suppliescontroller,providers, andid; do not list the controller class again insideprovidersdefineBananaAppOptions({ controllers: defineBananaControllers(...), providers, ... })— mergesproviders(tsyringe-style registrations: classes and{ token, useClass | useFactory | useValue }) into a container and returns aBananaApp.create-ready inputcreateBananaProviderContainer(providers)— isolated child container + registrations in one call (seebananaBootstrap.ts)
See packages/bananajs/src/lib/DI/bananaBootstrap.ts.
BananaAppOptions fields (summary)
The interface is defined in packages/bananajs/src/lib/Core/App.ts. Below is a conceptual grouping; see TypeDoc for exact optional/required fields.
Core
middlewares—RequestHandler[]applied after framework defaults and before controller routessecurity—{ helmet?: boolean \| HelmetOptions; cors?: CorsOptions \| false }— helmet and CORS are applied by default unless disabledrequestId— boolean, defaulttrue; enablesX-Request-IDhandlinglogger—Loggerinstance orfalseto disable built-in loggingcontainer— tsyringeDependencyContainer(optional; created when usingproviders/modules)apiPrefix— optional segment prepended to all controller base paths (e.g.v1for/v1/...)testOverrides— extra registrations merged onto the root container after modules (for tests / fakes)gracefulShutdown— register signal handlers for clean process exit
Auth & docs
auth—{ guard: AuthGuard }for@Auth/@Roles/@Publicswagger— OpenAPI JSON + UI (enabled,path,title,version,description, …)
Operational
rateLimit— global rate limit config orfalsehealth—{ enabled, path?, checks? }forGET /healthmetrics— Prometheus metrics endpoint (prom-clientpeer)devTools— exposeGET /_banana/routesin non-production
Plugins & cache
plugins—BananaPlugin[]; register in order; async work inregister()requiresBananaApp.createcache—{ store?: 'memory' \| CacheStore }for@Cache/@CacheEvict
Security, tenancy, and performance
abac—{ guard: AbacGuard }for@Cantenant— tenant resolution options (seeTenantOptionsin TypeDoc)lazyControllers— defer controller instantiation until first request
RouteInfo
BananaApp.prototype.getRouteTable(): RouteInfo[] returns { method, path, controller, handler } for tooling.