Skip to content

FirebirdREST

Serve a RESTful API from any Firebird database.

FirebirdREST is a standalone web server that turns a Firebird database into a REST API, in the spirit of PostgREST. Your tables, views, stored procedures and functions become endpoints, and the grants and roles you already have in Firebird decide what each caller may do. Because the API is derived from the schema, there is no API layer to write or maintain.

$ curl 'http://localhost:3000/books?select=title,price,authors(name)&price=lt.10&order=price.desc'
[
  {"title":"Guards! Guards!","price":9.99,"authors":{"name":"Terry Pratchett"}},
  {"title":"Small Gods","price":8.50,"authors":{"name":"Terry Pratchett"}},
  {"title":"A Wizard of Earthsea","price":7.25,"authors":{"name":"Ursula K. Le Guin"}}
]

Features

  • One static binary for Linux, macOS, Windows and FreeBSD. It talks the Firebird wire protocol directly, so no client library is needed.
  • PostgREST's URL grammar: select, filters, logic trees, ordering and paging.
  • Resource embedding through foreign keys: many-to-one, one-to-many, many-to-many, nested, !inner and spread (...rel(cols)).
  • Aggregates: count(), sum(), avg(), min(), max().
  • Computed fields and relationships from functions and procedures.
  • Writes: bulk inserts, upserts, PATCH, PUT and DELETE, returning the written rows on request.
  • Stored procedures and functions, including routines in packages.
  • Security through Firebird roles: a JWT's role claim selects the Firebird ROLE, and claims can be read in PSQL for row-level rules.
  • OpenAPI 3 description at /, CSV output, health endpoints, schema reload on POST_EVENT.
  • Realtime events: Firebird POST_EVENTs streamed to clients as Server-Sent Events, something PostgREST does not have.
  • Firebird 3, 4 and 5, all tested in CI, plus early testing against the Firebird 6 snapshot.
  • SQL schemas on Firebird 6 (experimental), chosen per request with Accept-Profile and Content-Profile.

Where to start

Install

Download an archive for your platform from the releases page, for example:

curl -L https://github.com/mariuz/firebirdrest/releases/download/v0.6.0/firebirdrest_0.6.0_linux_amd64.tar.gz | tar xz
./firebirdrest --version
docker run -p 3000:3000 \
  -e FBREST_DB_URI='authenticator:secret@db.example.com:3050/data/app.fdb' \
  -e FBREST_DB_ANON_ROLE=web_anon \
  ghcr.io/mariuz/firebirdrest:latest
go install github.com/mariuz/firebirdrest/cmd/firebirdrest@latest