PostgREST serves a fully RESTful API from any existing PostgreSQL database. It provides a cleaner, more standards-compliant, faster API than you are likely to write from scratch. The server is written in Haskell using the Warp HTTP server.
PostgREST handles authentication using JSON Web Tokens and delegates authorization to the role information defined in the database. Other forms of authentication can be built on top of the JWT primitive. See the docs for more information.
Required variables
PGRST_DB_URI
: A PostgreSQL connection URI for the database you want to use as a backend and apply Umami migrations to. Check out the FlexStack Databases guide for integration recommendations. Below is a screenshot of a copyable connection URI in the Neon dashboard.
Advanced configuration
PostGREST can be configured using environment variables.
Client libraries
- postgrest-csharp - C#
- postgrest-dart - Dart
- postgrest-ex - Elixir
- postgrest-go - Go
- postgrest-js - TypeScript/JavaScript
- postgrest-kt - Kotlin
- postgrest-py - Python
- postgrest-rs - Rust
- postgrest-swift - Swift
Community tutorials
- PostgREST + Auth0: Create REST API in mintutes, and add social login using Auth0 - A step-by-step tutorial to show how to dockerize and integrate Auth0 to PostgREST service.
- PostgREST + PostGIS API tutorial in 5 minutes - In this tutorial, GIS • OPS shows how to perform PostGIS calculations through PostgREST Functions as RPC interface.
- “CodeLess” backend using postgres, postgrest and oauth2 authentication with keycloak - A step-by-step tutorial for using PostgREST with KeyCloak.