postrust-worker 1.1.0

Cloudflare Workers adapter for Postrust: the PostgREST-dialect REST API in a Worker, over Hyperdrive
Documentation

postrust-worker

Postrust's REST API in a Cloudflare Worker, reaching PostgreSQL through Hyperdrive.

  • The request pipeline is postrust-engine, the same one the server runs. The database driver speaks the PostgreSQL wire protocol over a Workers socket and is tested to answer exactly as the server's does.
  • Every request runs in a transaction that takes on the token's role and claims, so row-level security applies as it does on the server.
  • The schema cache is kept in Workers KV. It is refreshed by a Cron Trigger, by an authenticated POST /_/reload, or when the KV copy expires after PGRST_WORKER_SCHEMA_TTL.
  • REST only, served at the root as PostgREST serves it. There is no GraphQL and no LISTEN/NOTIFY.

Setup, configuration, measured costs and limits: docs/workers.md. The crate is built with worker-build for wasm32-unknown-unknown; for any other target it is only its configuration logic, there to be unit-tested.

From 1.0.0 this crate keeps semver over what a deployment sees -- the variables it reads, the bindings it looks for, its endpoints and defaults -- on a version of its own. See docs/stability.md.

Part of Postrust

Postrust turns a PostgreSQL database into a REST and GraphQL API. It is published as a set of crates so you can depend on only the part you need:

Crate Role Docs
postrust-server HTTP server docs.rs
postrust-core Engine docs.rs
postrust-sql SQL builder docs.rs
postrust-auth Authentication docs.rs
postrust-response Response formatting docs.rs
postrust-graphql GraphQL docs.rs
postrust-lambda AWS Lambda docs.rs
postrust-engine REST request pipeline docs.rs
postrust-worker (this crate) Cloudflare Workers docs.rs
postrust-proxy Reverse proxy docs.rs

Links

License

MIT -- see LICENSE.