Advice from a GraphQL Expert
GraphQL is a great query language to speed up client development. As a backend developer, you are no longer under pressure to build APIs specific to niche use-cases that client's demand. This post addresses some great advice from, Francesca Guiducci, a GraphQL expert.
- Evaluate if GraphQL fits into your architecture. It can front a database and even a REST API.
- Involve other people while designing the schema. The schema is your source of truth and needs to be well thought out.
- Change your mental model to think in graphs. Most data is relational in nature, GraphQL schemas must be modeled to represent that relation.
- Make the schema easy to evolve. Since GraphQL versioning is frowned upon, leverage keywords like
@deprecatedto evolve the schema. As far as possible, be forward thinking while constructing your schemas.
- Be intentional while incorporating nullability into the schema. This leads to cleaner and simpler architectures.
- Since pagination isn't implemented natively in GraphQL, design this carefully and incorporate it from Day 0. Reduces a lot of heartburn in the future.
Full post here, 9 mins read