Cloud Providers
You can deploy the built Wasp app wherever and however you want, as long as your provider/server supports running a Node.js server, serving static files, and running a PostgreSQL database.
Guides
We have step-by-step guides for deploying your Wasp app to some of the most popular providers you can follow:
Deploying Wasp to Cloudflare Workers »
Uses Cloudflare Workers, Wrangler CLI
Deploying Wasp to Fly.io »
Uses Fly.io, fly CLI, Docker
Deploying Wasp to Heroku »
Uses Heroku, heroku CLI, Docker
Deploying Wasp to Netlify »
Uses Netlify, Netlify CLI
Deploying Wasp to Railway »
Uses Railway, Railway CLI
Deploying Wasp to Render »
Uses Render, Blueprint (IaC)
If your desired provider isn't on the list, no worries, you can still deploy your app - it just means we don't yet have a step-by-step guide for you to follow. Feel free to open a PR if you'd like to write one yourself :)
Manual deployment
Deploying a Wasp app comes down to the following:
- Generating deployable code.
- Deploying the API server (backend).
- Deploying the web client (frontend).
- Deploying a PostgreSQL database and keeping it running.
Let's go through each of these steps.
1. Generating Deployable Code
Running the command wasp build generates deployable code for the whole app in the .wasp/out/ directory.
wasp build
You won't be able to build the app if you are using SQLite as a database (which is the default database). You'll have to switch to PostgreSQL before deploying to production.
2. Deploying the API Server
There's a Dockerfile that defines an image for building the server in the .wasp/out directory.
To run the server in production, deploy this Docker image to a hosting provider and make sure the required env variables are correctly set up. Usually, you use the provider's dashboard UI or a CLI tool to set up these env variables.
Check the required server env variables and make sure they are set up for your server.
While these are the general instructions on deploying the server anywhere, we also have more detailed instructions for chosen providers below, so check that out for more guidance if you are deploying to one of those providers.
3. Deploying the Web Client
To build the web app, run the following command from your project root:
REACT_APP_API_URL=<url_to_wasp_backend> npx vite build
where <url_to_wasp_backend> is the URL of the Wasp server that you previously deployed.
The build output will be in .wasp/out/web-app/build.
Remember, if you have defined any other client-side env variables in your project, make sure to add them to the command above when building your client
The command above will build the web client and put it in the .wasp/out/web-app/build directory, including the 200.html file at the root that acts as the SPA fallback.
Since the result of building is just a bunch of static files, you can now deploy your web client to any static hosting provider (e.g. Netlify, Cloudflare, ...) by deploying the contents of .wasp/out/web-app/build/.
4. Deploying the Database
Any PostgreSQL database will do, as long as you provide the server with the correct DATABASE_URL env var and ensure that the database is accessible from the server.