GitHub Hesham Salman Sep 23, 2020

GitHub Mobile and GraphQL

Article Summary

Hesham Salman from GitHub reveals how GraphQL eliminated over-fetching and let their mobile team ship features at warp speed. The secret? Letting the client define exactly what data it needs.

GitHub's mobile engineering team adopted GraphQL and Apollo clients for iOS and Android, fundamentally changing how they build features. This shift moved them away from REST endpoints and manual model management toward automated code generation and composable data queries.

Key Takeaways

Critical Insight

GraphQL and Apollo abstracted away networking tedium, letting GitHub's mobile team focus on building features instead of maintaining API infrastructure.

The article reveals a specific fragment pattern GitHub uses heavily across their app that keeps models consistent and queries short.

About This Article

Problem

GitHub's mobile team ran into platform-specific issues when implementing GraphQL. Apollo's Kotlin support was still early, and some fragments like those on interfaces could only be generated for iOS. This meant the iOS and Android codebases were diverging.

Solution

Hesham Salman's team found that Apollo generated similar code patterns in both languages. They stuck more closely to Apollo-GraphQL's standard types to cut down on platform-specific workarounds. Meanwhile, the Apollo team worked on better support across both platforms.

Impact

The generated code turned out to be similar enough between iOS and Kotlin that the team could use it the same way on both platforms. This let them keep their code consistent without having to make major changes between iOS and Android.