apidays LIVE Australia - Building Business Ecosystems
Contract-first API development with Spot
Francois Wout, Developer Happiness Engineer at Airtasker
6. ��🏼 💻Done! The endpoint is /bookings.
��🏻♂Let's launch bookings on Web!PM
…
��🏼 💻OK, I'll implement an API endpoint to fetch bookings.
7. ��🏼 💻Let me add this to the endpoint.
� 👌
�
�🏾
��
Where do I find the scheduled date?
��🏼 💻I've added `scheduled_date`.
It's an int timestamp but it can be null too.
…
19. �
�🏾
��
How about adding scheduled_date too?
��🏼 💻👍 I added scheduled_date of type int or null.
��🏼 💻Done!
Suggestion: scheduled_date of type string
��🏻 💻
20. �
�🏾
����🏻 💻✅ ✅ ✅
��🏼 💻Thanks! I'll start implementing now.
��🏼 💻👍 I've added a pagination cursor.
Will the endpoint be paginated?
��🏼 💻
22. Sharing a doc
Simple and helpful
Very collaborative
Leads to a better API
- Details can be missed
- Informal review process
- Easily gets out of date
39. Spot Workflow
1. Draft API contract with Spot (e.g. in VS Code)
2. Send a PR to interested engineers to gather feedback
3. Merge the PR
4. Then in parallel:
○ API engineer implements the new API
○ Client engineers implement new features based on the API
Upfront API design facilitates parallel development
41. Tooling
● Documentation
○ spot docs api.ts
● Client code generation
○ leveraging OpenAPI client generators (e.g. SwiftGen)
○ no more implementation mistakes!
● API contract testing
○ https://github.com/airtasker/spot/wiki/Contract-Testing
● Linting based on API guidelines
○ spot lint api.ts
● Mock API server
○ spot mock api.ts
42. Probably.
● No need to be familiar with TypeScript
○ quickly adopted at Airtasker by Ruby, Kotlin, Swift engineers
● Easy to integrate into your existing PR review process
● ⚠ Spot is only for JSON REST APIs
○ alternative to GraphQL, gRPC and Thrift
○ Spot is inspired by gRPC
● It's still early days (our docs need some ❤)
Is Spot good for my team?
43. Want to learn more?
Spot is open source!
https://github.com/airtasker/spot
44. Thank you!
@fwouts
Come work with me at Airtasker!
We're hiring:
● Senior Software Engineers
● VP of Engineering
https://fwouts.com