Need advice about which tool to choose?Ask the StackShare community!

PostGraphile

87
214
+ 1
47
Prisma

1.1K
954
+ 1
54
Add tool

PostGraphile vs Prisma: What are the differences?

Introduction

PostGraphile and Prisma are both tools used for building and managing database schemas in the context of web development. While they share some similarities, they also have key differences that set them apart. In this Markdown document, we will highlight and provide a brief description of the key differences between PostGraphile and Prisma.

  1. Database Connection: PostGraphile connects directly to your existing PostgreSQL database, utilizing the schema introspection capabilities of the database to automatically generate a GraphQL API. On the other hand, Prisma operates as an abstraction layer between your application and the database, creating its own database schema that can be seamlessly connected to various databases, including PostgreSQL.

  2. Schema Generation Approach: PostGraphile generates the GraphQL schema and resolvers by directly reflecting on the database schema. It provides a fully dynamic API where the GraphQL schema reflects the database schema exactly, including table and column names, relationships, and type mappings. Prisma, on the other hand, generates a Prisma schema file that describes the data model, which is then used to generate database-level CRUD and query operations.

  3. Client Library: PostGraphile does not provide a client library, but it instead focuses on generating a GraphQL API server. This means that developers need to write their own client-side code to consume the GraphQL schema. Prisma, on the other hand, provides its own client library that simplifies database access and operations. The Prisma client enables developers to write type-safe, auto-completed queries directly in their application code.

  4. Data Migrations: PostGraphile does not provide built-in data migration tools. It assumes that the database schema is already managed separately, and it dynamically adapts to any changes made in the database. Prisma, on the other hand, includes a built-in database migration system that allows developers to manage their database schema changes and apply them in a controlled and scalable manner.

  5. Authentication and Authorization: PostGraphile does not include built-in authentication and authorization mechanisms. Instead, it provides extensions and plugins to integrate with existing authentication and authorization systems like JWT or OAuth. Prisma, on the other hand, includes a declarative and flexible access control system that allows developers to define fine-grained permissions and roles at the schema level, securing the data exposed by the Prisma API.

  6. Performance and Optimization: PostGraphile dynamically generates the GraphQL schema and resolvers based on the database schema, which can lead to great flexibility but also potential performance issues when working with large and complex databases. Prisma, on the other hand, optimizes and generates efficient database queries based on the GraphQL queries received, resulting in better performance by only fetching the necessary data.

In Summary, PostGraphile directly connects to the PostgreSQL database, generates the GraphQL schema dynamically, requires a separate client library, and lacks built-in data migration and authentication/authorization mechanisms. On the other hand, Prisma abstracts the database connection, uses a separate Prisma schema file, provides its own client library, includes a built-in migration system, offers a declarative access control system, and optimizes database queries for performance.

Manage your open source components, licenses, and vulnerabilities
Learn More
Pros of PostGraphile
Pros of Prisma
  • 10
    Postgres based authentication
  • 6
    Great developer support
  • 5
    Lightning fast
  • 5
    Database first with no braking changes
  • 4
    Simple to set up and scale
  • 4
    Bye bye Resolvers
  • 3
    Back to database first
  • 3
    9 Automatically generates your GraphQL schema
  • 3
    Easy setup of relationships and permissions
  • 3
    Instant production ready GraphQL
  • 1
    Works with new and existing databases
  • 12
    Type-safe database access
  • 10
    Open Source
  • 8
    Auto-generated query builder
  • 6
    Supports multible database systems
  • 6
    Increases confidence during development
  • 4
    Built specifically for Postgres and TypeScript
  • 4
    Productive application development
  • 2
    Supports multible RDBMSs
  • 2
    Robust migrations system

Sign up to add or upvote prosMake informed product decisions

Cons of PostGraphile
Cons of Prisma
    Be the first to leave a con
    • 2
      Doesn't support downward/back migrations
    • 1
      Doesn't support JSONB
    • 1
      Do not support JSONB
    • 1
      Mutation of JSON is really confusing
    • 1
      Do not support JSONB

    Sign up to add or upvote consMake informed product decisions

    - No public GitHub repository available -

    What is PostGraphile?

    Execute one command (or mount one Node.js middleware) and get an instant high-performance GraphQL API for your PostgreSQL database

    What is Prisma?

    Prisma is an open-source database toolkit. It replaces traditional ORMs and makes database access easy with an auto-generated query builder for TypeScript & Node.js.

    Need advice about which tool to choose?Ask the StackShare community!

    What companies use PostGraphile?
    What companies use Prisma?
    Manage your open source components, licenses, and vulnerabilities
    Learn More

    Sign up to get full access to all the companiesMake informed product decisions

    What tools integrate with PostGraphile?
    What tools integrate with Prisma?

    Sign up to get full access to all the tool integrationsMake informed product decisions

    What are some alternatives to PostGraphile and Prisma?
    Hasura
    An open source GraphQL engine that deploys instant, realtime GraphQL APIs on any Postgres database.
    GraphQL
    GraphQL is a data query language and runtime designed and used at Facebook to request and deliver data to mobile and web apps since 2012.
    PostgreSQL
    PostgreSQL is an advanced object-relational database management system that supports an extended subset of the SQL standard, including transactions, foreign keys, subqueries, triggers, user-defined types and functions.
    TypeORM
    It supports both Active Record and Data Mapper patterns, unlike all other JavaScript ORMs currently in existence, which means you can write high quality, loosely coupled, scalable, maintainable applications the most productive way.
    Apollo
    Build a universal GraphQL API on top of your existing REST APIs, so you can ship new application features fast without waiting on backend changes.
    See all alternatives