Deploying
Because this SaaS app is a React/NodeJS/Postgres app built on top of Wasp, you can deploy it anywhere where static files, NodeJS and Postgres can be hosted and served.
The simplest and quickest option is to take advantage of Wasp’s one-command deploy to Fly.io.
Or if you prefer to deploy to a different provider, or your frontend and backend separately, you can follow any of the other deployment guides below.
If you’re looking to deploy your Blog, you can follow the Deploying your Blog section at the end of this guide.
Deploying your App
Prerequisites
Make sure you’ve got all your API keys and environment variables set up before you deploy.
For example, in the Stripe integration guide, you set up your Stripe API keys using test keys and product ids. You’ll need to get the live/production versions of those keys here:
- Production-ready keys
- Product IDs
- Customer portal URL (for the client-side
REACT_APP_STRIPE_CUSTOMER_PORTAL
)
Make sure to save these variables, as we will be need them for the deployment.
Deploying to Fly.io
Fly.io is a platform for running your apps globally. It’s a great choice for deploying your SaaS app because it’s free to get started, can host your entire full-stack app in one place, scales well, and has one-command deploy integration with Wasp.
For the initial deployment to Fly.io, you can use the following command after you’ve completed the prerequisites (only run this once!):
To redeploy your app after you’ve made changes, you can use the following command:
Deploying Manually / to Other Providers
If you prefer to deploy manually, your frontend and backend separately, or just prefer using your favorite provider you can follow the Manual Deployment Guide.
Setting up your Stripe Webhook
Now you need to set up your stripe webhook for production use.
- go to https://dashboard.stripe.com/webhooks
- click on
+ add endpoint
- enter your endpoint url, which will be the url of your deployed server +
/stripe-webhook
, e.g.https://open-saas-wasp-sh-server.fly.dev/stripe-webhook
- select the events you want to listen to. These should be the same events you’re consuming in your webhook. For example, if you haven’t added any additional events to the webhook and are using the defaults that came with this template, then you’ll need to add:
-account.updated
-checkout.session.completed
-customer.subscription.deleted
-customer.subscription.updated
-invoice.paid
- after that, go to the webhook you just created and
reveal
the new signing secret. - add this secret to your deployed server’s
STRIPE_WEBHOOK_SECRET=
environment variable.
If you’ve deployed to Fly.io, you can do that easily with the following command:
Deploying your Blog
Deploying your Astro Starlight blog is a bit different than deploying your SaaS app. As an example, we will show you how to deploy your blog for free to Netlify. You will need a Netlify account and Netlify CLI installed to follow these instructions.
Make sure you are logged in with Netlify CLI.
- You can check if you are logged in with
netlify status
, - you can log in with
netlify login
.
Position yourself in the blog
directory and run the following command:
This will build your blog into the blog/dist
directory. Now you can deploy your blog to Netlify with the following command:
Select the dist
directory as the deploy path.
Finally, if the deployment looks good, you can deploy your blog to production with the following command: