Supabase - An OpenSource Firebase Alternative
Somsubhra Das
Posted on August 6, 2021
Supabase is an OpenSource Firebase Alternative providing Backend as a Service to various applications. It is super easy to setup and runs quickly with multiple frameworks.
Features
Supabase has the following highlighting features:
- PostgreSQL with RealTime Capabilities with PostgREST API
- Security and Access control managed by Postgres RLS(Row Level Security)
- Authentication with multiple services with support of Magic Link authentication
- File Storage
- Supabase Client Libraries (Javascript, Python, Dart)
- Serverless Functions (Coming Soon)
How it works?
At its core, Supabase is a suite of open source tools, stitched together to build a seamless developer experience:
Source: Supabase
Project
A project in Supabase is a wrapper around all your databases, authentication users, policies, tables, file storage. There are multiple regions from which you can choose where to host your project and Supabase officials are continuously adding more locations to reduce latency.
A project creation takes around 2 minutes to complete so get a coffee, sit back and relax.
Project Dashboard
Once your project is created, you will be greeted with a similar dashboard shown below.
This dashboard contains all details about your project including your database connections, authentication requests, storage space, implementation using client libraries, and much more.
Table Creator/Editor
Supabase uses Relational PostgreSQL as database with RealTime Capabilities and Policy access control by Postgres RLS(Row Level Security).
Supabase allows developers to create a Table and add columns and attributes directly from dashboard.
Supabase allows developers to edit data directly from the dashboard.
Authentication
Supabase has a wide range of Authentication Providers such as Google, GitHub, Facebook, Twitter, GitLab etc. These can be enabled through Authentication Panel. It also supports Phone OTP Authentication and also Magic Link Authentication.
Once a user authenticates through Supabase, it shows the users' email, last login time on the Auth Dashboard.
The magic link works seamlessly which allows users to login/register in your app without a password.
What I like most about the Supabase authentication service is the RLS Policies Feature. We can create policies to restrict access to users from making changes or viewing data from our tables in database.
Supabase provides some pre written templates for our policies as well. We may choose from them or write our own custom policies through the SQL editor as shown below.
create policy "Users can only update their own items."
on items for update using (
auth.email() = email
);
The above query sets the policy in such a way that only the user who's the owner of the item can update that specific item.
Storage
Supabase provides file storage feature with the option to add access control policies to the files as well.
It provides a publicly accessible file link so that it can be shared or embedded in Frontend Apps.
SQL Editor
Supabases gives an online SQL Query CLI right out of the box so that we need not use the CLI to connect to the DBAAS to run our queries. It even saves your queries so that we can go back and check our previous run queries.
Database
From the database tab you may edit your database schemas, add columns to your database, create new tables, delete tables, update database roles etc.
You can even modify the connection pooling of your database.
Alpha Features
A few of the Database features are still in Alpha version.
- Database Triggers - trigger is a function invoked automatically whenever an event associated with a table occurs.
- Functions - set of SQL and procedural commands such as declarations, assignments, loops, flow-of-control etc.
- Function Hooks
Reports
Supabase also has the ability to generate custom reports for your projects. They give a high level overview of your network traffic, user actions, and infrastructure health.
API
Supabase has a wide range of APIs for user Authentication, databases, user management, storage management etc. These APIs are secured by an anonymous API Key.
Check out more on the API reference here.
Client Libraries
Supabase currently supports 3 Client side languages:
- Javascript
- Python
- Dart
The client side sdk has all the functions required for supabase operations to build a Full Stack Application.
Self Hosting
Using Supabase you can even self host the BAAS on your own server. The self-hosted version of Supabase does not include a UI yet. It can be self hosted easily using the Supabase CLI. To get started install the CLI using:
npm install -g supabase
Read more about self-hosting Supabase here.
Is Supabase going to replace Firebase?
So the question you have been looking forward to is this and to this I would straightaway answer "NO!". Supabase is not a 1-to-1 mapping of Firebase. While they are building many of the features that Firebase offers, they are not going about it the same way.
The technological choices are quite different to Firebase. Everything Supabase uses is open source.
Most notably, Supabase uses Postgres rather than a NoSQL store. Currently no other database on the market offers the scalability and functionality required to legitimately compete with Firebase. This is a boon to all those developers who wanted a Backend-As-A-Service(BAAS) with a relational database like PostgreSQL.
But those who still prefer NoSQL structure can go for Firebase as it offers the flexibility of NoSQL store.
Be a part of Supabase
The most beautiful thing about Supabase is it's OpenSource and the code is available publicly on GitHub, so you can easily contribute to it and be a part of Supabase Community.
Posted on August 6, 2021
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.