TypeScript ORM for Node.js that gives type-safe database access across PostgreSQL, MySQL, SQLite, MongoDB and other databases.
graphile/crystal
A monorepo of GraphQL and PostgreSQL tooling, home to the Grafast execution engine and the PostGraphile automatic GraphQL API builder.
Open-source alternative to:Hasura
- Stars
- 12,934
- Forks
- 631
- Open issues
- 181
- Last commit
- 16 hours ago
What is it?
Graphile Crystal is a monorepo containing many packages from the Graphile project, most of which relate to GraphQL. Its two headline projects are Grafast, a planning and execution engine for GraphQL.js that can be used as a drop-in replacement for the execute method, and PostGraphile, which generates a GraphQL API automatically from a PostgreSQL database.
Grafast uses plan resolvers instead of traditional resolvers, so the declarative structure of a GraphQL request can be used to run business logic more efficiently. PostGraphile treats the database as the source of truth and can also serve as a starting point for an API that is later maintained by hand, via graphile-export.
The repository also includes supporting libraries such as pg-sql2 for building parameterized PostgreSQL queries with tagged template literals, pg-introspection for typed database introspection, graphile-config for plugin and preset configuration, and graphile-build for assembling GraphQL schemas from plugins. For PostGraphile V4, the legacy branch is maintained separately.
Key features
- 01Grafast offers a planning and execution engine that drops into GraphQL.js in place of execute.
- 02PostGraphile generates a GraphQL API automatically from a PostgreSQL schema.
- 03Plan resolvers allow business logic to be declared in a way the engine can optimise.
- 04pg-sql2 builds SQL-injection-safe PostgreSQL queries from tagged template literals.
- 05graphile-export can export a dynamically built schema to plain JavaScript source.
Use cases
- Building a GraphQL server on top of GraphQL.js that needs efficient data loading.
- Generating a GraphQL API directly from an existing PostgreSQL database.
- Creating a starting-point API from PostgreSQL that is later customised by hand.
- Writing type-safe, dynamic SQL queries for PostgreSQL in Node.js.
Things to know
- This is a monorepo of many packages, so there is no single install or run command in the README.
- PostGraphile V4 lives on a separate legacy branch rather than in this main line.
Topics
FAQ
- What is crystal?
- A monorepo of GraphQL and PostgreSQL tooling, home to the Grafast execution engine and the PostGraphile automatic GraphQL API builder. Graphile Crystal is a monorepo containing many packages from the Graphile project, most of which relate to GraphQL. Its two headline projects are Grafast, a planning and execution engine for GraphQL.js that can be used as a drop-in replacement for the execute method, and PostGraphile, which generates a GraphQL API automatically from a PostgreSQL database.
- Is crystal free to use? What license does it have?
- crystal is open source under the MIT license. Check the license terms before using it in commercial products.
- Is crystal still maintained?
- Actively maintained. The last commit to crystal was on Oct 21, 2026.
- What can I use crystal for?
- Building a GraphQL server on top of GraphQL.js that needs efficient data loading. Generating a GraphQL API directly from an existing PostgreSQL database. Creating a starting-point API from PostgreSQL that is later customised by hand. Writing type-safe, dynamic SQL queries for PostgreSQL in Node.js.
- Where can I get crystal?
- The source code and installation instructions are on GitHub: https://github.com/graphile/crystal
Summary generated by AI from the project's README. GitHub stats refresh daily.
Related projects
A lightweight, headless TypeScript ORM for PostgreSQL, MySQL and SQLite that works across Node.js, Bun, Deno and edge runtimes.
A promise-based Node.js and TypeScript ORM for PostgreSQL, MySQL, MariaDB, SQLite, MS SQL Server, Snowflake, Oracle and Db2.
Wraps any SQL database with instant REST and GraphQL APIs, a visual admin Studio, and a native MCP server for AI agents.
Open-source engine that instantly exposes databases such as PostgreSQL, MongoDB and SQL Server as a secure GraphQL API with fine-grained access control.
A standalone server that turns any existing PostgreSQL database into a RESTful API with no backend code to write.