Skip to main content
Version: Next

Interface: Client

Client-side application configuration.

See Client Config for usage details.

Properties

baseDir?

optional baseDir?: `/${string}`

Subpath the client app is served from (e.g. "/my-app").

When set, Wasp configures React Router's basename for routing and Vite's base option for asset URLs, so the app works from https://example.com/my-app.


envValidationSchema?

optional envValidationSchema?: Reference<ZodSchema>

Zod schema used to validate user-defined client environment variables at build time. Wasp merges it with built-in validation for Wasp-defined env vars when validating import.meta.env. Import the schema from app code with a reference import or pass an ExtImport object. Client env vars must be prefixed with REACT_APP_.

See Env Vars.


rootComponent?

optional rootComponent?: Reference<AnyFunction>

Wrapper React component rendered at the root of the client app. Must render Outlet from react-router to show the current page.

Useful for layouts, providers (Redux, theme, etc.), and global UI.


setupFn?

optional setupFn?: Reference<AnyFunction>

Async function Wasp calls once while initializing the client app. Wasp awaits it before rendering the app. It receives no arguments, and its return value is ignored. Use it for one-time client-side setup, such as configuring the query client or starting client-side periodic jobs.