Open-source engine that instantly exposes databases such as PostgreSQL, MongoDB and SQL Server as a secure GraphQL API with fine-grained access control.
PostgREST/postgrest
A standalone server that turns any existing PostgreSQL database into a RESTful API with no backend code to write.
- Stars
- 27,726
- Forks
- 1,234
- Open issues
- 410
- Last commit
- 18 hours ago
What is it?
PostgREST serves a fully RESTful API from an existing PostgreSQL database. Tables, views and functions in the database are exposed over HTTP, so developers can skip writing a custom API layer for basic CRUD and querying.
Most of the work is delegated to the database. Responses are serialized as JSON in SQL, authorization follows the PostgreSQL roles defined in the database, and data validation relies on the database's constraints. Authentication is handled via JSON Web Tokens, and the server runs each request as the authenticated database user. API versioning is done through database schemas, and OpenAPI documentation is generated automatically.
The server is written in Haskell, uses a connection pool, and is stateless, so it can be scaled horizontally. It is available as a binary for several platforms and as a Docker image.
Key features
- 01Generates a REST API automatically from tables, views and functions in a PostgreSQL database.
- 02Delegates authorization to database roles and authentication to JWT.
- 03Generates OpenAPI documentation for the API.
- 04Supports API versioning through database schemas.
- 05Returns row counts and paginated results through HTTP range headers.
- 06Runs as a stateless server with a database connection pool.
Use cases
- Building a quick CRUD backend on top of an existing PostgreSQL schema.
- Exposing a stable public API through database views while the underlying tables change.
- Providing a data API for a frontend app without writing server-side endpoints.
Quick start
- 1
Read the install docs for your platform (or use Docker)
- 2
Check the available options with the help command
postgrest --help
Things to know
- Requires an existing PostgreSQL database; it does not provide one.
- Authorization depends on database roles and schema design, so security must be configured in PostgreSQL.
Topics
FAQ
- What is postgrest?
- A standalone server that turns any existing PostgreSQL database into a RESTful API with no backend code to write. PostgREST serves a fully RESTful API from an existing PostgreSQL database. Tables, views and functions in the database are exposed over HTTP, so developers can skip writing a custom API layer for basic CRUD and querying.
- Is postgrest free to use? What license does it have?
- postgrest is open source under the MIT license. Check the license terms before using it in commercial products.
- Is postgrest still maintained?
- Actively maintained. The last commit to postgrest was on Oct 20, 2026.
- What can I use postgrest for?
- Building a quick CRUD backend on top of an existing PostgreSQL schema. Exposing a stable public API through database views while the underlying tables change. Providing a data API for a frontend app without writing server-side endpoints.
- How do I install postgrest?
- Read the install docs for your platform (or use Docker) Check the available options with the help command: postgrest --help
- Where can I get postgrest?
- The source code and installation instructions are on GitHub: https://github.com/PostgREST/postgrest
Summary generated by AI from the project's README. GitHub stats refresh daily.
Related projects
The Postgres development platform, offering a hosted Postgres database with auth, auto-generated APIs, storage and realtime features as a Firebase alternative.
A self-hostable, open-source alternative to Airtable that turns SQL databases like PostgreSQL, MySQL and SQLite into a spreadsheet-style interface with auto-generated APIs.
Generates API client SDKs, server stubs, and docs in dozens of languages and frameworks from OpenAPI specs (v2 and v3).
A full-stack web app template combining a FastAPI backend, React frontend, PostgreSQL database and Docker Compose setup.
A toolkit for building Web APIs on top of Django, with serialization, authentication policies, viewsets, and a browsable API.