Going Live with SupaLaunch
Creating a production Supabase project
First, we need to create a new Supabase project for production. Go to https://supabase.com and create a new project. During project creation, you will be asked to create a database password. Please remember it as we will need it later.
When the project is ready, in the Settings -> API tab you should find values we need for our production env file:
Project URL -> NEXT_PUBLIC_SUPABASE_URL
ANON API key -> NEXT_PUBLIC_SUPABASE_ANON_KEY
Service Role API key -> SUPABASE_SERVICE_ROLE_KEY
Now, in the production Supabase project create a Storage Bucket called images. We use this bucket to store images uploaded by users.
Applying migrations to the production database
Supabase has a great document on how to do local development. Overall, we need to connect our project to the production project. When we do some changes locally, we should apply those changes to our production Supabase project.
First, we need to install Supabase CLI. Next, we need to login to Supabase CLI and link our project. You can find your project Reference ID in the Settings of your Supabase project.
supabase login
supabase link --project-ref <project-referece-id>
Link command will ask you to enter your database password — don't skip this step.
SupaLaunch comes with initial migration files which you can find in the /supabase/migrations
folder. We can apply those migrations to our production database using the following command:
supabase db push
Deploying NextJS app to Vercel
Once we set up our production Supabase project, we can deploy our NextJS app to Vercel. Vercel is a great hosting platform for NextJS apps. It has a free plan and it's very easy to use.
The easiest way to deploy your SupaLaunch project is to connect your GitHub repository to Vercel. Once you do that, Vercel will automatically deploy your app every time you push changes to your repository.
You should add all necessary environment variables to your Vercel project. Some of them will come from .env.local
file. Others will come from the production Supabase project.
Also add NEXT_PUBLIC_SITE_URL environment variable to Vercel. This is the URL of your production app.
Setting up Payments
Please follow our guide on how to set up Stripe payments.
Authentication
Please follow our guide on how to set up Supabase authentication.
Conclusion
That's it! Now you have a production Supabase project and a production NextJS app. If you have any further questions, please open an issue in our GitHub repository.