Lessons Learned Migrating APIs to GraphQL 📝
Tags: graphql, javascript
Published: 2019-08-09 11:54:34

This post shows **best practices** 💫 of migrating APIs to GraphQL. Add your thoughts, collabore asking/resolving concerns 🤗, show them your folks, but 🙏🏻, **share knowledge** 💜

## Lessons Learned

### **Modularize** 👌 your typeDefs & resolvers 👇

{% twitter 1067288762810535936 %}

### “Break your schema by **concern**, not by types“ — [Martijn Walraven](https://twitter.com/martijnwalraven) 👇

{% twitter 1067290487684571137 %}

### DRY ♻️, use **context**! 👇

{% twitter 1067497253294747650 %}

### Evaluate whether your schema is **feature** or **domain** based 👇

{% twitter 1067727612233928704 %}

### Show what’s **important** 👀 first 👇

{% twitter 1068048289755475968 %}

### Decouple **global** typeDefs! 👇

{% twitter 1068432024371789824 %}

### Take advantage 🚀 of **ESNext** 👇

{% twitter 1068983561934516227 %}

### Return several types using **Union** Types!👇

{% twitter 1072132577631309824 %}

### Use **Aliases** 🔥 to rename the result of a field 👇

{% twitter 1072147677318651906 %}

### Don’t **over-engineer**, you can query with fetch👇

{% twitter 1072242050249166848 %}

### DRY ♻️, use **fragments**!

{% twitter 1072876237301932032 %}

### Get rid off your variables using **Input Types** 👇

{% twitter 1073229966219862016 %}

## Extra 🌟

### Don’t miss the 1st part of a series resuming PayPal’s best practices for building GraphQL APIs 👇
[**GraphQL Resolvers: Best Practices**
*GraphQL resolvers can be easy to build, but difficult to get right. Here’s a look at PayPal’s best practices for…*medium.com](https://medium.com/paypal-engineering/graphql-resolvers-best-practices-cd36fdbcef55)

## Recapping

**👉 [Modularize 👌 **your typeDefs & resolvers](https://twitter.com/swcarlosrj/status/1067288762810535936)
👉 [“Break your schema by **concern**, not by types“ — Martijn Walraven](https://twitter.com/swcarlosrj/status/1067290487684571137)
👉 [DRY ♻️, use **context**!](https://twitter.com/swcarlosrj/status/1067497253294747650)
👉 [Evaluate whether your schema is **feature** or **domain** based](https://twitter.com/swcarlosrj/status/1067727612233928704)
👉 [Show what’s **important 👀 **first](https://twitter.com/swcarlosrj/status/1068048289755475968)
👉 [Decouple **global** typeDefs](https://twitter.com/swcarlosrj/status/1068432024371789824)!
👉 [Take advantage 🚀 of **ESNext](https://twitter.com/swcarlosrj/status/1068983561934516227)
👉 [**Return several types using **Union** Types](https://twitter.com/swcarlosrj/status/1068983561934516227)!
👉 [Use **Aliases** 🔥 to rename the result of a field](https://twitter.com/notrab/status/1072147677318651906)
👉 [Don’t over-engineer, you can **query** with **fetch](https://twitter.com/notrab/status/1072242050249166848)**
👉 [DRY ♻️, use **fragments**!](https://twitter.com/benawad97/status/1072876237301932032)
👉 [Get rid off your variables using **Input** Types](https://twitter.com/benawad97/status/1073229966219862016)

⭐️ [GraphQL Resolvers: Best Practices](https://medium.com/paypal-engineering/graphql-resolvers-best-practices-cd36fdbcef55)

**Already waiting to add yours 🤗, contribute adding more lessons learned 👇**

{% twitter 1067288761585799169 %}


## Or even better…

## Create posts 😀, courses 😄, meetups 😍, anything!, just be 🤗 and curious for teaching & learning 🚀

![](https://cdn-images-1.medium.com/max/3840/1*f6IMUipNmjSrEp9iEAX4sw.jpeg)

I’ll be following this post up 🔜 with more lessons learned, stay tuned!

Please, consider🙏🏻ing, contribut♻️ing and shar💜ing it!