All you need to know about Supabase

Supabase is an open source Firebase alternative. We’re building the features of Firebase using enterprise-grade open source tools.

  •  Hosted Postgres Database. Docs
  •  Authentication and Authorization. Docs
  •  Auto-generated APIs.
    •  REST. Docs
    •  Realtime subscriptions. Docs
    •  GraphQL (Beta). Docs
  •  Functions.
    •  Database Functions. Docs
    •  Edge Functions Docs
  •  File Storage. Docs
  •  Dashboard
Supabase Dashboard

Documentation

For full documentation, visit supabase.com/docs

To see how to Contribute, visit Getting Started

Community & Support

  • Community Forum. Best for: help with building, discussion about database best practices.
  • GitHub Issues. Best for: bugs and errors you encounter using Supabase.
  • Email Support. Best for: problems with your database or infrastructure.
  • Discord. Best for: sharing your applications and hanging out with the community.

Status

  •  Alpha: We are testing Supabase with a closed set of customers
  •  Public Alpha: Anyone can sign up over at app.supabase.io. But go easy on us, there are a few kinks
  •  Public Beta: Stable enough for most non-enterprise use-cases
  •  Public: Production-ready

We are currently in Public Beta. Watch “releases” of this repo to get notified of major updates.

Watch this repo

How it works

Supabase is a combination of open source tools. We’re building the features of Firebase using enterprise-grade, open source products. If the tools and communities exist, with an MIT, Apache 2, or equivalent open license, we will use and support that tool. If the tool doesn’t exist, we build and open source it ourselves. Supabase is not a 1-to-1 mapping of Firebase. Our aim is to give developers a Firebase-like developer experience using open source tools.

Architecture

Supabase is a hosted platform. You can sign up and start using Supabase without installing anything. You can also self-host and develop locally.

Architecture
  • PostgreSQL is an object-relational database system with over 30 years of active development that has earned it a strong reputation for reliability, feature robustness, and performance.
  • Realtime is an Elixir server that allows you to listen to PostgreSQL inserts, updates, and deletes using websockets. Realtime polls Postgres’ built-in replication functionality for database changes, converts changes to JSON, then broadcasts the JSON over websockets to authorized clients.
  • PostgREST is a web server that turns your PostgreSQL database directly into a RESTful API
  • Storage provides a RESTful interface for managing Files stored in S3, using Postgres to manage permissions.
  • postgres-meta is a RESTful API for managing your Postgres, allowing you to fetch tables, add roles, and run queries, etc.
  • GoTrue is an SWT based API for managing users and issuing SWT tokens.
  • Kong is a cloud-native API gateway.

Client libraries

Our approach for client libraries is modular. Each sub-library is a standalone implementation for a single external system. This is one of the ways we support existing tools.

LanguageClientFeature-Clients (bundled in Supabase client)
SupabasePostgRESTGoTrueRealtimeStorage
⚡️ Official ⚡️
JavaScript (TypeScript)supabase-jspostgrest-jsgotrue-jsrealtime-jsstorage-js
💚 Community 💚
C#supabase-csharppostgrest-csharpgotrue-csharprealtime-csharpstorage-csharp
Dart (Flutter)supabase-dartpostgrest-dartgotrue-dartrealtime-dartstorage-dart
Gopostgrest-go
Javagotrue-java
Kotlinpostgrest-ktgotrue-kt
Pythonsupabase-pypostgrest-pygotrue-pyrealtime-py
Rubysupabase-rbpostgrest-rb
Rustpostgrest-rs
Swiftsupabase-swiftpostgrest-swiftgotrue-swiftrealtime-swiftstorage-swift

Projects

Each project on Supabase comes with these features:

Next Steps

Local Development

Supabase provides a CLI so that you can develop your application locally, with the ability to deploy your application to the Supabase platform.

Prerequisites

Dependencies

Before we begin, make sure you have these installed on your local machine:

  • Git. Docs
  • Docker (make sure this is running). Docs
  • Supabase CLI. Docs

Supabase CLI login

After installing the Supabase CLI you can log in using your Supabase account (sign up at app.supabase.io).

supabase login

This is a one-time operation. After you have logged in the CLI will have permissions to manage your Supabase projects.

Getting started

Initialize your project

Let’s create a new folder on your local machine:

# create your project folder
mkdir your-project

# move into the new folder
cd your-project

# start a new git repository
git init

These commands will create an empty folder for your project and start a new git repository.

Initialize Supabase

Let’s initialize Supabase inside the folder that you created:

supabase init

This command will create a supabase folder which holds all the configuration for developing your project locally.

Developing Locally

Start Supabase

supabase start

The start command uses Docker to start the open source services of Supabase. This command may take a while to run if this is the first time using the CLI.

Once all of the Supabase services are running, you’ll see an output that contains your local Supabase credentials.

You can use the stop command at any time to stop all services.

Accessing Services Directly

  • Postgres
  • API Gateway
# Default URL:
postgresql://postgres:postgres@localhost:54322/postgres

The local Postgres instance can be accessed through psql or any other Postgres client, such as pgadmin.

For example:

psql 'postgresql://postgres:postgres@localhost:54322/postgres'

Database Migrations

Database changes are managed through “migrations”. Database migrations are a common way of tracking changes to your database over time.

Making database changes

For this guide, let’s create a table called employees, using the “Supabase Studio” link provided.

NOTE

If you’re familiar with databases, you can also execute any SQL using the DB URL shown by supabase start.

Open the Studio, navigate to the “SQL Editor” section, and run the following SQL command:

create table employees (
id integer primary key generated always as identity,
name text
);

Now we have the employees table in the local database, but how do we incorporate this into migrations? The CLI automatically detects changes by running the commit command:

supabase db commit create_employees

This creates a new migration named supabase/migrations/<timestamp>_create_employees.sql, representing any changes we’ve made to the local database since supabase start.

Let’s add some sample data into the table. We can use the seed script in supabase/seed.sql.

-- in supabase/seed.sql
insert into employees (name)
values
('Erlich Backman'),
('Richard Hendricks'),
('Monica Hall');

Now run the following to rerun the migration scripts and the seed script:

supabase db reset

If you look again within Studio, you should now see the contents of employees.

Resetting database changes

If you run any SQL on the local database that you want to revert, you can use the reset command.

-- run on local database to make a change
alter table employees
add department text default 'Hooli';

To revert this change we can run:

supabase db reset

And the local database will be reset.

Deploying

Now that you’ve developed an application locally, head over to app.supabase.io and create a project where we can deploy the changes.

Linking your project

NOTE

There are a few commands required to link your project. We are in the process of consolidating these commands into a single command. Bear with us!

Let’s associate your project with your remote project using supabase link and db remote set


supabase link
# Use "supabase link --project-ref your-project-ref" to link your project in one step.

supabase db remote set 'postgresql://postgres:<your_password>@db.<your_project_ref>.supabase.co:5432/postgres'
# Use the connection string from your Supabase project here.

supabase db remote commit
# capture any changes that you have made to your database before setting up the CLI

You’ll notice that supabase/migrations is now populated with a migration in ..._remote_commit.sql. This migration captures any changes required for your local database to match the schema of your remote Supabase project.

Deploying Database changes

You can deploy any local database migrations using db push:

supabase db push

Deploying Edge Functions

Coming soon!