Skip to main content
Version: Next

Interface: Server

Server-side application configuration.

See Server Config for usage details.

Properties

envValidationSchema?

optional envValidationSchema?: Reference<ZodSchema>

Zod schema used to validate user-defined server environment variables on startup. Wasp merges it with built-in validation for Wasp-defined env vars when validating process.env. Import the schema from app code with a reference import or pass an ExtImport object.

See Env Vars.


middlewareConfigFn?

optional middlewareConfigFn?: Reference<AnyFunction>

Function that customizes the global Express middleware stack. Affects all operations and APIs.

See Configuring Middleware.


setupFn?

optional setupFn?: Reference<AnyFunction>

Async function called once on server start. Wasp awaits it before the server accepts requests. Receives a context containing the Express app and underlying http.Server, so you can register custom routes, set up additional databases or WebSockets, or kick off scheduled jobs.