Building an API around Dgraph application

I opted (for my prototype at least) to not use the prebuilt Clients

  • I’m running dgraph and only exposing the /graphql± endpoints to localhost.
  • I then built a a RESTful API layer of my own creation to handle authentication, business logic, rate limiting, the usual; this then talks to dgraph and is exposed externally.
  • I then built a website that consumes the RESTful APIs as “normal”.

The downsides with this approach are exactly as you describe; when I make a change to the schema (which happens often as I’m learning dgraph) then I need to change the API layer and the website as well.

I am finding it to be a great learning exercise though; knowing how to write queries and mutations by hand is helping me understand dgraph better than using an abstraction layer like a client. I am however duplicating what a client likely makes much easier - writing dynamic queries for sorting, filtering, pagination and so on.

I would not take my current implementation to production as-is; again great as a learning exercise though.