Supabase and Firebase are two backend-as-a-service platforms. Firebase is the market leader, while Supabase is taunted as its alternative. Both are scalable and serverless, but which has a better database?
If you ask any software developer what makes for a good production-grade application, you will probably get a different answer from each one. They will mention some aspects more often than others, but at the top of that list you’ll likely find: a database, file storage, scalability, authentication, backend, frontend, cache, or analytics. As you might have already noticed, that list can be as long as one’s arm.
It’s no surprise then that the software developers’ laziness (aka ingenuity) pushes them to search for tools that will speed up their job. One category of such tools are backend as a service (BaaS) platforms. In this article I’ll discuss two of them – Supabase and Firebase.
One of the first on the market and the most popular is the Firebase platform by Google. It is serverless and offers both a free tier and a “pay-as-you-grow” scheme. Aside from that, Firebase has much more to offer, too.
Today I am going to focus on four universal components that you need to build an efficient production-grade application: authentication, storage, database, and backend (or serverless functions).
Let’s start with the authentication. Firebase offers a fully featured authentication service that aims to improve end-user sign-in and onboarding. To that end, it provides an end-to-end identity solution, including email and password accounts, phone authentication, and social integrations.
Firebase’s Cloud Storage is intended to help you store and serve user-generated content, such as photos and videos. The SDK will also automatically pause and resume transfers as the app loses and regains mobile connectivity which saves your users time and bandwidth.
Firebase offers a document database called Firestore. It scales well and can be used in web and mobile applications, but there are some problems with it. In my opinion, the developer experience (DX) could be better. The things that I find rough are:
The other aspect I’m not a fan of are serverless functions powered by Node.js. These are enough for simple tasks. However, more complex tasks, like scheduled or long-running ones, are hard to implement and require subscribing to a paid plan.
Have a project in mind?
Let’s meet - book a free consultation and we’ll get back to you within 24 hrs.
Focusing only on the imperfections of Firebase, I started looking for an alternative. The joy of a successful discovery was massive! Let me introduce: Supabase, an open-source Firebase alternative.
The company raised over $116 million in funding. Some of the world’s leading investors decided to back it, including Y Combinator, Coatue, Mozilla Corporation, Felicis. Then there are tens of individual investors as well. Supabase community grows by the day, reaching over 80 000 registered developers and nearly 50 000 starts on GitHub at the time of writing.
Supabase is one of the only companies offering a PostgreSQL relational database with PgBouncer integrated for free. Postgres is one of the world’s most scalable databases, trusted by millions of developers.
Built-in Postgres mechanism called Row Level Security is used for access limitation as well as for connecting to an authentication system provided by Supabase.
Supabase also provides data-change listeners over WebSockets to enable real-time subscriptions.
Every Supabase project comes with a complete user management system that works without any additional tools. User data is stored in your database in a separate schema, so you never have to worry about third-party privacy issues. Supabase also allows social logins and has a ready React component library for building user authentication interfaces.
Supabase offers production-grade cloud storage that scales to infinity and integrates well with the rest of the ecosystem.
The newest addition to Supabase are serverless edge functions that scale automatically. Supabase now has nodes in 29 regions worldwide to execute functions closer to the users. Functions runner was created using Deno, a Node.js alternative, allowing developers to use JavaScript, TypeScript, and WASM.
Supabase comes with a command line interface (CLI) that uses Docker under the hood to bring the same experience that you get from their web platform to your local dev environment. The CLI is still under development but it contains all the functionalities needed to work with your Supabase projects and the Supabase platform.
My favourite feature of the CLI is generating TypeScript types for the whole database with just one command:
supabase gen types typescript --local > lib/database.types.ts
The TypeScirpt/JavaScript SDK was recently updated to V2, making development easier by providing better APIs and typings. You can use the supabase-js library to:
As you can see, both Supabase and Firebase are examples of BaaS (backend as a service) platforms. The most notable difference is how they manage data, with Firebase using real-time NoSQL document data store and Supabase using PostgreSQL relational database.
Apart from the features I listed above, an important thing to consider is also that Supabase is not a proprietary piece of software like Firebase. Since it’s an open-source project that uses an open-source database (PostgreSQL), using it won’t lock you in with one particular vendor (such as Google).
Finally, there’s always the question of price. While currently both Supabase and Firebase offer a free tier for experimentation, they differ quite significantly in their paid plans. Firebase charges for requests (read, write, delete), meanwhile its competitor charges for data storage.
Backend as a service platforms make software developers’ lives easier, the whole development process faster, and they are a great way to build proofs of concept (PoCs), minimum viable products (MVPs), and fully-featured products. While my personal preference is for Supabase, it’s true that both platforms are scalable, serverless, and come with fair pricing. BaaS platforms like Supabase and Firebase will never replace bespoke software, but for sure they have their place and can be used in some less demanding products.
Have a project in mind?
Let’s meet - book a free consultation and we’ll get back to you within 24 hrs.
Dominik is the Chief Innovation Officer at Gorrion and a full-stack software developer by both heart and trade. He is passionate about new technologies, teaching, and open-source. Sharing knowledge is what truly drives him, so you’ll often find him speaking at conferences and meet-ups. After work, he tends to work even more, but he also likes boxing, cycling, and bartending.