Skip to main content
Version: Next

Function: app()

app(config): App

Creates a Wasp App.

Call app() exactly once in your main.wasp.ts and export the result as the file's default export. The Wasp compiler reads this default export to generate your app.

See the Wasp Spec docs for the full shape of the configuration.

Parameters

config

auth?

Auth

Configuration for authentication. Enables auth when set.

client?

Client

Configuration for the client part of the resulting Wasp app.

db?

Db

Configuration for the app's database.

emailSender?

EmailSender

Configuration for the app's email sender.

string[]

Extra tags injected into the HTML <head>.

Each entry is rendered inside a React component, so the strings must be valid JSX: self-closing tags must end with /> (e.g. <meta ... />), and attributes must be camelCased (e.g. httpEquiv instead of http-equiv).

Due to a React bug, avoid defer on <script> tags because it can cause hydration warnings. Use async instead.

name

string

Internal app name.

Must not contain spaces.

parts

Part[]

All the Parts of the app.

Build entries with the dedicated constructors (page, route, query, action, api, apiNamespace, job, crud).

server?

Server

Configuration for the server part of the resulting Wasp app.

title

string

App title.

Used as the browser tab title.

wasp

Wasp

Wasp metadata.

This will get checked against the Wasp CLI.

webSocket?

WebSocket

Configuration for the app's WebSocket support.

Returns

App

Example

import { app, page, route } from '@wasp.sh/spec'
import MainPage from './src/MainPage' with { type: 'ref' }

export default app({
name: 'todoApp',
title: 'ToDo App',
wasp: { version: '^0.24.0' },
parts: [
route('MainRoute', '/', page(MainPage)),
],
})