Packages

Postrust is published to crates.io as a set of crates, so you can run the whole server or depend on only the piece you need. All of them are released together; the eight stable crates share a version.

CrateRoleLinks
postrust-serverHTTP server
postrust-coreEngine
postrust-sqlSQL builder
postrust-authAuthentication
postrust-responseResponse formatting
postrust-engineREST request pipeline
postrust-graphqlGraphQL
postrust-lambdaAWS Lambda
postrust-workerCloudflare Workers
postrust-proxyReverse proxy

postrust-server

HTTP server
Start here

PostgREST-compatible REST and GraphQL API server for PostgreSQL, built on Axum.

  • Ships the postrust binary — one executable, no runtime dependencies
  • REST, GraphQL and an optional admin UI
  • Configured entirely through environment variables
cargo install postrust-server --features admin-ui

postrust-core

Engine

Request parsing, query planning and schema introspection for Postrust.

  • Parses select, limit, offset, order, filters and embedding
  • Introspects your schema and plans reads, mutations and RPC calls
  • Builds parameterised SQL cast to the right column types
cargo add postrust-core

postrust-sql

SQL builder

Type-safe SQL fragment and statement builder used by Postrust.

  • Composable SELECT, INSERT, UPDATE and DELETE builders
  • Placeholder renumbering when fragments combine
  • Identifier escaping and qualified names
cargo add postrust-sql

postrust-auth

Authentication

JWT authentication and role resolution for Postrust.

  • Verifies JWTs with plain or base64 secrets
  • Resolves the PostgreSQL role per request
  • Passes claims through as GUCs for row-level security
cargo add postrust-auth

postrust-response

Response formatting

Response formatting for Postrust: JSON, CSV, and OpenAPI output.

  • Content negotiation between JSON and CSV
  • Content-Range headers for pagination and counts
  • OpenAPI description of the exposed schema
cargo add postrust-response

postrust-engine

REST request pipeline

The REST request pipeline of Postrust, from HTTP request to response, independent of any web framework and of the database driver.

  • Authentication, parsing, planning and execution in one call
  • Each request in a transaction carrying the token's role and claims
  • Runs on the server over sqlx and in a Cloudflare Worker over a socket
cargo add postrust-engine

postrust-graphql

GraphQL

GraphQL API and realtime subscriptions generated from a PostgreSQL schema.

  • Schema built from tables, views and relationships
  • Queries, mutations, filtering and ordering
  • Subscriptions over PostgreSQL LISTEN/NOTIFY
cargo add postrust-graphql

postrust-lambda

AWS Lambda

AWS Lambda adapter for Postrust, serving its REST and GraphQL APIs over PostgreSQL.

  • The server's own router, behind a function URL or API Gateway
  • Schema cache loaded once per sandbox, in the init phase
  • Tested in AWS's provided:al2023 runtime image against row-level security
cargo add postrust-lambda

postrust-worker

Cloudflare Workers

Cloudflare Workers adapter: the REST API in a Worker, reaching PostgreSQL through Hyperdrive.

  • The server's own request pipeline, over a socket driver tested to answer as the server's does
  • The token's role and claims on every request, so row-level security applies unchanged
  • Schema cache in Workers KV, refreshed by a Cron Trigger or POST /_/reload
git clone https://github.com/postrust/postrust && cd postrust/crates/postrust-worker

postrust-proxy

Reverse proxy

Reverse proxy for Postrust with load balancing and automatic TLS certificates.

  • Load balances across multiple Postrust backends
  • Automatic certificate issuance and renewal via ACME
  • Multi-tenant custom domains
cargo add postrust-proxy

Versioning

The eight stable crates share the workspace version and carry a semver promise: a breaking change to the public Rust API needs a major bump. Any two of them at the same version are known to work together, so pin them to the same version in your Cargo.toml. postrust-worker keeps semver on a version of its own, over its configuration, bindings and endpoints; postrust-proxy is on its own 0.x line, with no stability promise. All of them are published together from the same v* tags.