PostgREST โ€“ Serve a RESTful API from Any Postgres Database

This page summarizes the projects mentioned and recommended in the original post on news.ycombinator.com

SurveyJS - Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App
With SurveyJS form UI libraries, you can build and style forms in a fully-integrated drag & drop form builder, render them in your JS app, and store form submission data in any backend, inc. PHP, ASP.NET Core, and Node.js.
surveyjs.io
featured
InfluxDB - Power Real-Time Data Analytics at Scale
Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
www.influxdata.com
featured
  • django-rest-framework

    Web APIs for Django. ๐ŸŽธ

  • postgrest

    REST API for any Postgres database

  • At work, we've finally replaced a large part of a custom (mostly-)web backend with PostgREST recently, and that's quite a relief: considerably less code to maintain in that project now, and that was a rather awkward code. Something akin to PostgREST's "Embedding with Top-level Filtering" [1] had to be provided for all the tables, with OpenAPI schema and a typed API (Haskell + Servant); I avoided manually writing it all down, but at the cost of poking framework internals, and maintainability suffered. It was particularly annoying that the code doesn't really do anything useful, except for standing between a database and an HTTP client, and simply mimics the database anyway. Whenever a change had to be introduced, it was introduced into the database, the backend, and the frontend simultaneously, so it wasn't even useful for some kind of compatibility.

    Now PostgREST handles all that, and only a few less trivial endpoints are handled by a custom backend (including streaming, which I'm considering replacing with postgrest-websocket [2] at some point).

    During the switch to PostgREST, the encountered minor issues were those with inherited tables (had to set a bunch of computed/virtual columns [3] in order to "embed" those), and with a bug on filtering using such relations (turned out it was an already-fixed regression [4], so an update helped). Also a couple of helper stored procedures (to use via /rpc/) for updates in multiple tables at once (many-to-many relationships, to edit entities along with their relationships, using fewer requests) were added (though the old custom backend didn't have that), the security policies were set from the beginning, the frontend was rewritten (which allowed to finally switch without adding more work), so it was only left to cleanup the backend.

    Not using views, since as mentioned above, database changes usually correspond to frontend changes, and the API doesn't have to be that stable yet.

    Happy with it so far.

    [1] https://postgrest.org/en/stable/api.html#embedding-with-top-...

    [2] https://github.com/diogob/postgres-websockets

    [3] https://postgrest.org/en/stable/api.html#computed-virtual-co...

    [4] https://github.com/PostgREST/postgrest/issues/2530

  • SurveyJS

    Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App. With SurveyJS form UI libraries, you can build and style forms in a fully-integrated drag & drop form builder, render them in your JS app, and store form submission data in any backend, inc. PHP, ASP.NET Core, and Node.js.

    SurveyJS logo
  • pocketbase

    Open Source realtime backend in 1 file

  • Absolutely love pocketbase.

    And, interesting to note that using stored procedures within pocketbase isn't well supported because they do a dry run insert to check against constraints and then delete it if the constant fails.

    https://github.com/pocketbase/pocketbase/discussions/650#dis...

    I mention this because the OP inquired about stored procedures.

    Still, pocketbase is so amazing.

  • react-admin

    A frontend Framework for building data-driven applications running on top of REST/GraphQL APIs, using TypeScript, React and Material Design

  • 1 year ago: https://news.ycombinator.com/item?id=29389576

    It's an insanely cool project, but I've yet to find a truly fitting use case for it. In theory, PostgREST combined with something like https://marmelab.com/react-admin/ should give you a free back-end and admin panel for most projects, but in practice, I've always found that all kinds of 'small details' won't be quite right out of the box, and that customization is really hard...

  • graphile-engine

    Monorepo home of graphile-build, graphile-build-pg, graphile-utils, postgraphile-core and graphql-parse-resolve-info. Build a high-performance easily-extensible GraphQL schema by combining plugins!

  • crystal

    ๐Ÿ”ฎ Graphile's Crystal Monorepo; home to Grafast, PostGraphile, pg-introspection, pg-sql2 and much more! (by graphile)

  • I was about to say โ€œbut this one is!โ€ and realized I had confused PostgREST with PostGraphile. If youโ€™re interested in GraphQL, you can check out PostGraphile here: https://github.com/graphile/postgraphile

  • Directus

    The Modern Data Stack ๐Ÿฐ โ€” Directus is an instant REST+GraphQL API and intuitive no-code data collaboration app for any SQL database.

  • Directus is actually one. You get the front end which is basically an admin UI, but you also get a full blown fully featured REST API

    https://directus.io/

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

    InfluxDB logo
  • auth

    A JWT based API for managing users and issuing JWT tokens (by supabase)

  • we integrated Gotrue with PostgREST at Supabase and it works beautifully together https://github.com/supabase/gotrue (forked from Netlify)

  • postgresql-replicant

    A streaming PostgreSQL logical replication client library for Haskell

  • You can use a library like https://github.com/agentultra/postgresql-replicant or similar to hook in a data plane and use PostgREST as a data plane.

    Your business logic works on the event stream that comes from the WAL.

  • postgrest-starter-kit

    Discontinued Starter Kit and tooling for authoring REST API backends with PostgREST

  • I think the recommended way to use Postgrest is to put a layer of views and optionally stored functions on top of your schema to decouple it from your API. Take a look at this Postgrest starter kit[1] which uses a separate API schema for this purpose.

    [1] https://github.com/subzerocloud/postgrest-starter-kit

  • postgres-websockets

    PostgreSQL + Websockets

  • At work, we've finally replaced a large part of a custom (mostly-)web backend with PostgREST recently, and that's quite a relief: considerably less code to maintain in that project now, and that was a rather awkward code. Something akin to PostgREST's "Embedding with Top-level Filtering" [1] had to be provided for all the tables, with OpenAPI schema and a typed API (Haskell + Servant); I avoided manually writing it all down, but at the cost of poking framework internals, and maintainability suffered. It was particularly annoying that the code doesn't really do anything useful, except for standing between a database and an HTTP client, and simply mimics the database anyway. Whenever a change had to be introduced, it was introduced into the database, the backend, and the frontend simultaneously, so it wasn't even useful for some kind of compatibility.

    Now PostgREST handles all that, and only a few less trivial endpoints are handled by a custom backend (including streaming, which I'm considering replacing with postgrest-websocket [2] at some point).

    During the switch to PostgREST, the encountered minor issues were those with inherited tables (had to set a bunch of computed/virtual columns [3] in order to "embed" those), and with a bug on filtering using such relations (turned out it was an already-fixed regression [4], so an update helped). Also a couple of helper stored procedures (to use via /rpc/) for updates in multiple tables at once (many-to-many relationships, to edit entities along with their relationships, using fewer requests) were added (though the old custom backend didn't have that), the security policies were set from the beginning, the frontend was rewritten (which allowed to finally switch without adding more work), so it was only left to cleanup the backend.

    Not using views, since as mentioned above, database changes usually correspond to frontend changes, and the API doesn't have to be that stable yet.

    Happy with it so far.

    [1] https://postgrest.org/en/stable/api.html#embedding-with-top-...

    [2] https://github.com/diogob/postgres-websockets

    [3] https://postgrest.org/en/stable/api.html#computed-virtual-co...

    [4] https://github.com/PostgREST/postgrest/issues/2530

  • roapi

    Create full-fledged APIs for slowly moving datasets without writing a single line of code.

  • > why not just accept SQL and cut out all the unnecessary mapping?

    You might be interested in what we're building: Seafowl, a database designed for running analytical SQL queries straight from the user's browser, with HTTP CDN-friendly caching [0]. It's a second iteration of the Splitgraph DDN [1] which we built on top of PostgreSQL (Seafowl is much faster for this use case, since it's based on Apache DataFusion + Parquet).

    The tradeoff for allowing the client to run any SQL vs a limited API is that PostgREST-style queries have a fairly predictable and low overhead, but aren't as powerful as fully-fledged SQL with aggregations, joins, window functions and CTEs, which have their uses in interactive dashboards to reduce the amount of data that has to be processed on the client.

    There's also ROAPI [2] which is a read-only SQL API that you can deploy in front of a database / other data source (though in case of using databases as a data source, it's only for tables that fit in memory).

    [0] https://seafowl.io/

    [1] https://www.splitgraph.com/connect

    [2] https://github.com/roapi/roapi

  • seafowl

    Analytical database for data-driven Web applications ๐Ÿชถ

  • > why not just accept SQL and cut out all the unnecessary mapping?

    You might be interested in what we're building: Seafowl, a database designed for running analytical SQL queries straight from the user's browser, with HTTP CDN-friendly caching [0]. It's a second iteration of the Splitgraph DDN [1] which we built on top of PostgreSQL (Seafowl is much faster for this use case, since it's based on Apache DataFusion + Parquet).

    The tradeoff for allowing the client to run any SQL vs a limited API is that PostgREST-style queries have a fairly predictable and low overhead, but aren't as powerful as fully-fledged SQL with aggregations, joins, window functions and CTEs, which have their uses in interactive dashboards to reduce the amount of data that has to be processed on the client.

    There's also ROAPI [2] which is a read-only SQL API that you can deploy in front of a database / other data source (though in case of using databases as a data source, it's only for tables that fit in memory).

    [0] https://seafowl.io/

    [1] https://www.splitgraph.com/connect

    [2] https://github.com/roapi/roapi

  • nix

    Nix, the purely functional package manager

  • https://github.com/PostgREST/postgrest/tree/main/nix

    I couldn't for the life of me figure out how to play with this. I kind of don't believe "docker build ." is worse but I might be missing something.

    After I ejected out of playing with it on Mac OS, I found: https://github.com/NixOS/nix/issues/458#issuecomment-1019743...

    Over 13 parts to remove NixOS from Mac OS, involving reboots, /etc/fstab, OS level users, daemons, etc.

  • One of the project which list all the data for entreprise addresses uses Postgrest (open data SIRENE de l'INSEE).

    Full fledge project implemented, interesting use of PostgREST

    https://github.com/etalab/annuaire-entreprises-sirene-api

  • datasette

    An open source multi-tool for exploring and publishing data

  • pREST

    PostgreSQL โž• REST, low-code, simplify and accelerate development, โšก instant, realtime, high-performance on any Postgres application, existing or new

  • Pretty sure I started with this: https://github.com/prest/prest/blob/main/cmd/root.go

    And from there you can execute your own command and add handlers or other things as you wish.

  • SQLAlchemy

    The Database Toolkit for Python

  • showcase

    REST api for your database (PostgreSQL/Sqlite/ClickHouse/MySQL).

  • Soon (in the works now, it will be particularly interesting in the context of cloudflare workers talking to planetscale)

    https://github.com/subzerocloud/showcase

  • SaaSHub

    SaaSHub - Software Alternatives and Reviews. SaaSHub helps you find the best software and product alternatives

    SaaSHub logo
NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts

  • The API database architecture โ€“ Stop writing HTTP-GET endpoints

    11 projects | news.ycombinator.com | 10 May 2024
  • PostgREST: Providing HTML Content Using Htmx

    12 projects | news.ycombinator.com | 18 Dec 2023
  • Auto generating API schema code?

    5 projects | /r/PostgreSQL | 29 Aug 2021
  • DB2Rest VS postgrest - a user suggested alternative

    2 projects | 8 Jan 2024
  • Starter Kit and tooling for authoring REST API back ends for PostgREST

    1 project | news.ycombinator.com | 15 Jun 2023