Skip to content

Technology Database Generated APIs

mavrovde edited this page Nov 1, 2026 · 1 revision

Technology: Database-Generated APIs

Part of the Technology Evaluation. These tools generate an API directly from a database schema, promising "no custom code". This page explains why none of them is the primary design, and where some may still be useful later.

Why "no code" does not fit the core requirements

The API must provide:

  • priority tiers, admission control and load shedding;
  • RFC 9457 problem responses;
  • the licence gate with per-row post-checks and verbatim attribution;
  • a curated, domain-shaped OpenAPI 3.1 document;
  • no unbounded filters on time-series data.

A generated API mirrors the database and lets callers filter and sort freely. That is exactly what the Domain Model rules out.

Summary

Option Verdict Reason
PostgREST Rejected as primary; viable later for internal or bulk reads storage-shaped API, generic filters, no tiers or RFC 9457
pg_featureserv Rejected as the API; viable later as an OGC endpoint geo-only, no keys, gate or attribution model
pg_tileserv Rejected (out of scope) vector tiles, not a data API
Hasura Rejected GraphQL is not the product; heavy
Supabase (self-hosted) Rejected a whole platform that expects to own the database
PostGraphile Rejected GraphQL, same unbounded-query risk

PostgREST

  • What it is. A server that turns a PostgreSQL schema of tables, views and functions into REST, with roles taken from a JWT and filtering through query parameters.
  • Strengths. Almost no code; a licence gate could be expressed as grants per plan role; a role-level statement timeout is enforced on the server.
  • Weaknesses. Its OpenAPI output mirrors the database and appears to be Swagger 2.0; generic filters and ordering on time-series data invite sequential scans; no priority tiers or shedding; no RFC 9457; attribution would have to be baked into every view; it exposes the shape of storage. It also needs a key-to-JWT front.
  • Risk. Expensive filter combinations against a shared database.
  • Licence. MIT.
  • Verdict: Rejected as the primary option. Possibly useful later as an internal or bulk read path behind strict views.

pg_featureserv

  • What it is. An OGC API – Features server over PostGIS that emits GeoJSON and describes itself with OpenAPI.
  • Strengths. Standards-based and light.
  • Weaknesses. Geo collections only; no keys, tiers, licence gate or attribution model.
  • Licence. Apache-2.0.
  • Verdict: Rejected as the API. Possibly a later OGC endpoint for GIS customers, behind the API's own authentication.

pg_tileserv

  • A vector-tile server for PostGIS. Useful for maps, not for a REST data API.
  • Licence. Apache-2.0. Verdict: Rejected for this project (out of scope); noted for map work.

Hasura

  • A GraphQL engine with REST wrappers; its newer major version is a different, commercially oriented architecture.
  • Heavy, needs a metadata database, and GraphQL is not the product.
  • Verdict: Rejected.

Supabase (self-hosted)

  • A bundle of PostgreSQL, PostgREST, auth, realtime, storage, a gateway and a studio: many containers.
  • It assumes it owns the database; ViaFrei already has one.
  • Licence. Apache-2.0. Verdict: Rejected.

PostGraphile

  • A GraphQL server generated from a PostgreSQL schema.
  • GraphQL rather than REST, with the same unbounded-query risk.
  • Licence. MIT. Verdict: Rejected.

Sources

Home

About

Design

Data Model

Technical specification

Testing

Engineering

Technology choice

Reference

Clone this wiki locally