gitwtfhub

wtf is crystal?

graphile/crystal — explained in plain English

Analysis updated 2026-06-24

12,923TypeScriptAudience · developerComplexity · 4/5Setup · moderate

TL;DR

A monorepo of TypeScript tools for building GraphQL APIs, featuring PostGraphile which auto-generates a full GraphQL API from your PostgreSQL database schema.

Mindmap

mindmap
  root((graphile crystal))
    What it does
      GraphQL API builder
      Auto-gen from Postgres
      Efficient execution
    Key packages
      PostGraphile
      Grafast engine
      pg-sql2
      pg-introspection
    Tech stack
      TypeScript
      PostgreSQL
      GraphQL
    Use cases
      Auto-gen API
      Safe SQL queries
      Plugin extensions
    Audience
      Backend developers
      API engineers

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Why would anyone build with this?

REASON 1

Automatically generate a full GraphQL API from your existing PostgreSQL database with minimal setup.

REASON 2

Build high-performance GraphQL APIs that plan and batch database queries for efficiency.

REASON 3

Write SQL queries safely in Node.js without SQL injection risk using the pg-sql2 package.

What's in the stack?

TypeScriptGraphQLPostgreSQLNode.js

How it stacks up

graphile/crystalixartz/next-js-boilerplatebarbajs/barba
Stars12,92312,92512,926
LanguageTypeScriptTypeScriptTypeScript
Setup difficultymoderatemoderateeasy
Complexity4/53/52/5
Audiencedeveloperdeveloperdeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you spin it up?

Difficulty · moderate Time to first run · 1h+

Requires a running PostgreSQL database, install specific packages from the monorepo rather than the whole repo.

Wtf does this do

This is a monorepo, which means it is a single code repository that contains many individual packages. All of them are connected by a shared theme: they help developers build GraphQL APIs, which are a way for software applications to request and send data in a structured manner. The repository is maintained by the Graphile project and written primarily in TypeScript. The two most prominent packages here are Grafast and PostGraphile. Grafast is an execution engine for GraphQL, meaning it handles the job of running GraphQL queries as efficiently as possible. Instead of using the standard approach, Grafast lets developers describe what data their code needs in advance so the engine can plan the most efficient way to fetch it, which reduces unnecessary work on the server. PostGraphile is the other headline tool. If you have a PostgreSQL database (a widely used type of database for storing structured data), PostGraphile can automatically generate a full GraphQL API on top of it with very little setup. The idea is that your database schema already defines your data structure, so PostGraphile reads that structure and builds the API for you. You can still customize and extend what it generates. Beyond those two, the monorepo includes a range of supporting packages. Some help build database queries safely, some handle configuration and plugins shared across Graphile tools, and others assist with testing and code export. A package called pg-sql2 helps write PostgreSQL queries using a pattern that prevents a common security problem called SQL injection. Another, pg-introspection, reads the internal structure of a PostgreSQL database programmatically. The project is crowd-funded and supported by sponsors. It is open source and targeted at developers building data-heavy applications where API performance and database integration matter. If you are a non-developer, this repository would mainly be relevant as background context for why a technical team might adopt these tools.

Yoink these prompts

Prompt 1
I have a PostgreSQL database with a users and posts table. Show me how to set up PostGraphile to generate a GraphQL API from it and run it locally.
Prompt 2
I'm using PostGraphile and want to add a custom mutation that isn't auto-generated from my schema. How do I extend the API with a plugin?
Prompt 3
How do I use pg-sql2 from the graphile/crystal monorepo to safely build a dynamic SQL query with user-provided filter values?
Prompt 4
I want to add row-level security to my PostGraphile API so users can only see their own data. Show me how to configure PostgreSQL RLS and wire it up.

Frequently asked questions

wtf is crystal?

A monorepo of TypeScript tools for building GraphQL APIs, featuring PostGraphile which auto-generates a full GraphQL API from your PostgreSQL database schema.

What language is crystal written in?

Mainly TypeScript. The stack also includes TypeScript, GraphQL, PostgreSQL.

How hard is crystal to set up?

Setup difficulty is rated moderate, with roughly 1h+ to a first successful run.

Who is crystal for?

Mainly developer.

View the repo → Decode another repo

This repo across BitVibe Labs

Don't trust strangers blindly. Verify against the repo.