apis as the source of truth (zane claes)
TRANSCRIPT
Airbnb’s API:The Source-of-Truth
COMMUNICATIONS INFRASTRUCTURE / ZANE CLAES
Airbnb Mobile Evolution
(2011 - 2015)
Ghosts of Airbnb Past
Or: How we Became API-Centric
The Dangers of Hockey Sticks
API v1(Ruby / Monorail)
API v1 Web Controller
• Duplicated Work: Web. Mobile Apps. MoWeb. Lantern. Etc.
• Inconsistent Behavior: Entirely different code paths. Payments on mobile, different than payments on web.
• Difficult to Scale: Direct data access prevents moving to Service-oriented Architecture. Monorail contains too many tables.
• Poor Security: Access enabled by default. Leaks PII. Difficult to have good security policy.
• No Type Safety: Crashes app, due to unpredictable types in returned fields.
• More Website Downtime: Due to cascading updates, and service entanglement.
Problems
API v1 Web Controller
Graphist(A Ruby Gem/Framework for Building APIs)
• Code Reusability: Write once. Share with web, mobile, etc.
• Consistency: Everything works the same across platforms.
• Security: Security is at the forefront: do not leak sensitive data.
• Performance: Process more stuff, faster. API v2 is continuously improved and optimized.
• Scalability: Easier to move to Service-oriented Architecture. Free to change and improve underlying functionality.
• Better Debugging: Now you can actually debug.
Benefitsof API v2 (“Graphist”)
• Hundreds of Developers• Thousands of Endpoints• Dozens of Services
Where it’s Used
Graphist: Our Ruby Gem for APIs
(2016 and Beyond)
Android
Javascript
iOS
Graphist
Ruby
HTTP
Inline
Services
Graphist is a DAO (“Data Access Object”)
RESTor
GraphQL
REST and GraphQL are Interchangeable
Client Graphist
No need to change a single line of code.
Client-CentricShifts the impetus of “formats” to the client; no more dev back-and-forth.
EfficientSolves over-fetching, under-fetching, even versioning; cross-platform tools.
CommunityReady-made developer tools: sandbox, documentation explorer.
FlexibleAllows for arbitrary functions, renamed attributes, and more.
Why GraphQL?
Client
User ServiceClient
Listing Service
Review Service
Client
Microservice Distributed DAOs