A RESTful API served straight from your PostgreSQL database
open sourceMITself-hostablefree
PostgREST is a standalone web server that turns an existing PostgreSQL database into a RESTful API, with no API code to write. Tables, views and functions become endpoints, with filtering, ordering, pagination and embedded relations, and it delegates as much as it can to the database: JSON is serialised in SQL, and validation and authorization stay there. Requests are authenticated with JSON Web Tokens and run as the matching database role, so row-level security and grants are the single source of truth for access. APIs are versioned through database schemas. It's written in Haskell, keeps a connection pool, is stateless so it scales horizontally, and ships as a binary and a Docker image. Supabase uses it for its REST API.
Problems it solves
- a REST API for my Postgres database without writing a backend
- expose tables and views over HTTP with Postgres row-level security as the permissions
- an instant CRUD API in front of an existing database for a frontend app
- authenticate API requests with JWTs mapped to database roles
Features
- REST endpoints for tables, views and functions
- filtering, ordering, pagination and embedded relations
- JWT authentication mapped to database roles
- authorization through Postgres grants and row-level security
- API versioning through schemas
- stateless, with a connection pool, for horizontal scaling
- binary and Docker image
Capabilities
| Has an API | plan not known |
|---|---|
| Has a command line tool | plan not known |
Alternatives
The same job
These do what PostgREST does.
- Hasura Instant realtime GraphQL APIs on all your data, with fine-grained access control