Serverless APIs
Supabase auto-generates three types of API directly from your database schema.
- REST - connect to your database through a restful interface, directly from the browser.
- Realtime - for listening to database changes.
- GraphQL - a fast and auto-generate GraphQL API.
All the APIs are auto-generated from your database and are designed to get you building as fast as possible, without writing a single line of code.
You can use them directly from the browser (two-tier architecture), or as a complement to your own API server (three-tier architecture).
Features#
- Instant and auto-generated.
As you update your database the changes are immediately accessible through your API. - Self documenting.
Supabase generates documentation in the Dashboard which updates as you make database changes. - Secure.
The API is configured to work with PostgreSQL's Row Level Security, provisioned behind an API gateway with key-auth enabled. - Fast.
Our benchmarks for basic reads are more than 300% faster than Firebase. The API is a very thin layer on top of Postgres, which does most of the heavy lifting. - Scalable.
The API can serve thousands of simultaneous requests, and works well for Serverless workloads.
REST API #
Supabase provides a RESTful API using PostgREST. This is a very thin API layer on top of Postgres. It provides everything you need from a CRUD API:
- Basic CRUD operations
- Deeply nested joins, allowing you to fetch data from multiple tables in a single fetch
- Works with Postgres Views
- Works with Postgres Functions
- Works with the Postgres security model - including Row Level Security, Roles, and Grants.
GraphQL API #
GraphQL in Supabase works through pg_graphql, an open source PostgreSQL extension for GraphQL.
Realtime API #
Supabase provides a Realtime API using Realtime. You can use this to listen to database changes over websockets. Realtime leverages PostgreSQL's built-in logical replication. You can manage your Realtime API simply by managing Postgres publications. Go to your project's Replication section to get started.