Supabase vs Firebase
4 minute read
What is Firebase?
Now owned by Google, Firebase is a collection of tools aimed at mobile and web developers. At its core is the Firestore database.
Firestore allows you to store “documents”. These are collections of key:value pairs where the value can be another sub-document. Document based storage is perfect for unstructured data, since two documents in a collection do not necessarily need to have the same structure.
Firebase also offers other things that web developers find useful like an auth service for user management, and wrappers for other Google services such as Cloud Functions, and File Storage.
What is Supabase?
Supabase is an open source firebase alternative, but instead of being built around a document-based datastore, Supabase offers a relational database management system called PostgreSQL. This comes with a few advantages:
- It’s open source, so there is zero lock in.
- You can query it with SQL, a proven and powerful query language.
- It has a long track record of being used at scale.
- It’s the database of choice for transactional workloads (think apps and websites, or other things that require near-instant responses to queries).
- It comes with decades of useful postgres extensions and plug-ins.
At Supabase we’ve always been huge fans of Firebase - so we started adding a few things on top of PostgreSQL in an attempt to reach feature parity, including:
- Auto-generated API - query your data straight from the client.
- Realtime - changes in your data will be streamed directly to your application.
- Auth - a simple to integrate auth system and SQL based rules engine.
- Storage - hosting images, videos, and pdfs easily.
How are they similar?
Both Firebase and Supabase are based on the idea of bringing a superior developer experience to databases. With both platforms you can spin up a new project from directly inside the browser without the need to download any extra tools or software to your machine. Both platforms come with a useful dashboard UI for debugging your data in realtime, which is especially useful for fast iterations when in development.
How are they different?
Firebase and Supabase differ in several ways. The main one being that Firebase is a document store, whereas Supabase is based on PostgreSQL - a relational, SQL-based database management system.
There are some other important differences.
Supabase is open source. Along with the hosted cloud platform, you can also take the Supabase stack and host it inside your own cloud or run it locally on your machine. There is no vendor lock in.
Firebase charges for reads, writes and deletes, which can lead to some unpredictability, especially in the early stages of a project when your application is in heavy development. Supabase charges based on the amount of data stored, with breathing room for unlimited API requests and an unlimited number of Auth users.
We created a benchmarking repo where you can compare the performance of both services in different scenarios. Our most recent results show that Supabase outperforms Firebase by up to 4x on number of reads per second, and 3.1x on writes per second.
How do I migrate from Firebase to Supabase?
Since Firebase is document based, migrating into a relational database requires you to map your data structure across into a SQL schema. Luckily we’ve built a handy conversion tool to do it for you.
We also have a tool for migrating Firebase Auth to Supabase Auth. And one for migrating Firebase Storage files to Supabase Storage.
These are by far the most complete Firebase to Postgres migration tools available anywhere on the web.
Supabase vs Heroku Postgres
26 May 2022