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
- Apollo's code generation eliminates manual network model creation and maintenance entirely
- Fragments enable reusable GraphQL pieces, reducing repetition across queries
- Field-level deprecation prevents backend changes from breaking mobile clients
- Mindset shifts from HTTP endpoints to types, queries, and mutations
- Clients request only needed data, eliminating bloated responses
GraphQL and Apollo abstracted away networking tedium, letting GitHub's mobile team focus on building features instead of maintaining API infrastructure.
About This Article
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.
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.
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.