Introduction to Supabase

Every software developer will have a different perspective on what makes a good production-grade application. There will be some aspects mentioned more frequently than others, but some of the top considerations are likely to be: a database, file storage, scalability, authentication, backend, frontend, cache, and analytics. This list can stretch as far as one's arm, as you've probably already noticed.
Sometimes we may need a super productivity tool, which is master of all and Backend as a service (BaaS) platforms are one such tool. In this article, I'll talk about one of those tools, Supabase. Let us get started.
What is Supabase
Superbase is a self-hosted and cloud-hosted BaaS platform that lets developers create and manage backend services using a wide range of tools. It lets you outsource functions and develop applications on an agile basis without worrying about the server.
In addition to being open source, this platform has an intuitive user interface, making it a potential substitute for Google's Firebase. Due to its cloud-based nature, it does not require any installation, only a username, and password to start developing a project. With Supabase, you get all the tools and backend services you need to build scalable, secure applications: database management, authentication, file storage, automated API generation and real-time updates.
Overview of the Supabase architecture
In the following figure, you can see a high-level view of the main technical building blocks.
Supabase consists of the following parts:
Supabase: It's the main part. It is a backend built around a Postgres database.
Supabase Studio: This is the administration UI, which can be found at app.supabase.com.
Supabase Client Libraries: It offers low-level access to Supabase through client libraries for various technologies.
Supabase CLI: Access access the Supabase API through a command line interface.
S3 storage provider: In order to store large files, Supabase uses Amazon S3 storage. In contrast, you must choose an S3-compatible storage provider for the self-hosted version.
Features of Supabase
With Supabase, you can build web and mobile applications with an array of backend services and tools. Supabase features include:
Real-time database.
It's a database that allows real-time processing and immediate access to data as it's updated. An alternative to traditional databases is real-time access to the most recent data, which may require a delay in updating data. Using a PostgreSQL database, developers can develop real-time applications using Supabase, a cloud-based real-time database.
Edge Functions
A Supabase edge function is a piece of TypeScript code that responds to a client request and is deployed to Supabase edge nodes. Deno is used at runtime to improve security and to speed up cold starts, so the TypeScript code must comply with what Deno supports.
Edge functions support authorization in a simple manner. During authentication, the client sends the JWT token. Using the ID extracted from the token as input, the edge function code can check permissions based on the user's identity. A function that accesses a database may also create a Postgres client with the authenticated user's context, so that the policies of its RLS can be applied.
Authentication
By using authentication services, app developers can manage users securely and offer them secure options for creating and logging in to their accounts. With Sapabase, developers can manage application users seamlessly and create accounts and authenticate themselves securely.
It is relatively straightforward to implement authentication into your projects using Supabase's "box" method. Supabase authentication also offers the following three key features:
Social Providers – A simple click of a button enables users to log in using their social media accounts. The following are some examples: Facebook, Google, Azure, etc.
Integrations – With Supatabase, user management, authorization, and authentication are all built-in.
Own the Data – Supabase lets you store data in your database, so you don't have to worry about third parties accessing it.
Authorization
There is no better way to implement granular authorization rules than by using PostgreSQL's Row Level Security (RLS). PostgreSQL's Row-level Security feature (RLS for short) plays an important role in its security context. By defining a policy on a table, database administrators can control the viewing and manipulation of data per user. Row-level policies operate as additional filters. A user who attempts to operate on a table will see this filter applied before any query conditions or filtering, and the data will be shrunk down or denied access when this filter is applied. With Supabase, you can easily implement your policies using a few simple functions.
auth.uid() - Returns the user ID that made the request.
auth.jwt() - Returns the JWT of the user who made the request.
Storage
Developers can store and manage application data using Superbase Storage, a simple, yet powerful solution. It's easy to store images, videos, and other files with Supabase storage. The Supabase storage service simplifies the management of storage infrastructure for developers, so they don't have to worry about it.
The platform supports files up to 5GB in size, so developers can build applications for both small and large applications. A built-in access control system and encryption are also features of SuperBase storage. By limiting access to files, and encrypting these files at rest, sensitive data is protected.
Serverless API
The serverless API is similar to a traditional API, but it utilizes a serverless backend. The benefits of serverless computing include the lack of server maintenance and scaling of resources as needed to meet user demands. A serverless API can be scaled nearly infinitely. When there is a spike in user demand, organizations face scalability issues. Due to the fact that serverless APIs create server resources for every request, they avoid scaling issues. Thus, a serverless API won't be overwhelmed by a spike in demand, and resources will not be wasted when they aren't in use since they are created only when requested.
Open Source
The Supabase database platform is built on top of open-source technologies. By using Supabase, you can access the source code and modify it, as well as benefit from the support of a large and active developer community. With Supabase, you can build your app or service using open-source tools and libraries to leverage the expertise and knowledge of the open-source community. Through its active participation in and support of open-source projects, Supabase also encourages the use of open-source technologies in its platform. The collective knowledge and expertise of the open-source community can help you build better software by leveraging the power and flexibility of open-source software.
API generation
A web API can be generated automatically for your database using API generation. It is a set of standards and rules for accessing web-based software applications or tools. Communication over the internet is enabled between different software systems through this protocol. By defining your database schema and relationships, you can easily create a web API for your database with Supabase's API generation feature. By using standard HTTP requests, you can access and manipulate your data using Supabase's API endpoints and documentation. In addition to saving you time and resources, you will also be able to integrate your database with other applications and software systems more easily. Furthermore, it can simplify the process of building web or mobile apps that use your database by providing easy access and manipulation of the data.
Collaboration
Collaboration features in Supabase make it easy for you and your team to access your API and database and collaborate in real-time. With Supabase, you can also manage versions, perform code reviews, and communicate with your team. Utilizing the collective knowledge and expertise of your team can help you develop better software.
Working Of Supabase
Developed using open source backend technology and functionality, Supabase is a complete solution for developing and creating web and mobile applications. It uses a cloud-based architecture of serverless functions.
PostgreSQL is an open source relational database that is known for its reliability and scalability. REST APIs are automatically generated based on the structure of your databases.
By utilizing HTTP/HTTPS protocols, these APIs provide JSON and XML interfaces to the database. Moreover, it provides a variety of authentication tools, such as: email, GitHub, GitLab, or Google, for user login, and numerous tools for configuring user data control levels.
A variety of popular tools, including Stripe, Slack, Discord and GitHub, can be integrated with Supabase, allowing developers to include payment processes, notifications, alerts, and other actions into their applications without having to write additional code.
Conclusion
To sum it up, Supabase is the best open source alternative to Google's Firebase. Unlike other real-time database solutions, it does not have any limitations regarding data types due to the power of PostgreSQL.