Introducing Prisma πŸŽ‰

An open-source GraphQL API layer for your database

Today we are incredibly excited to announce Prisma (previously referred to as Graphcool 1.0).

Prisma is a GraphQL database proxy turning your database into a GraphQL API. You can use the API as foundation for your own GraphQL server or connect directly from your frontend application.

How does Prisma work?

Prisma is a standalone component which is deployed in front of your SQL database and generates a GraphQL API. To get started and create a new GraphQL API with Prisma, you simply define your data model using GraphQL SDL and use the Prisma CLI to deploy your changes.

Based on your data model, Prisma generates a ready-to-use GraphQL API exposing a powerful CRUD GraphQL schema.

As an example, consider this data model which specifies a single User type :

The data model is the foundation for every Prisma service

The GraphQL schema generated by Prisma will look similar to this:

This is a simplified version of the generated Prisma schema, have a look at the full schema here

With this schema, you now have full CRUD capabilities for the User type. This includes powerful options for filtering, sorting and pagination to read and write User records in the database.

Getting started

To get started with Prisma, all you need to do is install the Prisma CLI and use its init command:

The prisma init command offers an interactive prompt that allows you to either explore Prisma in a database-only setup or by bootstrapping a GraphQL server with Node.js or TypeScript (based on GraphQL boilerplates).

Watch this short 4 minute video to learn how you can use Prisma to build a simple GraphQL server:

To learn more about how to get started with Prisma, you can check out the documentation or the following resources:

How Prisma fits into the GraphQL ecosystem

Open-source tools like apollo-server, graphql-yoga and GraphQL bindings make it (almost too) easy to get started with building your own GraphQL server. However, implementing the resolvers for your GraphQL API remains the hard technical challenge when it comes to developing GraphQL servers that go beyond simple use cases.

This is exactly what Prisma is trying to simplify. In combination with prisma-bindings, it enables a straightforward implementation of your resolvers by simply delegating the execution of incoming queries to the underlying Prisma API. These are then resolved efficiently by Prisma’s query engine.

Thanks to static bindings, GraphQL developers can now benefit from autocompletion when working with GraphQL APIs (similar to GraphQL Playgrounds / GraphiQL)

A huge thanks to the community πŸ’š

At Graphcool, our mission is to make it as easy as possible for developers to build applications with GraphQL. When we started out two years ago, the GraphQL ecosystem was still in its infancy and did not provide much tooling for developers to get started.

The best way for us to accelerate the adoption of GraphQL was by offering a Backend-as-a-Service solution, so developers could get up and running quickly with their own GraphQL backends. To not compromise on flexibility for our customers, we open-sourced the platform in October 2017.

We couldn’t be more excited to launch Prisma today and are incredibly thankful for being part of such an amazing developer community! ✨