DEV Community

Cover image for Introduction to Supabase — The Firebase alternative
shrey vijayvargiya
shrey vijayvargiya

Posted on

Introduction to Supabase — The Firebase alternative

with SQL database instead of No-SQL

Under the Hood

The story begins when I read the tweet by one of its co-founders. Supabase is the name of the product, and they claim them to be the straight firebase alternative. I got excited about a firebase alternative meaning a more tabular database structure or maybe easy to build many-to-many relations within collections. Let’s dive into the general concept of supabase.

Overview

Supabase claims to be the open-source firebase alternative in the market. It accords with creating the backend in less than 3 minutes. In addition, it helps developers to create a project with a Postgres Database, Authentication, real-time subscription and Storage. Typically all the things firebase is currently serving, but the only difference is the database collection.

Difference between Supabase and Firebase

At this point, when supabase is still growing or, let's say, in the beta phase so we cannot compare the two of them. Firebase is a widely used and accepted backend tool for many companies nowadays. It's easy to integrate and trustworthy (backed by google), whereas supabase has not penetrated the production-level market.

Authentication

Supabase and firebase are almost on the same page in handling the authentication. The method to sign in or sign out the user using any provider such as Google, email, and password work almost the same way as firebase.

For adding authentication for different providers, the execution is almost identical for firebase and supabase. They both provide the box method to deal with the authentication and its corresponding form.

For example, authenticating the user using email and password is relatively straightforward.

const loginWithEmailAndPassword = async() => {
 const { data: Users, error } = await supabase.auth.sign({
   email: 'shrey@gmail.com',
   password: '12345678'
 });
};
Enter fullscreen mode Exit fullscreen mode

You must connect your client-side application to the supabase using the supabase key and API URL. I will cover a new story to explain how to connect and add supabase authentication to your application.

Database

Supabase uses Postgres as a database; it works around tables instead of No-SQL or Mongo DB. They provide a solid intention behind choosing Postgres as a database. You can read more about the architecture and database they choose in the below link.

Docs

“ We believe that no other database on the market offers the scalability and functionality required to compete with Firebase legitimately.” — These were their exact words in deliberately choosing Postgres as a database. Now everything will be a table, every collection you create will be a table consisting of columns, and each new element will be added in a new row.

Like the Postgres database, every column has a schema declaring the fashion of storing the values. While creating a table in the Supabase dashboard, you will be asked to make these schemas of columns.

Working with Tables

You don’t need too much understanding of SQL tables to work around a supabase database; they are tables just like a spreadsheet. Out of the box, supabase provides a SQL editor for SQL developers to work around the database within the dashboard.

Providing a SQL editor nullified a lot of scalable hindrances. In the future, when having more than 100K users, you need a data analyst to work around SQL database writing SQL queries; in that case, having pre-existing SQL editor will help developers within the organisation deal with the database efficiently.

Storage

One cool thing about the storage bucket in supabase is uploading files directly via the dashboard. Still, I am sceptical about polluting the database when allowed to upload via a dashboard directly. Never mind, I love the interface for storing files and being easy to handle and work around.

Storage provided by supabase is just like firebase storage. Only the naming convention of methods and the layout for the dashboard are different.

Docs

The only part where I don’t trust or find google good at is docs. Documentation for Firebase is not too good; you have to rely on StackOverflow to deal with firebase issues. So far, I have found supabase documentation well-articulated and easy to grasp. Spending a few minutes on the dashboard will redirect you to all the required pages. One of the best pieces of documentation I’ve read so far; reach out to the link below to read it.

https://app.supabase.io/project/pqkbcciznwwxlmswrwpy/api/default?page=auth
// You need to log in to reach this page 
Enter fullscreen mode Exit fullscreen mode

Future & Conclusion

At this point in time, we cannot surely tell the future of supabase. Yes overall the product looks fine to me, the dashboard UI is simple and easy to use, authentication, database is not too difficult to deal with. It's a good alternative for firebase users who are hard geek SQL lovers and working around tables are their every time forte.

What the future holds for the subbase is a question, companies should adopt the new style of creating databases and since firebase is booming a lot they too have heavy competition. I will keep covering more stories about supabase in future, until next time, have a good day, people.

Keep developing
Shrey
iHateReading

Top comments (0)