🎄Supabase and FireBase - You might not need a backend🌟
Static websites
First, let's build on the idea of static websites. We talked about that in one of the previous Advent 2023 posts. And the benefits of Static websites are:
- they are fast
- they are secure
- they are cheap to host
- they are easy to deploy
Static websites with dynamic content
But what if you want to have dynamic content on your website? Then, there are couple options:
- you can use a static site generator like Next.js or Gatsby and regenerate a site with a new content.
- you can use a headless CMS like Contentful or Sanity and fetch content from there.
What if you want user authentication?
Then, you can use
What if you want to store data?
Then, again, you can store the data directly from your browser to Firebase or Supabase.
But what about security????
That is actually an interesting part. With Firebase or Supabase you pass keys from the browser. However, you can restrict access to the database to only authenticated users. And data is usually scoped to a specific user.
Firebase achieves it using hierarchical data structure. Where you'd have a root node for a user; and all user data would be stored under that node. Then you'd setup rules to allow access to that node only to the authenticated user (owner of the data).
Supabase achieves it using row level security. Where you'd have a table with a user id column. And you'd setup rules to allow access to the table only to the authenticated user (owner of the data).
What are other things I Can do with Firebase or Supabase?
You can do a lot of things with Firebase or Supabase:
- you can store data and files (images, videos, etc)
- you can send emails
- you can authenticate users