MaintainGraphcool to Prisma

Overview

From Graphcool Framework to Prisma

The Graphcool Framework is the open-source version of the former Graphcool Backend-as-a-Service offering. Prisma is a GraphQL query engine and the core technology that is powering the Graphcool Framework.

While the Graphcool Framework offers an opinionated setup for your GraphQL backend and doesn't require you to write a lot of server-side code, Prisma provides more flexibility and leaves many decisions up to the preferences of the developer.

To get an overview of the major differences between Prisma and the Graphcool Framework, read this forum post.

Migrating to Prisma

We recommend that you migrate your project in a development environment before putting it into production. This ensures a smooth migration process. You can use the import and export functionality for Graphcool/Prisma services to migrate data between different projects.

New architecture: Your GraphQL server uses Prisma as a database layer

The core idea when building GraphQL servers with Prisma is that you have two GraphQL layers for your server:

  1. The database layer is provided by Prisma, this is the core of your server. In essence, the GraphQL API provided by the database layer corresponds to a combined version of the familiar Simple & Relay APIs. The API exposes generic and powerful CRUD operations for the types defined in your datamodel.
  2. The application layer - this is a new idea if you've only worked with the Graphcool Framework before. The application layer defines another GraphQL API, the one that is exposed to your client applications and tailored to your application's needs.

In that new architecture, the application layer is entirely responsible for business logic and other common workflows such as authentication, permissions or file handling. Rather than writing Resolver or Hook functions, you are now simply implementing traditional GraphQL resolvers.

Implementing resolvers in your application layer doesn't require a lot of overhead since incoming requests can simply be delegated to the underlying Prisma API using the prisma-binding package.

Deployment

Another major difference with Prisma, compared to using the Graphcool Framework, is that you now need to take care of deploying the GraphQL server. One great option for doing so is the Zeit Now one-click deployment tool. Another option is up.

Your Prisma service is running on Docker and can be deployed to any cloud provider, such as Digital Ocean or AWS. There also are deployment options based on the Prisma Cloud.