In this guide we show you how you can easily set up your supastarter SaaS using Supabase.
Before we start, make sure you have a Supabase account. If you don't have one yet, you can create one for free at supabase.io.
1. Create a new Supabase project
2. Get connection string
In the supabase dashboard, navigate to Settings > Database and copy the connection string.
3. Create a new supastarter project
As described in the supastarter documentation, you can create a new supastarter project by running the following command:
npx supastarter new
In the CLI wizard, you will be asked for the database connection string. Paste the connection string you copied in step 2. Make sure to replace the password placeholder in the connection string with the one you created in step 1.
4. Fix envs for migration connection
There is one special case for the migration connection. In the supastarter project, open the .env.local
file and change the DATABASE_URL
to the following:
DATABASE_URL="postgres://postgres:[YOUR-PASSWORD]@db.[YOUR-PROJECT-REF].supabase.co:6543/postgres?pgbouncer=true"
Then add the following env below that line:
MIGRATION_DATABASE_URL="postgres://postgres:[YOUR-PASSWORD]@db.[YOUR-PROJECT-REF].supabase.co:5432/postgres"
Make sure to replace the password and project ref placeholders with your own values.
Next we need to add the migration connection to the prisma/schema.prisma
file. Add the following line to the top of the file:
datasource db {
provider = "postgresql"
url = env("DATBASE_URL")
directUrl = env("MIGRATION_DATABASE_URL")
}
5. Run development server
Now you should be able to start the development server by running the following command in the project root:
pnpm dev
That's all it takes to set up supastarter with Supabase! If you have questions, feedback or feature requests, feel free to reach out to us on Twitter or on the supastarter Discord server.
From zero to SaaS with no effort
Save time and focus on your business with supastarter, the scalable and production-ready starter kit for your SaaS.
Get started →Stay up to date
Sign up for our newsletter and we will keep you updated on everything going on with supastarter.