Need advice about which tool to choose?Ask the StackShare community!
Apollo vs Hasura: What are the differences?
Introduction
This Markdown code provides a comparison between Apollo and Hasura, two popular technologies used in web development.
Data Layer Approach: Apollo is a flexible and powerful Graphql client that can be used with any backend. It provides client-side caching, optimistic UI updates, and schema stitching. On the other hand, Hasura is an instant GraphQL backend that connects to databases and auto-generates a GraphQL API. It allows developers to build real-time applications quickly without writing custom server-side code.
Real-time Capabilities: Apollo offers real-time capabilities through its support for GraphQL Subscriptions. It allows clients to subscribe to specific events and receive real-time updates from the server. Hasura, on the other hand, provides real-time updates out of the box by leveraging built-in event-driven architecture. This means that any changes made in the database automatically trigger real-time updates to connected clients.
Authorization and Authentication: Apollo provides a flexible and customizable approach to authorization and authentication. It allows developers to implement their own authentication logic using middleware or third-party libraries. Hasura, on the other hand, comes with built-in role-based access control (RBAC) and JWT authentication. This simplifies the implementation of authentication and authorization in Hasura-based applications.
Direct Database Access: Apollo requires a server-side middleware or backend to communicate with the database. It doesn't provide direct access to the database but can connect to any GraphQL-compliant backend. Hasura, on the other hand, directly connects to the database and provides a GraphQL API layer on top of it. This eliminates the need for a separate backend and simplifies the development process.
Developer Experience: Apollo provides a rich developer experience with tools like Apollo Client, Apollo Server, and Apollo Studio. It has a wide range of features and integrations that make it easy to develop, test, and deploy GraphQL applications. Hasura, on the other hand, provides a streamlined developer experience with its auto-generated GraphQL API and built-in console. It allows developers to focus on application logic rather than dealing with setup and configuration.
Community and Ecosystem: Apollo has a large and active community with extensive resources, tutorials, and libraries available. It is widely adopted by developers and has a mature ecosystem. Hasura, on the other hand, has a growing community and ecosystem. While it may not have the same level of resources as Apollo, it is gaining popularity due to its simplicity and developer-friendly approach.
In Summary, Apollo and Hasura are both powerful GraphQL technologies, but they differ in their approach to data layer, real-time capabilities, authorization and authentication, database access, developer experience, and community support.
We wanted to save as much time as possible when writing our back-end, therefore Apollo was out of the question, we went for an auto-generated API instead. Hasura looked good in the beginning, but we wanted to retain the ability to add a few manual resolvers and modifications to auto-generated ones, which ruled out Hasura. Postgraphile with its Plug-In architecture was the right choice for us, we never regretted it!
Pros of Apollo
- From the creators of Meteor12
- Great documentation8
- Open source3
- Real time if use subscription2
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
Sign up to add or upvote prosMake informed product decisions
Cons of Apollo
- File upload is not supported1
- Increase in complexity of implementing (subscription)1
Cons of Hasura
- Cumbersome validations3