Skip to content

Graphile

A monorepo of GraphQL tools, including Grafast and PostGraphile for building APIs from PostgreSQL.graphile/crystal

Stars
12.9k
Forks
632
Licence
MIT
Language
TypeScript
Last update
4 days ago
Type
Framework

What it is

This repository holds many related open-source packages from Graphile, a project focused on GraphQL. The two headline projects are Grafast, a planning and execution engine that can replace the execute method in GraphQL.js, and PostGraphile, which builds a GraphQL API automatically from a PostgreSQL database. Other packages, such as pg-sql2 for building SQL queries and pg-introspection for reading database structure, can be used on their own.

  • Generate a GraphQL API from an existing PostgreSQL database with PostGraphile
  • Replace the execute method in a GraphQL.js server with Grafast
  • Build dynamic, injection-safe PostgreSQL queries with pg-sql2
  • Export a dynamically built GraphQL schema to JavaScript source using graphile-export

Great for

  • Developers who have a PostgreSQL database and want an auto-generated GraphQL API
  • Teams building custom GraphQL schemas who care about server efficiency
  • Developers who want a GraphQL API they can still customise heavily
  • Developers looking for individual Node.js libraries for SQL building or Postgres introspection

Not ideal for

  • People who do not use PostgreSQL, since PostGraphile is designed around it
  • People who need the legacy PostGraphile V4, which lives on a separate branch
  • Beginners with no Node.js or GraphQL experience, as the README assumes familiarity with both
Step-by-step guide: how to use GraphileInstall, first run, examples, tips and FAQs

How to get it

  1. 1

    Install with a package manager

    You'll need: Node.js · PostgreSQL

    Clone the repository

    git clone https://github.com/graphile/crystal
  2. 2

    Run it

    • Clone the repository from GitHub
    • Read the README of the package you need, such as grafast or postgraphile, for its specific setup steps
    • Connect PostGraphile to a PostgreSQL database following that package's documentation
    • Query the generated GraphQL endpoint
  3. 3

    Get the most out of it

    • Use graphile-export to start from an auto-generated schema and then manage the API yourself
    • Use the eslint-plugin-graphile-export package to write code compatible with graphile-export
    • Use pg-sql2 for safe dynamic SQL in tagged template literals
    • Check the project homepage at graphile.org for further documentation

Downloads

Strengths

  • Covers a range of related GraphQL and PostgreSQL tools in one place
  • Several packages can be used independently of the rest
  • MIT licensed and actively maintained, with a recent push to the repository

Trade-offs

  • The README is truncated and gives limited setup detail, so setup is not clear from this text alone
  • Many packages and concepts make the monorepo hard to navigate for newcomers
  • Some packages are niche and the README itself recommends alternatives for one of them

How it compares

ProjectStarsTypeLevelUpdatedBest for
crystal (this)12.9kFrameworkadvanced4 days agoDevelopers who have a PostgreSQL database and want an auto-generated GraphQL API
apollo-server14kLibraryintermediate5 days agoNode.js developers who want to add a GraphQL API to an existing Express, Koa or Hapi app
graphql-js20.3kLibraryintermediate4 days agoJavaScript or TypeScript developers building a GraphQL API on Node.js
postgrest27.7kAppintermediate6 days agoDevelopers who already have a PostgreSQL database and want an HTTP API on top of it quickly
node-postgres13.2kLibraryintermediate14 days agoNode.js developers who need to query a PostgreSQL database from a server or script
usql10.2kCLIbeginner4 days agoDevelopers who use several different databases and want one tool for all of them

Stats synced from GitHub. The assessment above was drafted with AI from the project's README on 2026-10-29 and may miss recent changes — check the README before relying on a command. MIT licence: free to use, modify and distribute, including commercially, as long as you keep the copyright notice.