Skip to main content

buildApp

@fovea/server


@fovea/server / app / buildApp

Function: buildApp()

buildApp(): Promise<FastifyInstance<Server<typeof IncomingMessage, typeof ServerResponse>, IncomingMessage, ServerResponse<IncomingMessage>, FastifyBaseLogger, TypeBoxTypeProvider>>

Defined in: src/app.ts:36

Builds and configures the Fastify application instance.

This function creates a Fastify server with the following features:

  • Type-safe request/response validation using TypeBox
  • Structured logging with pino
  • Security headers via helmet
  • CORS configuration
  • Rate limiting protection
  • OpenAPI documentation with Swagger UI
  • Bull Board queue monitoring dashboard
  • Health check endpoint

Returns

Promise<FastifyInstance<Server<typeof IncomingMessage, typeof ServerResponse>, IncomingMessage, ServerResponse<IncomingMessage>, FastifyBaseLogger, TypeBoxTypeProvider>>

Configured Fastify instance ready to be started

Example

const app = await buildApp()
await app.listen({ port: 3001 })