Skip to content

postgrest

Standalone server that turns a PostgreSQL schema into a REST API for backend developers

Permissive (OSI) · MIT
  • macOS
  • Linux
  • CLI

Listed by , founder & editor

85

Health

Thriving

Overview

Stars

27,764

Last commit

today

Nov 2026

Repository age

12 years

since Jun 2014

Latest version

v16.6

Nov 2026

Contributors

–

6 active in 90 days

Releases

24

last 12 months

Language

Haskell

PostgREST is a web server written in Haskell that reads your PostgreSQL database and serves it as a RESTful API. Tables, views, constraints and role permissions in the database decide which endpoints exist and what each caller can do. You write no separate API layer.

It authenticates requests with JSON Web Tokens and hands authorization to database roles. The server assumes the identity of the authenticated user while handling a request, so the database stays the single source of truth for security. Much of the work, such as JSON serialization and validation, runs in SQL. The server is stateless, keeps a pool of connections and can scale horizontally.

You can version an API through database schemas and expose views over underlying tables. It generates OpenAPI documentation that tools like Swagger-UI can render. It runs on Linux and macOS, installs through Homebrew or Docker, and is MIT licensed.

It works as a self-hosted alternative to backend-as-a-service products that offer an instant API over a database, though it covers the API layer only.

Who it's for

Backend developers building on PostgreSQL

You keep business rules in constraints and roles, and the API follows the schema.

Skip if: You need custom server-side logic in an application language for most endpoints.

Small teams that want a hosted-BaaS style API on their own server

You get a ready REST layer over your database without paying for a hosted service.

Skip if: You also need built-in user management, file storage or realtime features.

Teams that want one declarative security model

Authorization lives in database roles, so there is no second permission system to maintain.

Skip if: Your data is not in PostgreSQL.

The problem it solves

Writing and maintaining a CRUD API on top of a database is repetitive and easy to get subtly wrong. PostgREST generates that API from the schema you already have, so rules live in one place.

Strengths

  • Endpoints and permissions come directly from database structure and roles
  • JWT authentication with authorization delegated to PostgreSQL roles
  • Stateless server with connection pooling allows horizontal scaling
  • Generates OpenAPI documentation for the live API
  • MIT license with 24 releases in the last year

Trade-offs

  • Works only with PostgreSQL
  • Logic beyond SQL, views and functions needs another service
  • Provides the API layer only, not auth UI, storage or realtime
  • Requires solid knowledge of PostgreSQL roles and schemas

Self-host postgrest

Self-hostable
Yes

Quick start

postgrest --help

From the project's own install instructions. Check the docs for production settings.

Frequently asked questions

Is PostgREST free?

Yes. It is MIT licensed and free to use, including commercially.

Can I self-host it?

Yes. It is a standalone server you run yourself, and Docker is supported.

Which platforms does it run on?

Linux and macOS, as a command-line binary. A Homebrew formula is available.

How does it handle authentication?

It validates JSON Web Tokens and then acts as the matching database role for each request.

Does it document the API?

Yes. It generates OpenAPI documentation that you can render with Swagger-UI.

Similar tools in Backend as a service

Kuzzle

Backend as a service

Generic backend with realtime API, search and user management for web and IoT apps

1.7k 135 today Active Apache-2.0

Kinto

Backend as a service

Minimalist JSON storage service with sync and sharing for developers building apps

4.4k 443 today Thriving Apache-2.0

daptin

Backend as a service

Self-hosted Go backend that turns a data schema into APIs, auth and automation

1.9k 122 today Active LGPL-3.0

TrailBase

Backend as a service

Single-binary Rust backend with auth and REST APIs for app developers

5.8k 201 3 days ago Active OSL-3.0

Replaces Firebase

Instant

Backend as a service

Real-time, offline-first client database with auth and permissions for frontend developers

11k 430 19 days ago Slowing Apache-2.0

InsForge AI

Backend as a service

Self-hostable Postgres backend with auth, storage and AI gateway for coding agents

13k 1.3k 4 days ago Thriving Apache-2.0