Instant high-performance GraphQL API for your PostgreSQL database
5M+
You're looking at the README for PostGraphile V4 β stable but feature-frozen.
PostGraphile V5 beta is nearing completion and has frequent releasesβ !
Production-ready and already powering many apps, V5 is a complete ground-up rewrite powered by Grafastβ , our cutting-edge planning and execution engine for GraphQL. It dramatically reduces Postgres load, supports true polymorphism, and introduces incremental delivery, executable schema exports, greater control over your schema, and much more. Its efficient and ergonomic extensibility guides you into the pit of success. It even introduces an "eject button" for when you feel the need to move beyond an autogenerated schema!
V5 remains in "beta" while we finalize the APIs, so minor adjustments may be needed between updates. Postgres-centric users who leverage trusted documentsβ (highly recommended!) should experience particularly smooth sailing!
Instant lightning-fast GraphQL API backed primarily by your PostgreSQL database. Highly customisable and extensible thanks to incredibly powerful plugin system. Formerly "PostGraphQL".
To help us develop this software sustainably, we ask all individuals and businesses that use it to help support its ongoing maintenance and development via sponsorship.
And please give some love to our featured sponsors π€©:
* Sponsors the entire Graphile suite
GraphQL is a new way of communicating with your server. It eliminates the problems of over- and under-fetching, incorporates strong data types, has built-in introspection, documentation and deprecation capabilities, and is implemented in many programming languages. This all leads to gloriously low-latency user experiences, better developer experiences, and much increased productivity. Because of all this, GraphQL is typically used as a replacement for (or companion to) RESTful API services.
PostgreSQL is the self-proclaimed βworldβs most advanced open source
database,β with each new release bringing more amazing features and performance
gains. Thinking of your database as a plain CRUD store is now an archaic
viewpoint as modern PostgreSQL can do so much for you β from authorization
with Row-Level Security (RLS, introduced in PG9.5), through Foreign Data
Wrappers (FDW), to real time notifications with LISTEN/NOTIFY.
PostGraphile pairs these two incredible technologies together, helping you not only build applications more rapidly, but to build lightning-fast applications. PostGraphile allows you to access the power of PostgreSQL through a well designed, extensible, customisable and incredibly performant GraphQL server. It automatically detects tables, columns, indexes, relationships, views, types, functions, comments, and more - providing a GraphQL server that is highly intelligent about your data, and that automatically updates itself without restarting when you change your database schema.
With PostGraphile, a well designed database schema should serve the basis for a well thought out API. PostgreSQL already has amazing authorization and relationship infrastructure, why duplicate that logic in a custom API? A PostGraphile API is likely to provide a more performant and standards compliant GraphQL API than any created in-house, and can be built in a fraction of the time. Focus on your product and let PostGraphile worry about the API layer. Once you need to expand beyond this, we have a powerful plugin system including many community contributed pluginsβ . For a critical evaluation of PostGraphile to determine if it fits in your tech stack, read evaluating PostGraphile for your projectβ .
Watch a talk by the original author Calebβ at GraphQL Summit for a walk-through of building an application with PostGraphile in under 7 minutes. This was using v2 (then called PostGraphQL); we're now up to v4 which has many more bells and whistles!
Hear from the current maintainer Benjieβ at GraphQL Finland about the benefits of Database-Driven GraphQL Development:
Documentation: graphile.org/postgraphileβ
You can use PostGraphile via the CLI, as a Node.js middleware, or use the GraphQL schema directly. Make sure to check out the full usage instructionsβ on the documentation website. We also have a PostgreSQL schema design guideβ you can follow to build a fully functional PostGraphile API.
To get started you can install PostGraphile globally:
npm install -g postgraphile
β¦and then just run it! By default, PostGraphile will connect to your local
database at postgres://localhost:5432 and introspect the public schema. See
the available CLI flagsβ
with:
postgraphile --help
When you're ready to use PostGraphile for your own project, you're advised to
install it locally with yarn, and run it with npx:
yarn add postgraphile
npx postgraphile --help
macOS users: PostGraphile has used port 5000 by default for 5+ years;
recently Apple decided to bind the AirPlay service to port 5000 causing a
conflict. Please use the --port option to bind to a different port.
You can also use PostGraphile as native HTTP, Connect, Express, or Koa (experimental) middlewareβ , e.g.:
yarn add postgraphile
import { createServer } from 'http';
import postgraphile from 'postgraphile';
createServer(postgraphile());
Check out hapi-postgraphileβ if you're interested in using PostGraphile as a hapiβ server plugin.
To run via Docker, simply pass the CLI optionsβ to the Docker container:
docker pull graphile/postgraphile
docker run --init graphile/postgraphile --help
E.g. you might run this command (substituting the relevant variables):
docker run --init -p 5000:5000 graphile/postgraphile --connection postgres://POSTGRES_USER:POSTGRES_PASSWORD@POSTGRES_HOST:POSTGRES_PORT/POSTGRES_DATABASE --schema app_public --watch
macOS users: Please use a different port to avoid conflict with AirPlay.
Full documentation for PostGraphile is located at graphile.org/postgraphileβ .
PostGraphile features include:
--watch mode, auto-detects changes in SQL schema, hot-reloads changes into
GraphiQLCOMMENTsβ nodeId by default, but Relay-favoured id with
--classic-ids)Full requirements are on the websiteβ , but a basic summary is:
Caveats:
The fastest and easiest way you can help PostGraphile thrive is by sponsoring ongoing development and maintenanceβ .
Want to help testing and developing PostGraphile? Check out the contributing documentβ to get started quickly!
Commercial support, consultancy and development services are available direct from the maintainer; see Professional Servicesβ for more information, or get in touch!
The maintainer of this project is @Benjieβ - follow him on Twitter!
Huge thanks to the individuals and companies who sponsor PostGraphile's developmentβ - their financial contributions enable more time to be spent on the project: from bug fixes, to code review, to new features! If you want to help the project advance more rapidly, please join them in supporting this projectβ π
A humongous, heart-felt, thank you to the original author of PostGraphile - Caleb Meredithβ - for everything he put into PostGraphile! He's now graduated from the project and we all wish him the best for his future ventures!
Thanks also to the people working on PostgRESTβ which was a huge inspiration for this project!
Thanks and enjoy π
Content type
Image
Digest
sha256:1b0b7bb03β¦
Size
119 MB
Last updated
over 1 year ago
docker pull graphile/postgraphile