Need advice about which tool to choose?Ask the StackShare community!
Hasura vs PostGraphile: What are the differences?
Introduction
In this article, we will compare the key differences between Hasura and PostGraphile.
Architecture: Hasura is based on a microservices architecture, where GraphQL requests are sent to a separate server. On the other hand, PostGraphile is a library that runs directly on top of a PostgreSQL database and exposes the GraphQL API through PostgreSQL itself. This difference in architecture affects how the two solutions are deployed and managed.
Ease of Setup: Hasura provides a web-based console that makes it easy to set up a GraphQL API on top of existing databases. It auto-generates the GraphQL schema and allows real-time data updates out of the box. PostGraphile requires manual configuration and customization, as it directly uses the PostgreSQL schema and requires writing SQL queries for more advanced features.
Real-time capabilities: Hasura has built-in support for real-time subscriptions, allowing clients to receive instant updates whenever the data changes. PostGraphile does not have native support for real-time subscriptions, but it can be augmented with external tools like Postgres Pub-Sub or GraphQL subscriptions using Apollo.
Extensibility: Hasura provides a plugin system that allows extending its functionality by adding custom GraphQL resolvers and event triggers. This allows developers to add custom business logic or integrate with external services. PostGraphile, being a library, requires more manual work to extend its functionality, like writing custom code in the form of smart tags or using PostgreSQL triggers.
Permissions and Access Control: Hasura has a built-in role-based access control system that allows granular control over who can access which parts of the API. It also provides fine-grained query-level authorization using GraphQL queries or webhooks. PostGraphile relies on PostgreSQL's user roles and permissions for access control, which may require manually managing database roles and permissions.
Developer Experience: Hasura's web-based console provides a user-friendly interface for exploring and interacting with the GraphQL API, making it easier for developers to get started. PostGraphile, being a library, may require more configuration and set up upfront, making it better suited for developers with a deeper understanding of GraphQL and PostgreSQL.
In summary, Hasura and PostGraphile differ in their architecture, ease of setup, real-time capabilities, extensibility, permissions and access control, and developer experience.
Pros of Hasura
- Fast23
- Easy GraphQL subscriptions18
- Easy setup of relationships and permissions16
- Automatically generates your GraphQL schema15
- Minimal learning curve15
- No back-end code required13
- Works with new and existing databases13
- Instant production ready GraphQL12
- Great UX11
- Low usage of resources4
- Simple4
Pros of PostGraphile
- Postgres based authentication10
- Great developer support6
- Lightning fast5
- Database first with no braking changes5
- Simple to set up and scale4
- Bye bye Resolvers4
- Back to database first3
- 9 Automatically generates your GraphQL schema3
- Easy setup of relationships and permissions3
- Instant production ready GraphQL3
- Works with new and existing databases1
Sign up to add or upvote prosMake informed product decisions
Cons of Hasura
- Cumbersome validations3