wasp
The wasp package is the Wasp SDK: the code you import from your app's source files to use Wasp's features, such as operations, auth, and the router.
src/MainPage.tsx
import { useAuth } from "wasp/client/auth";
import { getTasks, useQuery } from "wasp/client/operations";
Each of the modules below is a path you can import from.
Getting the package
You don't need to install anything, and the package isn't published to npm. The Wasp CLI generates it specifically for your app, based on your Wasp Spec and Prisma schema, and sets it up as a dependency in your project.
Modules
| Module | Description |
|---|---|
| auth | Auth APIs you can use both on the client and on the server: the AuthUser type of the logged-in user, and helpers for reading auth data from a user entity object. |
| auth/providers | Types of the extra signup fields you define for your auth methods. |
| client | Runtime configuration and environment variables of your app's client. |
| client/api | An HTTP client for calling your app's server, including your custom APIs. |
| client/auth | Client-side auth APIs: getting the logged-in user, logging out, the generated Auth UI components, and the functions and helpers for building your own auth UI. |
| client/crud | Client-side APIs for the Queries and Actions of your Automatic CRUD specs. |
| client/operations | Client-side APIs for calling your Queries and Actions. |
| client/router | Type-safe links and URLs for the routes you declare in your Wasp Spec. |
| client/test | Helpers for testing your client code with Vitest and React Testing Library. The helper for configuring Vitest is in wasp/test. |
| client/vite | The Vite plugin that your app's client needs. |
| client/webSocket | React hooks for using your app's WebSocket server from the client. Only available if your app sets the webSocket field of the app spec. |
| entities | Types for your app's Entities, which you can use on both the server and the client. |
| env | Helper for defining the validation schemas of your app's environment variables. |
| server | Server-side APIs you can use in your Operations, APIs, Jobs, and server setup code. |
| server/api | Types for implementing your app's APIs (custom HTTP endpoints). |
| server/auth | Server-side auth APIs: types for your auth hooks, defining extra signup fields, helpers for working with users' auth identities, the validators Wasp uses in its default auth flows, and the OAuth clients of your social auth providers. You can use the helpers and the validators in custom sign-up actions. |
| server/crud | Types for overriding the Queries and Actions of your Automatic CRUD specs. |
| server/email | Send emails from your server code. |
| server/jobs | Your app's Jobs, which you can submit from your server code. |
| server/operations | Server-side APIs for your Queries and Actions: the types for implementing them, and the functions for calling them from other server code. |
| server/webSocket | Types for implementing your app's WebSocket server with Socket.IO. Only available if your app sets the webSocket field of the app spec. |
| test | The helper for configuring Vitest to test your client code. The helpers you use inside your tests are in wasp/client/test. |