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.
| Crate | Role | Links |
|---|---|---|
postrust-server | HTTP server | |
postrust-core | Engine | |
postrust-sql | SQL builder | |
postrust-auth | Authentication | |
postrust-response | Response formatting | |
postrust-engine | REST request pipeline | |
postrust-graphql | GraphQL | |
postrust-lambda | AWS Lambda | |
postrust-worker | Cloudflare Workers | |
postrust-proxy | Reverse proxy |
postrust-server
HTTP serverPostgREST-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-uipostrust-core
EngineRequest 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-corepostrust-sql
SQL builderType-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-sqlpostrust-auth
AuthenticationJWT 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-authpostrust-response
Response formattingResponse 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-responsepostrust-engine
REST request pipelineThe 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-enginepostrust-graphql
GraphQLGraphQL 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-graphqlpostrust-lambda
AWS LambdaAWS 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-lambdapostrust-worker
Cloudflare WorkersCloudflare 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-workerVersioning
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.