PostgREST/postgrest
PostgREST/postgrest has 27,743 GitHub stars and 1,238 forks. GitHot measured -2 stars in 24 hours. Last checked 2026-11-08 23:08 UTC. Last push 2026-11-03.
适用于任何 Postgres 数据库的 REST API
实测星标增长
- 24小时
- -2
- 7天
- 正在收集历史
- 15天
- 正在收集历史
- 1个月
- 正在收集历史
各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。
README.md
原文
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.
Sponsors
|
|
|
|
|
|
Big thanks to our sponsors! You can join them by supporting PostgREST on Patreon.
Usage
See the docs for how to install PostgREST on your platform. You can also use Docker.
Invoke for help:
postgrest --help
Documentation
Latest documentation is at postgrest.org. You can contribute to the docs in PostgREST/postgrest/docs.
Performance
TLDR; subsecond response times for up to 2000 requests/sec on Heroku free tier. If you're used to servers written in interpreted languages, prepare to be pleasantly surprised by PostgREST performance.
Three factors contribute to the speed. First the server is written in Haskell using the Warp HTTP server (aka a compiled language with lightweight threads). Next it delegates as much calculation as possible to the database including
- Serializing JSON responses directly in SQL
- Data validation
- Authorization
- Combined row counting and retrieval
- Data post in single command (
returning *)
Finally it uses the database efficiently with the Hasql library by
- Keeping a pool of db connections
- Using the PostgreSQL binary protocol
- Being stateless to allow horizontal scaling
Security
PostgREST handles authentication (via JSON Web Tokens) and delegates authorization to the role information defined in the database. This ensures there is a single declarative source of truth for security. When dealing with the database the server assumes the identity of the currently authenticated user, and for the duration of the connection cannot do anything the user themselves couldn't. Other forms of authentication can be built on top of the JWT primitive. See the docs for more information.
Versioning
A robust long-lived API needs the freedom to exist in multiple versions. PostgREST does versioning through database schemas. This allows you to expose tables and views without making the app brittle. Underlying tables can be superseded and hidden behind public facing views.
Self-documentation
PostgREST uses the OpenAPI standard to generate up-to-date documentation for APIs. You can use a tool like Swagger-UI to render interactive documentation for demo requests against the live API server.
This project uses HTTP to communicate other metadata as well. For instance the number of rows returned by an endpoint is reported by - and limited with - range headers. More about that.
Data Integrity
Rather than relying on an Object Relational Mapper and custom imperative coding, this system requires you to put declarative constraints directly into your database. Hence no application can corrupt your data (including your API server).
The PostgREST exposes HTTP interface with safeguards to prevent surprises, such as enforcing idempotent PUT requests.
See examples of PostgreSQL constraints and the API guide.
Supporting development
You can help PostgREST ongoing maintenance and development by making a regular donation through Patreon https://www.patreon.com/postgrest
Every donation will be spent on making PostgREST better for the whole community.
Contributing
Contributions are always welcome and appreciated. Please see the Contributing guidelines.
Thanks
The PostgREST organization is grateful to:
- The project sponsors and backers who support PostgREST's development.
- The project contributors who have improved PostgREST immensely with their code and good judgement. See more details in the changelog.
The cool logo came from Mikey Casalaina.
探索相关项目
Asabeneh/30-Days-Of-Python
30 Days of Python 编程挑战是一份循序渐进的指南,用于在 30 天内学习 Python 编程语言。这项挑战可能需要超过 100 天。请按自己的节奏进行。这些视频或许也有帮助:https://www.youtube.com/channel/UC7PNRuno1rzYPb1xLa4yktw
78,370 星标grafana/grafana
开放且可组合的可观测性与数据可视化平台。可对来自 Prometheus、Loki、Elasticsearch、InfluxDB、Postgres 等众多数据源的指标、日志和追踪进行可视化。
77,763 星标redis/redis
对于正在构建实时数据驱动应用的开发者而言,Redis 是首选、速度最快且功能最丰富的缓存、数据结构服务器和文档与向量查询引擎。
77,288 星标apache/superset
Apache Superset 是一个数据可视化与数据探索平台
75,453 星标