Giter Site home page Giter Site logo

gridl / postgraphile Goto Github PK

View Code? Open in Web Editor NEW

This project forked from graphile/crystal

0.0 1.0 0.0 5.03 MB

Execute one command (or mount one Node.js middleware) and get an instant high-performance GraphQL API for your PostgreSQL database!

Home Page: https://graphile.org/postgraphile

License: MIT License

Dockerfile 0.12% JavaScript 41.95% Shell 1.48% TypeScript 56.14% HTML 0.24% CSS 0.06%

postgraphile's Introduction

PostGraphile

Patreon donate button Discord chat room Package on npm MIT license Follow

An instant, highly-performant GraphQL API for your PostgreSQL database, extensible via a powerful plugin system.

Documentation: graphile.org/postgraphile

Note: v1-v3 of this project were named PostGraphQL. A v3-v4 migration guide is available here and you can check out some of the new features here. No more development is taking place on v3, but you can still access its branch here.


GraphQL is a powerful new way to query your servers - it's typically used as a replacement for, or companion to, RESTful API services. Introduced by Facebook in 2015, it features strong data typing, built in introspection and documentation capabilities, and solves among many other things the problems of over- and under-fetching data. It's particularly great for mobile clients where minimizing number of requests, latency, and payload size are all critically important tasks - but this awesome mobile experience makes regular webpages much smoother too.

PostgreSQL is the self-proclaimed “world’s most advanced open source database,” and despite its over 20 year maturity this still rings true. New versions of PostgreSQL are released regularly, and each new major version brings incredible new features, not to mention massive performance gains. Seeing your database as just a plain CRUD store is now an archaic viewpoint, modern PostgreSQL can do so much for you: from enforcing business logic with Role-Based Access Control (RBAC) and Row-Level Security (RLS), through communicating with other systems via Foreign Data Wrappers, to real time notifications with LISTEN/NOTIFY, PostgreSQL can handle it all with ease.

PostGraphile pairs these two incredible technologies together to help you not only build applications more rapidly, but to build faster applications! Access the power of PostgreSQL through a well designed, extensible, customisable and incredibly performant GraphQL server. PostGraphile uses PostgreSQL reflection APIs to automatically detect tables, columns, indexes, relationships, views, types, functions, comments, and more - providing a GraphQL server that is highly intelligent about your data. PostGraphile can automatically detect changes to your database (e.g. new columns or tables) and instantly rebuild and serve the updated GraphQL API - even updating GraphiQL automatically! This leads to incredible productivity gains, and helps developers multiply their impact.

With PostGraphile, a well designed database schema should be all you need to serve a well thought out API; and if it isn't - well, we have a powerful plugin system including many community contributed plugins! 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 then 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.

For a critical evaluation of PostGraphile to determine if it fits in your tech stack, read evaluating PostGraphile for your project.

Introduction

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!

PostGraphile at GraphQL Summit

Usage

Documentation: graphile.org/postgraphile

You can use PostGraphile via the CLI, as a middleware, or just use the GraphQL schema directly. Make sure to check out the forum example and especially step by step tutorial for a demo of a PostGraphile compliant schema and authentication.

CLI

Install using npm:

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

Middleware

You can also use PostGraphile as native HTTP, Connect, Express, or Koa (experimental) middleware, e.g.:

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.

Docker

To run via Docker, simply pass the CLI options to the Docker container:

docker pull graphile/postgraphile
docker run graphile/postgraphile --help

E.g. you might run this command (substituting the relevant variables):

docker run -p 5000:5000 graphile/postgraphile --connection postgres://POSTGRES_USER:POSTGRES_PASSWORD@POSTGRES_HOST:POSTGRES_PORT/POSTGRES_DATABASE --schema app_public --watch

Read More

Full documentation for PostGraphile is located at graphile.org/postgraphile.

PostGraphile features include:

Requirements

  • Node v8.6+
  • PostgreSQL 9.6+ (currently works with 9.4+)
  • Linux, macOS or Windows

Caveats:

  • PostGraphile does not have automated tests on Windows, if you notice any issues please file them (or send a PR!)

Supporting PostGraphile

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!

Thanks

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 👍

postgraphile's People

Contributors

calebmer avatar benjie avatar greenkeeperio-bot avatar ferdinandsalis avatar bradleyayers avatar jemgillam avatar mattbretl avatar langpavel avatar angelosarto avatar tim-field avatar snyk-bot avatar valoricde avatar vitaly-t avatar smh avatar petetnt avatar nbushak avatar kenips avatar dustinmoorenet avatar cbandy avatar ashtonsix avatar jazzido avatar martinheidegger avatar maxdesiatov avatar mshick avatar orta avatar ppkrauss avatar ryanflorence avatar colophonemes avatar shalokshalom avatar gitter-badger avatar

Watchers

Dimitri Grinkevich avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.