Getting Started
This guide will help you get your new SaaS app up and running.
Install Wasp
Pre-requisites
You must have Node.js (and NPM) installed on your machine and available in PATH
to use Wasp.
Your version of Node.js must be >= 18.
To switch easily between Node.js versions, we recommend using nvm.
Linux and macOS
Open your terminal and run:
Windows
In order to use Wasp on Windows, you need to install WSL2 (Windows Subsystem for Linux) and a Linux distribution of your choice. We recommend using Ubuntu.
You can refer to this article for a step by step guide to using Wasp in the WSL environment. If you need further help, reach out to us on Discord.
Once in WSL2, run the following command in your WSL2 environment:
Finalize Installation
Run the following command to verify that Wasp was installed correctly:
Also be sure to install the Wasp VSCode extension to get the best DX, e.g. syntax highlighting, code scaffolding, autocomplete, etc.
Setting up your SaaS app
Cloning the OpenSaaS template
From the directory where you’d like to create your new project run:
Then select option [3] saas
from the list of templates after entering the name of your project.
This will clone a clean copy of the Open SaaS template into a new directory! 🎉
Start your DB
Before you start your app, you need to have a Postgres Database connected and running. With Wasp, that’s super easy!
First, make sure you have Docker installed and running. If not, download and install it here
With Docker running, open a new terminal window/tab and position yourself in the app
directory:
Then run:
This will start and connect your app to a Postgres database for you. No need to do anything else! 🤯 Just make sure to leave this terminal window open in the background while developing. Once you terminate the process, your DB will no longer be available to your app.
Now let’s create our very first database migration, to ensure the database has a correct schema. Open a new terminal tab/window and run the following command:
This might take a bit since this is the first time you are running it and it needs to install all the dependencies for your Wasp project.
In the future, you will also want to run wasp db migrate-dev
whenever you make changes to your Prisma schema (Entities),
to apply those schema changes to the database.
Additionally, if you want to see or manage your DB via Prisma’s DB Studio GUI, run:
Start your app
At this point, you should be positioned in the app/
directory and have the database running in another terminal session.
Next, copy the .env.server.example
file to .env.server
.
.env.server
is where API keys for services like payments, email sender, and similar go, and this is where you will want to put them in later.
For now, you can leave it as it is (dummy API keys), this will be enough to run the app.
Then run:
This will install all the dependencies and start the app (client and server) for you :)!
If the app doesn’t open automatically in your browser, you can open it manually by visiting http://localhost:3000
in your browser.
At this point, you should have:
- your database running in one terminal session, likely on port
5432
. - your app running in another terminal session, the client likely on port
3000
, and the server likely on port3001
.
Run Blog and Docs
This SaaS app comes with a docs and blog section built with the Starlight template on top of the Astro framework. You can use this as a starting point for your own blog and documentation, if necessary.
If you do not need this, you can simply delete the blog
folder from the root of the project.
If you want to run the Starlight docs and blog, first navigate to the blog
folder:
Then run:
Then start the development server:
Check the instructions in the terminal for the link to open the blog, it will typically be https://localhost:4321/
.
What’s next?
Awesome! We have our new app ready and we know how to run both it and the blog/docs! Now, in the next section, we’ll give you a quick “guided tour” of the different parts of the app we created and understand how it works.