Create a supabase account
Until now we’ve been using supabase locally with docker. Lets create the necessary accounts so we can deploy our blog to the cloud.
Go to supabase and create an account, and then a project. We won’t go into details about the project creation, you can find more information in the docs.
We have a couple of different ways of doing it, either by using the sql editor and copy pasting the migration file, or by using github actions.
If you created the database manually from the UI, you can just get the migration by running:
npx supabase db diff -f first-migration
Create a Github repository
Create a new repository or fork my repository if you haven’t done everything on your side already.
Lets go back to the database. What we want to do is deploy the database to supabase when we push to the main branch. We can do that by using github actions.
We need to create a folder called
.github/workflows and create a file called
deploy-migrations.yml with the content above.
In github (
Secrets and variables >
Actions), we also need to create the following secrets:
And the following variable:
You can find the values in the supabase dashboard.
Deploying the blog
First we need to create a vercel account and link it to our github account. Once that’s done, just create a new project.
Once again setup the supabase environment variables in the vercel dashboard. Those values are for Next.js this time.
And that’s it, we’re done. You can now go to your project and commit/push to the main branch to deploy the database and the blog.