PostgREST – a REST and GraphQL API for your database
The driver of any web application is selecting, updating, and inserting data from or into the Database. With Supabase, these actions are internal requests to the PostgREST service, which is reachable at the /rest/
endpoint. That service is the PostgREST project, which essentially makes any Postgres database accessible via the REST API (https://postgrest.org/en/stable/).
However, how does it work? Relational databases consist of tables, just like an Excel spreadsheet. In one Excel file, there can be multiple tabs, each containing a table of columns and rows. Hence, the Excel file itself is like a container for different tables.
In relational databases, this container is called a schema. By default, any table within a Postgres database is created in the default schema, which is named public
. A simple visualization of a TodoItem
table with an Upload
table resembling a Todo
database is given in Figure 1.6: