Postrust vs PostGraphile

PostGraphile generates a GraphQL API from a PostgreSQL schema and puts most of its effort into the quality of that schema and the plan behind it. V5's Gra*fast* engine plans a query once and executes it with far fewer round trips than a naive resolver tree.

It is also the most customisable of these tools. If you want to reshape the generated schema, PostGraphile expects that and has a plugin system built for it.

PostGraphile is written in
TypeScript / Node.js
Licence
MIT
Version compared
V5

Feature comparison

Where a capability has a condition attached, the condition is in the cell.

FeaturePostrustPostGraphile
GraphQL from the schemaYesYes
REST APIYes, PostgREST-compatibleNot supported
SubscriptionsOver LISTEN/NOTIFYBuilt in over LISTEN/NOTIFY; you define the fields
Schema customisationNot extensible at runtimePlugin system, the main design goal
Relay supportNoYes
PermissionsPostgreSQL roles and RLSPostgreSQL roles and RLS
RuntimeSingle static binaryNode.js
Custom logicRust handlers, or SQL functionsTypeScript plugins, or SQL functions
LicenseMITMIT

When PostGraphile is the better choice

  • You want to shape the GraphQL schema rather than accept what was generated. This is PostGraphile's central strength and Postrust has no answer to it.
  • Your team writes TypeScript and wants API extensions in the same language as the rest of the stack.
  • You want a Relay-compliant schema, or the connection and node-id conventions that come with it.
  • GraphQL is the API and REST is not needed.

When Postrust fits better

  • You want one process serving both REST and GraphQL.
  • You would rather deploy a static binary than a Node runtime.
  • The generated schema is fine as generated and extensibility is not what you are paying for.

Questions

Why do the GraphQL queries differ between the two in the benchmark?

Field names are inflected differently: Postrust exposes bench_items where PostGraphile exposes allBenchItems with a nodes wrapper. The request asks PostgreSQL for the same rows either way, and both queries are in the benchmark script.

Is Gra*fast* faster than what Postrust does?

Look at the measured table on this page rather than taking either project's word for it. Gra*fast* is a serious piece of engineering and the numbers are the numbers.

Try it against your own schema

Point it at a database and see what it generates. That is a shorter path than reading a comparison table.