Upgrade to Pro — share decks privately, control downloads, hide ads and more …

API First Architecture Transformation at Etsy

linse
October 25, 2016

API First Architecture Transformation at Etsy

At Etsy we have been doing some pioneering work with our web APIs. We switched to API-first design, have experimented with concurrency handling in our composition layer, introduced strong typing into our API design, experimented with code generation, and built distributed tracing tools for the API as part of this project. We faced a common challenge: much of our logic was implemented twice. All of the code that was built for the website then had to be rebuilt in our API to be used by our iOS and Android apps. We wanted an approach where we built everything on reusable API components that could be shared between the web and API. Unfortunately, our existing API framework couldn’t support this shared approach. The solution we settled on was to abandon the existing framework and rebuild it from scratch. Follow along this case study of building an API First architecture. Hear what problems prompted this drastic change. Learn which new tools we had to build to be able to work with the new system and what mistakes we made along the way. Finally, how did it end? How did the team adopt the new system and have we succeeded in our goals of API First? From our learnings, can we make the adoption of new systems and ideas easier for everyone?

linse

October 25, 2016
Tweet

Other Decks in Programming

Transcript

  1. DB model controller Logic A controller Logic B view view

    Logic A Logic B API v2 Logic A Logic B iOS App Logic A Logic B Android App Logic A Logic B
  2. “We desperately need to figure out a scheme for allowing

    concurrency or else we're going to have performance problems forever.” - Andrew Morrison (Etsy)
  3. keep it REST (as in v2) declaration of endpoints in

    code input validation Ideas we kept v3!
  4. shop updates favorites picks for you favorite shops friends activity

    shop explore from blog favorites favorite shops friends activity from blog featured shop story card story card listing card listing card shop card shop card listing card …
  5. bespoke homepage favorites favorite shops friends activity story card story

    card listing card listing card shop card shop card listing card … cURL multi cURL multi cURL multi cURL multi …
  6. bespoke homepage favorites favorite shops friends activity story card story

    card listing card listing card shop card shop card listing card … cURL multi cURL multi cURL multi cURL multi … bespoke
  7. bespoke homepage favorites favorite shops friends activity story card story

    card listing card listing card shop card shop card listing card … cURL multi cURL multi cURL multi cURL multi … bespoke concurrent
  8. bespoke homepage favorites favorite shops friends activity story card story

    card listing card listing card shop card shop card listing card … cURL multi cURL multi cURL multi cURL multi … bespoke concurrent component
  9. Język dziedzinowy DSL of Etsy endpoints domänenspezifische Sprache von Endpunkten

    langage dédié هنماد هب صتخم نابز ϮαЀࢴํ᥺承
  10. HHVM Average Response Time 12 Hour PHP 5 / Zend

    Average Response Time 12 Hour
  11. iOS team: contract between set of items an endpoint will

    return, set of items that the app knows how to format. code organization: compiler in same space as endpoints ಠ_ಠ inventory team: we can compose endpoints, but for composable views we still have to repeat things. Can we lift composability into the view? android team: can we mock a typed resource? Can we automatically traverse it? homepage team: make API type errors more prominent to enforce guarantees.
  12. “We desperately need to figure out a scheme for allowing

    concurrency or else we're going to have performance problems forever.” - Andrew Morrison (Etsy) ✓