Demystifying GraphQL

or

Why I'm probably never making another REST API ever again

(yet another) Todo App

Data Models

A Simple GraphQL Server

Enough slides, show the GQL schema.

Takeaways

  • Schema should reflect the mental model
  • Bidirectional relationships encouraged
  • Resolvers are not magic
    • small/medium learning curve
    • code generation for type safety helps
  • Fully denormalized types are great
    • foreign keys are a red flag

Sure does seem like the client can ask for a lot....

When should you use GraphQL?

  • When you're building a server to power UI
    • especially if multiple UIs
  • Consider using over a REST API
  • Provide a single server for accessing data across microservices / legacy APIs / databases / etc...

When does GraphQL make less sense?

  • Communication between backend services
  • Data Science / Business Analysts
    • It can work, but you’re most likely forcing them to do their own ETL

    • Probably better off giving them access to DBs (if possible)

  • Public facing APIs (although this is changing...)

Example Repo

Demystifying GraphQL

By Chris Langager

Demystifying GraphQL

  • 305