1 comment

[ 3.8 ms ] story [ 7.2 ms ] thread
Developer here. While people are discussing PostGraphQL I figured it would be neat to show off a GraphQL project I've been working on for a couple weeks: the MusicBrainz schema, available via GraphQL.

MusicBrainz actually does use Postgres as its database, but this doesn't use PostGraphQL or even talk directly to the database – it simply translates the GraphQL query into calls to their REST API, orchestrating multiple queries for you as necessary. It would be possible (and more optimal) to talk directly to the database, but it'd require setting up your own server. This way, it can be pointed at the public MusicBrainz API (or any private deployment).

GraphQL is awesome and this was actually surprisingly easy to develop. Most of the work was simply around making optimal REST API calls (taking advantage of their API's subquery features, etc.) instead of doing it naïvely. Also, making sure every field and type in the schema had a useful description.

The documentation part is huge. Reading the official REST API docs [1], it's nearly impossible to get an accurate overview of which parameters each endpoint accepts (in fact, some aren't even listed in the docs), what fields to expect, or even find a description of what every field means. Compare that to the "Docs" sidebar you get in GraphiQL (click the demo link), or the Types document [2] that I was able to automatically generate from the schema. Sure, you can work hard to document a REST API and keep those docs up-to-date, but GraphQL encourages it and makes it easy.

No idea if the Heroku-hosted demo server will survive HN, but have fun playing with it.

[1]: https://musicbrainz.org/doc/Development/XML_Web_Service/Vers...

[2]: https://github.com/exogen/graphbrainz/blob/master/docs/types...