
PostgREST
Turns an existing PostgreSQL database into a REST API with no hand-written server code.
- Stars
- 27.7k
- Forks
- 1.2k
- Licence
- MIT
- Language
- Haskell
- Last update
- 6 days ago
- Type
- App
What it is
PostgREST is a server that reads your existing PostgreSQL database and serves a RESTful HTTP API from it. Developers use it to avoid writing and maintaining custom API code for common create, read, update, and delete operations. Authentication uses JSON Web Tokens, and authorization relies on the database's own roles.
- Expose tables or views from an existing PostgreSQL database as a REST API
- Publish versioned API endpoints by placing public-facing views in a separate schema
- Generate OpenAPI documentation for the API and render it with a tool such as Swagger-UI
- Authenticate API users with JSON Web Tokens while the database enforces their permissions
Great for
- Developers who already have a PostgreSQL database and want an HTTP API on top of it quickly
- Teams that want database rules and permissions to be the single source of truth for access control
- Projects that need API versioning through database schemas and views
- Backends that prefer declarative constraints in the database over application-level validation
Not ideal for
- Projects not using PostgreSQL, since the README describes it only for PostgreSQL databases
- Teams that need a lot of custom application logic inside the API layer, which the README's model of delegating work to the database does not suit well
- Non-developers, because setup requires database roles, JWT configuration, and familiarity with SQL
How to get it
- 1
Download the app
You'll need: PostgreSQL database
Show help after installing
postgrest --help - 2
Run it
- Follow the install guide at docs.postgrest.org for your platform, or use the Docker image
- Run postgrest --help to see the available options
- Point PostgREST at your existing PostgreSQL database and start the server
- Send an HTTP request to a table endpoint to confirm it returns data
- 3
Get the most out of it
- Put public-facing views in a dedicated schema to version your API without breaking clients
- Use declarative PostgreSQL constraints so the database rejects bad data regardless of the client
- Use JWT authentication and database roles to control what each authenticated user can do
- Use the generated OpenAPI documentation with Swagger-UI for interactive API exploration
Downloads
Strengths
- Uses the database as the source of truth for authorization and data validation
- Built in Haskell with pooled connections and binary protocol access, which the README says gives good response times
- Generates OpenAPI documentation automatically from the database structure
Trade-offs
- Performance claims in the README come from a single Heroku free-tier benchmark and should be verified for your own workload
- Its security and data-integrity model depends on correctly designing database roles and constraints, which takes SQL expertise
- The README is truncated here, so details of configuration and limitations are not covered in this entry
How it compares
| Project | Stars | Type | Level | Updated | Best for |
|---|---|---|---|---|---|
| postgrest (this) | 27.7k | App | intermediate | 6 days ago | Developers who already have a PostgreSQL database and want an HTTP API on top of it quickly |
| crystal | 12.9k | Framework | advanced | 4 days ago | Developers who have a PostgreSQL database and want an auto-generated GraphQL API |
| quivr | 39.6k | Framework | advanced | 4 days ago | Developers building a search or monitoring pipeline over a stream of documents |
| FlareSolverr | 16.1k | App | intermediate | 12 days ago | Developers whose scripts are blocked by Cloudflare challenges on pages they are allowed to access |
| usql | 10.2k | CLI | beginner | 4 days ago | Developers who use several different databases and want one tool for all of them |
| typeorm | 36.7k | Library | intermediate | 8 days ago | Node.js or TypeScript developers building apps backed by a relational database |
Stats synced from GitHub. The assessment above was drafted with AI from the project's README on 2026-10-29 and may miss recent changes — check the README before relying on a command. MIT licence: free to use, modify and distribute, including commercially, as long as you keep the copyright notice.