This was a long running project which we advocated for as one of our "sand" projects.
We faced a significant hurdle in refining its developer experience workflow.
At the heart of this challenge was the code, try, and test loop, an essential part of the development process.
While we had successfully integrated GraphiQL, a visual explorer for our APIs which empowered developers - a crucial aspect remained difficult:
clearly communicating to developers which role they were emulating when testing their API through the interface.
This challenge had multiple parts:
These issues combined to create a less-than-ideal user experience, particularly for developers new to the platform.
The complexity of the challenge stemmed from the various scenarios that determined role emulation during the try-and-test stages.
The emulation was based on the request headers sent in the API request, with several possible configurations:
x-hasura-admin
token was defined:admin
role.x-hasura-role
header.anonymous
or unsigned-in user role.This complexity made it difficult for developers to keep track of their current emulated role, leading to confusion and potential errors in API testing.
We approached this challenge with two solutions, each building upon the other:
The initial solution focused on clearly illustrating to users which role they were currently using.
This approach was particularly important given the technical limitations of Hasura v2.
The main goal was to provide visual cues that would inform users about their current emulation scenario.
This helped developers understand which role they were emulating at any given time, reducing confusion and improving the overall testing experience.
With the advent of Hasura v3+, we were able to implement a more user-friendly solution by abstracting away much of the role emulation complexity into a simple role selector.
This approach offered several benefits:
--
Early testing of this feature showed promising results.
Users found the role picker much more intuitive and easier to use compared to the previous method of managing roles through headers.