DEV Community

Rifki Andriyanto
Rifki Andriyanto

Posted on

Intro to Supabase: The Complete Backend for Web & Mobile Apps

Image description

When it comes to building an app, the biggest challenge is not writing code, but rather architecting a complete system that works at scale. Firebase and Amplify have addressed this barrier, but there's one big problem - they lock you into proprietary technology on a specific cloud platform.

This is where Supabase comes in. Created in 2019 specifically as an open source Firebase alternative, it provides two things on the back end. Firstly, infrastructure like a database, file storage, and edge functions that run in the cloud. Secondly, on the front end, client-side SDKs that can easily connect this infrastructure to your favorite front-end JavaScript framework, React Native, Flutter, and many other platforms.

As a developer, you can manage your Postgres database with an easy-to-understand UI that automatically generates REST and GraphQL APIs to use in your code. The database integrates directly with user authentication, making it almost trivial to implement row level security. And, like Firebase, it can listen to data changes in real-time while scaling to virtually any workload.

To get started, you can self-host with Docker or sign up for a fully managed account that starts with a free tier. On the dashboard, you can create tables in your Postgres database with a click of a button, insert columns to build out your schema, then add new rows to populate it with data. By default, every project has an authentication schema to manage users within the application. This opens the door to row level security, where you write policies to control who has access to your data.

In addition, the database supports triggers to react to changes in your data and Postgres functions to run stored procedures directly on the database server. It's a nice interface, but it also automatically generates custom API documentation for you. From here, you can copy queries tailored to your database and use them in a JavaScript project. Install the Supabase SDK with NPM, then connect to your project and sign a user in with a single line of code. And now, you can listen to any changes to the authentication state in real-time with "on/off" stage change.

When it comes to the database, you don't need to write raw SQL code. Instead, you can paste in that JavaScript code from the API docs or use the REST and GraphQL APIs directly. And that's all it takes to build an authenticated full-stack application. However, you may still want to run your own custom server-side code. In which case, serverless Edge functions can be developed with Deno and Typescript, then easily distributed around the globe.

In summary, Supabase provides a complete back end for web and mobile applications based entirely on free open source software. It's a flexible and scalable solution that allows developers to easily build, deploy and manage their applications.

Top comments (0)