Prisma Aims to Unite the Polyglot of Databases with GraphQL
A new open source project for database backend composition, Prisma allows businesses to manage a polyglot database environment, and access datasets across different systems through a unified GraphQL endpoint.
Co-founder and CEO of the company behind the software Johannes Schickling says the need for Prisma arose out of the way distributed, at-scale applications and business systems are managed today. Whereas in the past, businesses may have had the one SQL or Oracle database managing everything, backend systems today are usually composed of multiple kinds of databases. “Depending on the kinds of data you have, you might put some in a search database, some in a relational database, other data in something like Neo4j, and other data in Redis,” said Schickling. “This is the polyglot database world we live in today.”
Schickling says because of these choices, databases are distributed, but involve a lot of infrastructure, which means they can end up slowing down performance when a business application is managing state (that is, data that needs to be stored, read, may be changed and then stored again).
To solve this, Prisma is focused on three tasks: to make distributed application design simpler in general; to make working with databases easier in particular; and to allow bigger companies to be able to play catch up with emerging best practices.
Schickling gives a key example of the sort of best practices that tech giants can experiment with and implement, but that may be out of reach to a large enterprise. “Modern application design is divided into layers, usually infrastructure and logic layers,” Schickling explained. “The very fact that your application and database are not the same thing is already a layer everyone is familiar with. In any API and backend service, you would then have a data access layer, which is a logic layer. This logic layer is getting more complicated and needs to process more responsibilities around authorization, access and speed, so it is very hard to build. That has become the biggest bottleneck in application development now.”
Schickling says tech giants have solved this sort of problem for themselves by turning that logic layer into another infrastructure layer that is completely agnostic to other processes. “This is what we are making our own infrastructure layer, with caching, and efficient ways to query your data, and then we bake it into the infra layer, so you can access it in a variety of languages. You get type safety from the client application up to your database,” said Schickling.
For Prisma’s vision of making working with databases easier, they need to have multi-database integration capabilities. Building connectors for each kind of database and being able to combine those connectors is top of their list of to-dos, with support MySQL and Postgres databases already in place. An open pull request is available in their GitHub repo where followers (which have grown to over 8,000 since the first launch in January 2018) can vote for which database connectors they next want to be created.
MongoDB and ElasticSearch have been singled out by the community as the next most important databases to support, Schickling said. “We are very community driven, our open issues is where we take our biggest point of inspiration. Over the next year, we will be adding support for any kind of database,” Schickling said.
By connecting databases to a single GraphQL endpoint, some have argued that this creates another layer, which could mean more headaches for database architects. Shickling argues that by choosing GraphQL, consistency across underlying databases is easier to maintain. “Prisma helps you migrate your underlying data models and databases,” Schickling counterpointed. “You can generate GraphQL bindings to bind that to your logic layer and the icing on the cake is end-to-end type safety. You get type safety from the data model to the database, so it makes it a lot easier to keep it in sync.”
Schickling says that REST, for example, would need to trust that the data access layer returns the right data, whereas, with GraphQL and Prisma, the bindings functionality ensures that.
To date, Prisma is seeing adoption from enterprise and startups, each with their own use cases. Enterprises — usually from finance — are looking to detach from their reliance on legacy databases. “They can put the data access layer on top of their Oracle database and build an API super quickly, that’s the most common driver from people looking at Prisma at the moment,” Schickling confirmed.
Meanwhile, startups are interested because it reflects their new stack interests: GraphQL, MongoDB, React… They want to find the quickest way to build a GraphQL server that can talk to their MongoDB and, Schickling says, Prisma lets them do that.