Skip to main content
Version: Next

Heroku

note

Last checked with Wasp 0.26 and Heroku (as of Apr 6, 2026).

This guide depends on external libraries or services, so it may become outdated over time. We do our best to keep it up to date, but make sure to check their documentation for any changes.

Deploy Wasp to Heroku server client database

This guide shows you how to deploy your app and provision a database for it on Heroku. You can check their pricing page for more information on their plans.

A built Wasp app is a single server that serves your app's pages, its static assets and its API, so it needs a single Heroku app.

Prerequisites

You will need a Heroku account, heroku CLI and docker CLI installed to follow these instructions.

Make sure you are logged in with heroku CLI. You can check if you are logged in with heroku whoami, and if you are not, you can log in with heroku login.

Set up a Heroku app

info

You need to do this only once per Wasp app.

Unless you want to deploy to an existing Heroku app, let's create a new Heroku app:

heroku create <app-name>

Unless you have an external PostgreSQL database that you want to use, let's create a new database on Heroku and attach it to our app:

heroku addons:create --app <app-name> heroku-postgresql:essential-0
caution

We are using the essential-0 database instance. It's the cheapest database instance Heroku offers and it costs $5/mo.

Heroku will also set DATABASE_URL env var for us at this point. If you are using an external database, you will have to set it up yourself.

The PORT env var will also be provided by Heroku, so the ones left to set are the JWT_SECRET and WASP_SERVER_URL env vars:

heroku config:set --app <app-name> JWT_SECRET=<random_string_at_least_32_characters_long>
heroku config:set --app <app-name> WASP_SERVER_URL=<url_of_your_heroku_app>

heroku create printed your app's URL, and you can look it up again with heroku info --app <app-name>.

We can help you generate a JWT_SECRET:

note

There's no separate client URL to configure. WASP_WEB_CLIENT_URL defaults to WASP_SERVER_URL, and one server serves both your app's pages and its API.

Deploy the Heroku app

After you have built the app, position yourself in .wasp/out/ directory:

cd .wasp/out

assuming you were at the root of your Wasp project at that moment.

Log in to Heroku Container Registry:

heroku container:login

Set your app's stack to container so we can deploy our app as a Docker container:

heroku stack:set container --app <app-name>

Build the Docker image and push it to Heroku:

heroku container:push --app <app-name> web

App is still not deployed at this point. This step might take some time, especially the very first time, since there are no cached Docker layers.

Deploy the pushed image and restart the app:

heroku container:release --app <app-name> web

This is it, your app is deployed at https://<app-name>.herokuapp.com 🎉

Find out the exact app URL with:

heroku info --app <app-name>

Additionally, you can check out the logs with:

heroku logs --tail --app <app-name>
Using pg-boss with Heroku

If you wish to deploy an app leveraging Jobs that use pg-boss as the executor to Heroku, you need to set an additional environment variable called PG_BOSS_NEW_OPTIONS to {"connectionString":"<REGULAR_HEROKU_DATABASE_URL>","ssl":{"rejectUnauthorized":false}}. This is because pg-boss uses the pg extension, which does not seem to connect to Heroku over SSL by default, which Heroku requires. Additionally, Heroku uses a self-signed cert, so we must handle that as well.

Read more: https://devcenter.heroku.com/articles/connecting-heroku-postgres#connecting-in-node-js