/

hasura-header-illustration

Case study

How Matternet Is Powering Autonomous Drone Delivery with Hasura

Matternet is an end-to-end technology platform for autonomous aerial delivery that provides an integrated service for healthcare, e-commerce, and logistics organizations. Matternet is on a quest to make access to goods as frictionless and universal as access to information, starting with rapid, autonomous, on-demand medical deliveries that save lives and transform healthcare.

Key metrics

50% improvement in transaction visibility

2 Faster application performance

Cleaner system architecture

The Problem

Matternet's Challenge

Matternet needed to redesign their application architecture

The integrated Matternet platform includes autonomous drones, landing stations, and a cloud-based logistics platform. The Matternet cloud is the brain of the entire system and is responsible for flight planning and real-time drone monitoring. Operators can log into the platform to field customer requests, generate routes, and monitor and control the drones.

During flights, the drones and landing stations transmit protobuf (Protocol buffers) messages to the Matternet cloud platform (and clients) using an MQTT (Message Queue Telemetry Transport) broker — a lightweight publish/subscribe protocol designed for resource-constrained devices and slow network links. The MQTT broker passes the various messages to the clients that subscribe. However, the main problem with this approach was that it was difficult to onboard new clients because of the tight coupling between the clients and the protobuf message. Each client had to take on the arduous task of deserializing the protobuf messages, which caused performance bottlenecks.

Some of the other issues they faced with this initial tech architecture included:

Inconsistent communication layer for client applications

The Matternet team observed that managing the different protobuf integrations in addition to REST APIs became increasingly complex. Therefore, they needed a consistent data layer that was always up to date, reliable, and easy to integrate for their various clients.

Reduced transaction query visibility

One of Matternet's main concerns with their initial architecture was the lack of proper visibility into their transactions (telemetry data). Because of this, they could not debug system issues efficiently, which affected the reliability of their system. As a result, they needed a solution that gave them more visibility into their systems and transaction information.

Limited architecture flexibility

The tight coupling between the clients and the protobuf messages made onboarding new clients and scaling difficult. Thus, Matternet needed to redesign their architecture to iterate on features quickly and stay flexible.

The Solution

Why Matternet chose Hasura

Hasura cloud-powered GraphQL APIs provided a simplified data layer

Matternet discovered GraphQL as a solution to their problems and implemented a GraphQL layer in their architecture; however, the vendor they chose lacked the flexibility and performance capabilities they sought. So, they started exploring other options and discovered Hasura. They did initial experimentation with Hasura using the free tier version, which provided promising results.

They decided to include Hasura as a core component of their tech stack for the following reasons:

Matternet architecture diagram

Matternet architecture diagram

Client-focused GraphQL APIs

Hasura provided an easy way to set up GraphQL APIs by connecting their Postgres databases. Each client could now connect to the same GraphQL API and request their needed data. Furthermore, they could decouple the processing of protobuf messages from their client applications, improving their performance.

REST API integration with Hasura Actions

With Hasura Actions, Matternet had a straightforward way to connect their REST APIs and business logic to the centralized graph. In addition, Hasura Actions fit well with the "command/query" architecture Matternet wanted to implement. They could connect Hasura directly to their Postgres database for queries and map commands to Hasura Actions, which would then delegate them to the appropriate REST API handler, creating a neat separation of concerns.

Rate and Query depth limit

Hasura’s Rate and Query depth limit features meant that Matternet had complete control of their GraphQL operations. For example, Rate limiting could restrict the number of GraphQL operations per minute, preventing their APIs from malicious overuse. Additionally, Matternet could prevent deeply nested queries that cause performance bottlenecks with the Query depth limit feature. Having these capabilities out of the box with Hasura made Matternet more confident in the reliability of their system.

Simplified authentication and authorization

Matternet had to ensure security at every system level, and Hasura’s authentication and authorization features offered them that. For example, Hasura offered role-based access control on all GraphQL schemas down to the row and column level. This tight security made it easy for Matternet to configure permissions for different clients on the same GraphQL API.

The Results

Matternet improved their application software architecture with Hasura Cloud

With the help of Hasura, Matternet has been able to simplify and improve their application architecture. For example, from the MQTT broker, the protobuf messages are now aggregated to a Kafka stream cluster and then normalized into a Postgres database connected to Hasura. Consequently, all clients (including the Matternet cloud) can now directly interface with Hasura-powered GraphQL APIs to obtain information.

Some of the other benefits Matternet attributed to the use of Hasura include:

Consistent GraphQL API for all clients

After migrating to Hasura, Matternet now has a consistent GraphQL API for all clients to consume. As a result, they can efficiently cater to many client devices with custom data requirements, dramatically improving the user experience.

Improved transaction visibility

The Matternet team reported improved transaction visibility after moving to Hasura. Hasura provided complete transaction visibility with analytics integration, giving Matternet full observability into their system. As a result, the Matternet team can quickly debug issues and identify performance bottlenecks, significantly improving application performance and reliability.

Cleaner architecture

Hasura enabled Matternet to leverage a “command/query” model for a cleaner and more reliable application architecture. Thus, they could decouple the business logic from the clients and implement a good separation of concerns. This new architecture has enabled them to stay light on their feet, iterate faster, scale easily, and improve their overall system.

“Hasura helped us streamline our business logic and leverage a cleaner architecture.”

Lead Software Engineer, Matternet

David Tsai

Lead Software Engineer, Matternet

Closing Note

What’s Next for Matternet

Matternet has already demonstrated the potential for medical drone delivery networks in regions worldwide. In 2021, through a partnership with UPS, Matternet became the first drone company to transport Pfizer vaccine doses in the U.S. In addition, Matternet has partnered with UAE leaders in logistics and the Abu Dhabi Department of Health to provide city-wide medical delivery by air. They continue to work closely with the Hasura team to expand their drone network to more cities and cater to more business use cases.

Thank you to our friends at Matternet, and David Tsai Lead Software Engineer, Matternet for sharing their story with us!

Build the most impactful data platform with Hasura DDN today.