Supabase Vercel Starter
lets clone the world
- tags
- supabase
- vercel
- nextjs
- starter
Contents
I'm looking to build a bunch of apps, and am evaulating a bunch of the start kits out there. I know I want to use supabase and probably NextJS, so lets look at the base one that vercel supplies.
Preqs
Setup all the stuff on your machine if you don't have it.
|
|
If not found, install pnpm.
|
|
If not found, brew install --cask docker
|
|
If not found, brew install supabase/tap/supabase
|
|
If not found, brew install --cask cursor
Setup the environment
|
|
Once this is open, create a .vscode/tasks.json
file:
|
|
The CMD-SHIFT-P
, Run Tasks
, and select dev
which you just created.
CTRL-SHIFT-`
to create a new terminal. Type
|
|
And then
|
|
This will take a while.
Setup local .env.development
|
|
Accounts
Go to the signup page.
Create an account.
You will see you login details on the account page.
Go to the user page on the studio to see the new user account.
Go to the Inbox server to see the email that it sent.
Testing real emails
Lets sign up with resend because they give you a bunch of free emails, and we don't need that much.
First get an API key, and put it in .env.development
|
|
Go to Settings
> SMTP
Inside of supabase/config.toml
, find the auth.email.smtp
section:
Change the outgoing email address to be something that resend will sent from, for example your email. I'm using the onboarding email test but you can use whatever you have verified.
|
|
Everytime you make a change, be sure to
supabase stop
and supabase start
Test data
|
|
And in the resultant file
|
|
And then in seed.sql
:
|
|
Then
|
|
Deploy
Supabase Database
Create a new supabase project.
Save the password somewhere, like a password manager. Then link your local project to the main project:
|
|
You'll need the database password. Once the database is done being created, push the schema over:
|
|
That will take a bit to load up.
Supabase email
On the supabase side header, go to Authentication
. Select Emails
and
then SMTP Settings
. Enter in your resend SMTP credentials
Supabase environment variables
Go into Connect
in the header, slide over to app frameworks, and copy
the NEXT_PUBLIC_SUPABASE_URL
etc stuff to the clipboard.
Deploy to vercel
|
|
|
|
Then go to vercel.com and create a new project, importing it from that newly created repo.
Go to settings, environment, and then paste in the
NEXT_PUBLIC_SUPABASE_URL
stuff in there. Once it's added, then select
Redeploy
to have the changes go public.
Add supabase redirect urls
In the supabase dashboard,go into Authentication
and then Configuration
.
Change the siteurl to be your main url
Add in the redirect urls.
Test
Create a user.
Forgot password. Make sure that the redirectURL is working correctly.
Email rate limiting
Be sure to up the liits of how many emails you can send, it defaults to 2.
Conclusions
This is a good start kit. The saas-starter also has a lot of interesting code it it, but it does use supabase auth so it's less interesting to me.
My biggest take away here is that it's worth it to start looking at the commercial offerings.
Previously
Next