How to make a simple SaaS project
Use Next.js, TypeScript, Supabase, Stripe to build a simple SaaS project
Building a Simple SaaS Project with Next.js, TypeScript, Supabase, and Stripe
Local Development Setup
1. Install Required Tools
First, let's install the necessary CLI tools:
Note: You'll need Docker installed to run Supabase locally.
2. Clone the Project
We'll start with a template project and customize it according to our needs:
3. Set Up Supabase Locally
Configure Environment Variables
-
Update the file with GitHub OAuth credentials:
- Go to GitHub → Settings → Developer Settings → OAuth Apps
- Register a new OAuth application
- Set the Authorization callback URL to match
- Copy the Client ID and Secret to your file
-
Update with Supabase credentials:
- Run in your terminal
- Copy the following values from the output:
- Access the Supabase Studio at http://127.0.0.1:54323
4. Set Up Stripe Locally
- Create a new Stripe sandbox account
- Copy the API keys to
- Run and authenticate
- Start the webhook listener:
- Copy the webhook signing secret to as
5. Start the Application
The application should now be running at http://localhost:3000
You can add products through the Stripe dashboard and see them reflected in your application.
Production Deployment
1. Deploy Supabase to Production
- Create a new project in Supabase Cloud
- Link your local project:
- Push your database schema:
2. Deploy to Vercel
- Update the following environment variables in Vercel:
3. Configure Stripe for Production
-
Update Stripe environment variables:
-
Create a new webhook:
- Go to Stripe Dashboard → Developers → Webhooks
- Create a new webhook
- Set the Endpoint URL to your production URL/api/webhooks
4. Configure Authentication
-
Update Supabase Authentication settings:
- Set the Site URL to your production URL
- Update GitHub OAuth settings:
- Set Homepage URL to your production URL
- Update Callback URL from Supabase provider settings
-
Add the following environment variables to Vercel:
Test the deployment by creating a new product and verifying it appears on your production site.