mirror of
https://github.com/supabase/supabase.git
synced 2026-10-05 09:25:06 +03:00
76 lines
4.0 KiB
Plaintext
76 lines
4.0 KiB
Plaintext
import Layout from '~/layouts/DefaultGuideLayout'
|
|
|
|
export const meta = {
|
|
id: 'api',
|
|
title: 'Serverless APIs',
|
|
description: 'Auto-generating and Realtime APIs.',
|
|
sidebar_label: 'Overview',
|
|
video: 'https://www.youtube.com/v/rPAJJFdtPw0',
|
|
}
|
|
|
|
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.
|
|
- GraphQL - manipulate your database using a graph-like query language.
|
|
- Realtime - listen to database changes.
|
|
|
|
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.** <br />As you update your database the changes are immediately accessible through your API.
|
|
- **Self documenting.** <br />Supabase generates documentation in the Dashboard which updates as you make database changes.
|
|
- **Secure.** <br />The API is configured to work with PostgreSQL's Row Level Security, provisioned behind an API gateway with key-auth enabled.
|
|
- **Fast.** <br />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.** <br />The API can serve thousands of simultaneous requests, and works well for Serverless workloads.
|
|
|
|
## REST API [#rest-api-overview]
|
|
|
|
Supabase provides a RESTful API using [PostgREST](https://postgrest.org/). This is a very thin API layer on top of Postgres.
|
|
It provides everything you need from a CRUD API at the URL `https://<project_ref>.supabase.co/rest/v1/`.
|
|
|
|
The REST interface is automatically reflected from your database's schema and supports:
|
|
- Basic CRUD operations (Create/Read/Update/Delete)
|
|
- Arbitrarily deep relationships among tables/views, functions that return table types can also nest related tables/views.
|
|
- Works with Postgres Views, Materialized Views and Foreign Tables
|
|
- Works with Postgres Functions
|
|
- User defined computed columns and computed relationships
|
|
- Works with the Postgres security model - including Row Level Security, Roles, and Grants.
|
|
|
|
The REST API resolves all requests to a single SQL statement leading to fast response times and high throughput.
|
|
|
|
Reference:
|
|
- [Docs](https://postgrest.org/)
|
|
- [Source Code](https://github.com/PostgREST/postgrest)
|
|
|
|
## GraphQL API [#graphql-api-overview]
|
|
|
|
Supabase uses [pg_graphql](https://supabase.github.io/pg_graphql/) to expose a GraphQL API endpoint at `https://<project_ref>.supabase.co/graphql/v1/`.
|
|
You can introspect and query the GraphQL API of an existing Supabase project within Studio [here](https://app.supabase.com/project/_/api/graphiql),
|
|
or navigate there manually at `API Docs > GraphQL > GraphiQL`.
|
|
|
|
The GraphQL interface is automatically reflected from your database's schema and supports:
|
|
- Basic CRUD operations (Create/Read/Update/Delete)
|
|
- Support for Tables, Views, Materialized Views, and Foreign Tables
|
|
- Arbitrarily deep relationships among tables/views
|
|
- User defined computed fields
|
|
- The Postgres security model - including Row Level Security, Roles, and Grants.
|
|
|
|
The GraphQL API resolves all requests in a single round-trip leading to fast response times and high throughput.
|
|
|
|
Reference:
|
|
- [Docs](https://supabase.github.io/pg_graphql/)
|
|
- [Source Code](https://github.com/supabase/pg_graphql)
|
|
|
|
## Realtime API [#realtime-api-overview]
|
|
|
|
Supabase provides a Realtime API using [Realtime](https://github.com/supabase/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](https://app.supabase.com/project/_/database/replication) to get started.
|
|
|
|
export const Page = ({ children }) => <Layout meta={meta} children={children} />
|
|
|
|
export default Page
|