SlideShare a Scribd company logo
1 of 34
Download to read offline
From micro to macro
coordination
Through domain centric DDL pipeline
Alex Khilko, CTO
PlayQ Inc.
Alex Khilko, CTO
PlayQ Inc.
API Days Live, From Micro to Macro Coordination, Sep 2020
PlayQ
2
Domain: Mobile Games
Distributed Team: California USA,
Ireland, Ukraine, Australia
Tech: Client and back-office facing
platform serving millions of players
API Days Live, From Micro to Macro Coordination, Sep 2020
PlayQ Platform
3
Areas Covered: Authentication, Analytics, Cloud Storage,
Real-time leaderboards, Payments, Ad-Networks & attribution
providers integrations, Push Notifications, Orchestration…
Term: 4 years in production
Languages:
API Days Live, From Micro to Macro Coordination, Sep 2020 4
20+ High-performance services: 10-70ms response for the 99th
percentile
PlayQ Platform
API Days Live, From Micro to Macro Coordination, Sep 2020 5
Services Team: 6 persons
PlayQ Platform
API Days Live, From Micro to Macro Coordination, Sep 2020 6
Services API development
API Days Live, From Micro to Macro Coordination, Sep 2020 7
API Design Breakdown
Business Logic
Domain Design
Dispatchers
Models & Codecs
Routing
Transport
If user A is of org B, then do C
There are entities: Users, Organizations
Logic execution dispatching
Entity representation: on the wire
Delivery routing: URIs, Path, Versions, ...
Delivery mechanism: HTTP, Sockets, ...
API
API Days Live, From Micro to Macro Coordination, Sep 2020 8
Problems
1. Information is fragmented and decentralized Business Logic
Domain Design
Dispatchers
Models & Codecs
Routing
Transport
- Coming from multiple stakeholders
- Written and delivered using Confluence, Spreadsheets, emails,
etc.
- Ad-hoc requests
- Often times is incomplete, especially during design phase
API
API Days Live, From Micro to Macro Coordination, Sep 2020 9
Business Logic
Domain Design
Dispatchers
Models & Codecs
Routing
Transport
- Entities are usually complex: hierarchical, relational
- Composition is not engineer friendly
API
Problems
1. Information is fragmented and decentralized
2. No solutions to map business domain to code
API Days Live, From Micro to Macro Coordination, Sep 2020 1
0
Problems
1. Information is fragmented and decentralized
2. No solutions to map business domain to code
3. Most work is very mechanical and
time-consuming
Business Logic
Domain Design
Dispatchers
Models & Codecs
Routing
Transport- Once entities are designed, require a lot of mechanical work to reflect them in code
- Coordination with other teams / consumers to make sure implementation is
consistent
- Team interlocking
API
API Days Live, From Micro to Macro Coordination, Sep 2020 11
Problems
1. Information is fragmented and decentralized
2. No solutions to map business domain to code
3. Most work is very mechanical and
time-consuming
4. Evolution and Refactoring is very error prone
Business Logic
Domain Design
Dispatchers
Models & Codecs
Routing
Transport
- Any change in the upper layers, has to be propagated down
- Any error in the upper layers, has to be fixed all the way
down
API
API Days Live, From Micro to Macro Coordination, Sep 2020 12
Multiplied with every new consumer
Business Logic
Domain Design
Dispatchers
Models & Codecs
Routing
Transport
Business Logic
Domain Design
Dispatchers
Models & Codecs
Routing
Transport
Business Logic
Domain Design
Dispatchers
Models & Codecs
Routing
Transport
Business Logic
Domain Design
Dispatchers
Models & Codecs
Routing
Transport
API
API Days Live, From Micro to Macro Coordination, Sep 2020 13
Solution
1. Single source of truth
2. Rich type system
3. Full reliance on code generation
4. CI/CD based changes propagation
https://izumi.7mind.io/idealingua/
API
API Days Live, From Micro to Macro Coordination, Sep 2020 14
Single Source of Truth
API
API Days Live, From Micro to Macro Coordination, Sep 2020 15
Rich Type System
package user.api
enum Role = Admin | Moderator | User
id EntityID {
uuid: uuid
}
mixin Entity {
id: EntityID
}
mixin Person {
name: str
surname: str
role: Role
}
data User {
& Entity
+ Person
password: str
}
data PublicUser {
+ User
- password: str
}
adt Result = Success | Failure
data Success {
message: str
}
data Failure {
code: int8
}
API
API Days Live, From Micro to Macro Coordination, Sep 2020 16
Intuitive & Easy to read definitions
mixin Pet {
}
enum HuntingSkill {
lazy
clueless
}
/**
* A representation of a cat
*/
data Cat {
&Pet
/**
* The measured skill for hunting
* @default lazy
*/
huntingSkill: HuntingSkill
}
"Cat": {
"description": "A representation of a cat",
"allOf": [
{
"$ref": "#/definitions/Pet"
},
{
"type": "object",
"properties": {
"huntingSkill": {
"type": "string",
"description": "The measured skill for hunting",
"default": "lazy",
"enum": [
"clueless",
"lazy"
]
API
vs
API Days Live, From Micro to Macro Coordination, Sep 2020 17
Full Reliance on Code Generation
mixin Person {
name: str
surname: str
role: Role
}
data User {
& Entity
+ Person
password: str
}
data PublicUser {
+ User
- password: str
}
API
API Days Live, From Micro to Macro Coordination, Sep 2020 18
CI / CD Changes Propagation
mixin Person {
name: str
surname: str
role: Role
}
Change
CI / CD
API
API Days Live, From Micro to Macro Coordination, Sep 2020 19
Authentication Service
API Example
API Days Live, From Micro to Macro Coordination, Sep 2020 20
Providers support:
1. Support Email login
2. Support Google login
Auth Service
API Days Live, From Micro to Macro Coordination, Sep 2020
data LoginWithEmail {
email: string
passHash: string
}
data LoginWithGoogle {
accessToken: string
}
adt LoginRequest {
LoginWithEmail
LoginWithGoogle
}
21
Domain Models
data LoginResponse {
name: string
}
data GenericFailure {
code: int
message: string
}
service AuthService {
def login(data: LoginRequest) => LoginResponse !! GenericFailure
}
Auth Service
API Days Live, From Micro to Macro Coordination, Sep 2020 22
Iteration 2 changes:
Add support for companyId, so we can have
multi-tenant deployment.
Auth Service
API Days Live, From Micro to Macro Coordination, Sep 2020 23
Domain Models (rev 2)
mixin LoginWith {
companyId: CompanyID
}
data LoginWithEmail {
&LoginWith
email: string
passHash: string
}
data LoginWithGoogle {
&LoginWith
accessToken: string
}
adt LoginRequest {
LoginWithEmail
LoginWithGoogle
}
data LoginResponse {
name: string
}
data GenericFailure {
code: int
message: string
}
service AuthService {
def login(data: LoginRequest) => LoginResponse !! GenericFailure
}
Auth Service
API Days Live, From Micro to Macro Coordination, Sep 2020 24
TypeScript Models Generated
mixin LoginWith {
companyId: CompanyID
}
data LoginWithEmail {
&LoginWith
email: string
passHash: string
}
Auth Service
API Days Live, From Micro to Macro Coordination, Sep 2020 25
TypeScript Client Generated
service AuthService {
def login(data: LoginRequest) => LoginResponse !! GenericFailure
}
Auth Service
API Days Live, From Micro to Macro Coordination, Sep 2020 26
// Client Definition
export declare class AuthServiceClient implements IAuthServiceClient {
login(data: LoginRequest): Promise<LoginResponse | BasicFailure>;
}
// Server Definition
export interface IAuthServiceServer<C> {
login(context: C, data: LoginRequest): Promise<LoginResponse | GenericFailure>;
}
TypeScript Client & Server Generated
Auth Service
API Days Live, From Micro to Macro Coordination, Sep 2020 27
Iteration 3 changes:
Add support for 2-factor authentication during login.
Auth Service
API Days Live, From Micro to Macro Coordination, Sep 2020 28
Domain Models (rev 3)
data LoginResponse {
name: string
}
data MfaRequest {
message: string
token: string
}
adt LoginResult {
LoginResponse
MfaRequest
}
data LoginWith2FA {
code: string
token: string
}
data GenericFailure {
code: int
message: string
}
adt LoginRequest {
LoginWithEmail
LoginWithGoogle
LoginWith2FA
}
service AuthService {
def login(data: LoginRequest) => LoginResult !! GenericFailure
}
Auth Service
API Days Live, From Micro to Macro Coordination, Sep 2020 29
TypeScript Client Change
if (loginResponse instanceof MfaRequest) {
// TODO Ask user for a code and retry login
return;
}
// Successful, continue with execution
Auth Service
API Days Live, From Micro to Macro Coordination, Sep 2020 30
Summary
API Days Live, From Micro to Macro Coordination, Sep 2020 31
1. Roughly 60-70% of the code is generated (e.g. 250K generated
vs 95K actual business code in TypeScript codebase, 187K vs
120K in Scala)
2. We focus only on business logic and design
3. Every stakeholder contributes in an async way
4. No coordination on UserName or user_name when it comes to
actual implementation
5. Any API / Design change is immediately visible to all consumers
6. Refactoring is orders of magnitude easier
7. New APIs and changes through pull requests
8. Integration is a bliss and error free, no typos or missing data
Business Logic
Domain Design
Dispatchers
Models & Codecs
Routing
Transport
Summary
API Days Live, From Micro to Macro Coordination, Sep 2020 32
Q & A
Alex Khilko
akhilko@playq.net
API Days Live, From Micro to Macro Coordination, Sep 2020 33
Through evolution:
1. Add new services
2. Add new methods to existing services
3. Add new optional fields to existing models
4. Add new models
Through deployment address:
1. Version 1: /api/v1
2. Version 2: /api/v2
Through custom headers routing
Versioning
API Days Live, From Micro to Macro Coordination, Sep 2020 34
1. Extensive primitive types, including Date, Time, DateTime with offsets, signed
/ unsigned numbers, and so on.
2. Unique algebraic and ID types
3. Definitions are parsed and AST is built using all of the inheritance, structural
composition information
4. Code is generated, not templated, making each language transpiler unique
and that follows semantics of the target language
5. Vertically sliced, making switching any layer an easy process: for instance
going from HTTP to WebSockets requires zero changes to the logic
6. Built-in support for HTTP and WebSocket transports, routing, JSON encoding
7. Server to Client requests system
8. Generated codecs tests
9. Converters: expand / contract are generated
Unique Features

More Related Content

What's hot

Design and Evolution of APIs in Microservice Architecture
Design and Evolution of APIs in Microservice ArchitectureDesign and Evolution of APIs in Microservice Architecture
Design and Evolution of APIs in Microservice Architecture
Lohika_Odessa_TechTalks
 

What's hot (20)

Design and Evolution of APIs in Microservice Architecture
Design and Evolution of APIs in Microservice ArchitectureDesign and Evolution of APIs in Microservice Architecture
Design and Evolution of APIs in Microservice Architecture
 
Cloud Aware Large Scale Distributed SOA
Cloud Aware Large Scale Distributed SOACloud Aware Large Scale Distributed SOA
Cloud Aware Large Scale Distributed SOA
 
apidays LIVE Helsinki & North - 20 minutes to build a serverless COVID-19 RES...
apidays LIVE Helsinki & North - 20 minutes to build a serverless COVID-19 RES...apidays LIVE Helsinki & North - 20 minutes to build a serverless COVID-19 RES...
apidays LIVE Helsinki & North - 20 minutes to build a serverless COVID-19 RES...
 
apidays LIVE Hong Kong 2021 - GraphQL : Beyond APIs, graph your enterprise by...
apidays LIVE Hong Kong 2021 - GraphQL : Beyond APIs, graph your enterprise by...apidays LIVE Hong Kong 2021 - GraphQL : Beyond APIs, graph your enterprise by...
apidays LIVE Hong Kong 2021 - GraphQL : Beyond APIs, graph your enterprise by...
 
apidays LIVE Paris 2021 - OpenAPI Generator - The Babel Fish of the API World...
apidays LIVE Paris 2021 - OpenAPI Generator - The Babel Fish of the API World...apidays LIVE Paris 2021 - OpenAPI Generator - The Babel Fish of the API World...
apidays LIVE Paris 2021 - OpenAPI Generator - The Babel Fish of the API World...
 
apidays LIVE Australia 2020 - API Design in Fintech: Challenges and Opportuni...
apidays LIVE Australia 2020 - API Design in Fintech: Challenges and Opportuni...apidays LIVE Australia 2020 - API Design in Fintech: Challenges and Opportuni...
apidays LIVE Australia 2020 - API Design in Fintech: Challenges and Opportuni...
 
apidays LIVE Australia 2020 - Contract-first API development with Spot by Fra...
apidays LIVE Australia 2020 - Contract-first API development with Spot by Fra...apidays LIVE Australia 2020 - Contract-first API development with Spot by Fra...
apidays LIVE Australia 2020 - Contract-first API development with Spot by Fra...
 
[API World 2021 ] - Understanding Cloud Native Deployment
[API World 2021 ] - Understanding Cloud Native Deployment[API World 2021 ] - Understanding Cloud Native Deployment
[API World 2021 ] - Understanding Cloud Native Deployment
 
APIdays Singapore 2019 - Airbnb's Great Migration: Service APIs at scale, Jes...
APIdays Singapore 2019 - Airbnb's Great Migration: Service APIs at scale, Jes...APIdays Singapore 2019 - Airbnb's Great Migration: Service APIs at scale, Jes...
APIdays Singapore 2019 - Airbnb's Great Migration: Service APIs at scale, Jes...
 
apidays LIVE New York 2021 - Introduction to HATEOAS with Ketting by Evert Po...
apidays LIVE New York 2021 - Introduction to HATEOAS with Ketting by Evert Po...apidays LIVE New York 2021 - Introduction to HATEOAS with Ketting by Evert Po...
apidays LIVE New York 2021 - Introduction to HATEOAS with Ketting by Evert Po...
 
Tools and techniques for APIs
Tools and techniques for APIsTools and techniques for APIs
Tools and techniques for APIs
 
Rest api best practices – comprehensive handbook
Rest api best practices – comprehensive handbookRest api best practices – comprehensive handbook
Rest api best practices – comprehensive handbook
 
apidays LIVE Paris 2021 - Building an Accessible API Spec with Traditional En...
apidays LIVE Paris 2021 - Building an Accessible API Spec with Traditional En...apidays LIVE Paris 2021 - Building an Accessible API Spec with Traditional En...
apidays LIVE Paris 2021 - Building an Accessible API Spec with Traditional En...
 
apidays LIVE Australia 2021 - From apps to APIs: how no-code is transforming ...
apidays LIVE Australia 2021 - From apps to APIs: how no-code is transforming ...apidays LIVE Australia 2021 - From apps to APIs: how no-code is transforming ...
apidays LIVE Australia 2021 - From apps to APIs: how no-code is transforming ...
 
Hybrid API Management with Kong - Ivan Rylach, Kong Summit, 2020
Hybrid API Management with Kong - Ivan Rylach, Kong Summit, 2020Hybrid API Management with Kong - Ivan Rylach, Kong Summit, 2020
Hybrid API Management with Kong - Ivan Rylach, Kong Summit, 2020
 
apidays LIVE JAKARTA - 10 commandments for scalable microservices by Archanaa...
apidays LIVE JAKARTA - 10 commandments for scalable microservices by Archanaa...apidays LIVE JAKARTA - 10 commandments for scalable microservices by Archanaa...
apidays LIVE JAKARTA - 10 commandments for scalable microservices by Archanaa...
 
apidays LIVE Paris 2021 - 20 Minutes to Build a Serverless COVID-19 GraphQL A...
apidays LIVE Paris 2021 - 20 Minutes to Build a Serverless COVID-19 GraphQL A...apidays LIVE Paris 2021 - 20 Minutes to Build a Serverless COVID-19 GraphQL A...
apidays LIVE Paris 2021 - 20 Minutes to Build a Serverless COVID-19 GraphQL A...
 
apidays LIVE Helsinki - Implementing OpenAPI and GraphQL Services with gRPC b...
apidays LIVE Helsinki - Implementing OpenAPI and GraphQL Services with gRPC b...apidays LIVE Helsinki - Implementing OpenAPI and GraphQL Services with gRPC b...
apidays LIVE Helsinki - Implementing OpenAPI and GraphQL Services with gRPC b...
 
VLSI Projects Titles
VLSI Projects TitlesVLSI Projects Titles
VLSI Projects Titles
 
Austin API Summit 2018: Are REST APIs Still Relevant Today?
Austin API Summit 2018: Are REST APIs Still Relevant Today?Austin API Summit 2018: Are REST APIs Still Relevant Today?
Austin API Summit 2018: Are REST APIs Still Relevant Today?
 

Similar to apidays LIVE Australia 2020 - From micro to macro-coordination through domain-centric DDL pipeline by Alex Khilko

Similar to apidays LIVE Australia 2020 - From micro to macro-coordination through domain-centric DDL pipeline by Alex Khilko (20)

Swagger & OpenAPI Spec #openapi
Swagger & OpenAPI Spec #openapiSwagger & OpenAPI Spec #openapi
Swagger & OpenAPI Spec #openapi
 
apidays LIVE Hong Kong - The Business of APIs by Jed Ng
apidays LIVE Hong Kong - The Business of APIs by Jed Ngapidays LIVE Hong Kong - The Business of APIs by Jed Ng
apidays LIVE Hong Kong - The Business of APIs by Jed Ng
 
Support unlimited and ever changing customer experiences with GraphQL by Andr...
Support unlimited and ever changing customer experiences with GraphQL by Andr...Support unlimited and ever changing customer experiences with GraphQL by Andr...
Support unlimited and ever changing customer experiences with GraphQL by Andr...
 
apidays Helsinki & North 2023 - API Security in the era of Generative AI, Mat...
apidays Helsinki & North 2023 - API Security in the era of Generative AI, Mat...apidays Helsinki & North 2023 - API Security in the era of Generative AI, Mat...
apidays Helsinki & North 2023 - API Security in the era of Generative AI, Mat...
 
How to build containerized architectures for deep learning - Data Festival 20...
How to build containerized architectures for deep learning - Data Festival 20...How to build containerized architectures for deep learning - Data Festival 20...
How to build containerized architectures for deep learning - Data Festival 20...
 
Catalogue ditriot consulting
Catalogue ditriot consultingCatalogue ditriot consulting
Catalogue ditriot consulting
 
Microservicios net arquitectura para aplicaciones net contenerizadas - net ...
Microservicios net   arquitectura para aplicaciones net contenerizadas - net ...Microservicios net   arquitectura para aplicaciones net contenerizadas - net ...
Microservicios net arquitectura para aplicaciones net contenerizadas - net ...
 
Evolving your Data Access with MongoDB Stitch - Drew Di Palma
Evolving your Data Access with MongoDB Stitch - Drew Di PalmaEvolving your Data Access with MongoDB Stitch - Drew Di Palma
Evolving your Data Access with MongoDB Stitch - Drew Di Palma
 
Z101666 best practices for delivering hybrid cloud capability with apis
Z101666 best practices for delivering hybrid cloud capability with apisZ101666 best practices for delivering hybrid cloud capability with apis
Z101666 best practices for delivering hybrid cloud capability with apis
 
SVQdotNET: Building APIs with OpenApi
SVQdotNET: Building APIs with OpenApiSVQdotNET: Building APIs with OpenApi
SVQdotNET: Building APIs with OpenApi
 
Creating Datadipity
Creating DatadipityCreating Datadipity
Creating Datadipity
 
z/OS Connect - Overview at the "z Systems Agile Enterprise Development Confer...
z/OS Connect - Overview at the "z Systems Agile Enterprise Development Confer...z/OS Connect - Overview at the "z Systems Agile Enterprise Development Confer...
z/OS Connect - Overview at the "z Systems Agile Enterprise Development Confer...
 
Metaverse and Digital Twins on Enterprise-Public.pdf
Metaverse and Digital Twins on Enterprise-Public.pdfMetaverse and Digital Twins on Enterprise-Public.pdf
Metaverse and Digital Twins on Enterprise-Public.pdf
 
From on premises monolith to cloud microservices
From on premises monolith to cloud microservicesFrom on premises monolith to cloud microservices
From on premises monolith to cloud microservices
 
apidays Paris 2022 - Blurred Lines, Denis Jannot, Solo.io
apidays Paris 2022 - Blurred Lines, Denis Jannot, Solo.ioapidays Paris 2022 - Blurred Lines, Denis Jannot, Solo.io
apidays Paris 2022 - Blurred Lines, Denis Jannot, Solo.io
 
$10,000 Phantom App & Playbook Contest - F5 and Cisco Meraki
$10,000 Phantom App & Playbook Contest - F5 and Cisco Meraki$10,000 Phantom App & Playbook Contest - F5 and Cisco Meraki
$10,000 Phantom App & Playbook Contest - F5 and Cisco Meraki
 
Dynatrace: Going beyond APM and soaring to the future
Dynatrace: Going beyond APM and soaring to the futureDynatrace: Going beyond APM and soaring to the future
Dynatrace: Going beyond APM and soaring to the future
 
Steve Bennett .Net Architect/Developer Resume
Steve Bennett .Net Architect/Developer ResumeSteve Bennett .Net Architect/Developer Resume
Steve Bennett .Net Architect/Developer Resume
 
WSO2 ITALIA SMART TALK #4 - Telefonica Use Case
WSO2 ITALIA SMART TALK #4 - Telefonica Use CaseWSO2 ITALIA SMART TALK #4 - Telefonica Use Case
WSO2 ITALIA SMART TALK #4 - Telefonica Use Case
 
Building Your First App with MongoDB Stitch
Building Your First App with MongoDB StitchBuilding Your First App with MongoDB Stitch
Building Your First App with MongoDB Stitch
 

More from apidays

More from apidays (20)

Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Apidays New York 2024 - The secrets to Graph success, by Leah Hurwich Adler, ...
Apidays New York 2024 - The secrets to Graph success, by Leah Hurwich Adler, ...Apidays New York 2024 - The secrets to Graph success, by Leah Hurwich Adler, ...
Apidays New York 2024 - The secrets to Graph success, by Leah Hurwich Adler, ...
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Apidays New York 2024 - API Discovery - From Crawl to Run by Rob Dickinson, G...
Apidays New York 2024 - API Discovery - From Crawl to Run by Rob Dickinson, G...Apidays New York 2024 - API Discovery - From Crawl to Run by Rob Dickinson, G...
Apidays New York 2024 - API Discovery - From Crawl to Run by Rob Dickinson, G...
 
Apidays Singapore 2024 - Building with the Planet in Mind by Sandeep Joshi, M...
Apidays Singapore 2024 - Building with the Planet in Mind by Sandeep Joshi, M...Apidays Singapore 2024 - Building with the Planet in Mind by Sandeep Joshi, M...
Apidays Singapore 2024 - Building with the Planet in Mind by Sandeep Joshi, M...
 
Apidays Singapore 2024 - Connecting Cross Border Commerce with Payments by Gu...
Apidays Singapore 2024 - Connecting Cross Border Commerce with Payments by Gu...Apidays Singapore 2024 - Connecting Cross Border Commerce with Payments by Gu...
Apidays Singapore 2024 - Connecting Cross Border Commerce with Payments by Gu...
 
Apidays Singapore 2024 - Privacy Enhancing Technologies for AI by Mark Choo, ...
Apidays Singapore 2024 - Privacy Enhancing Technologies for AI by Mark Choo, ...Apidays Singapore 2024 - Privacy Enhancing Technologies for AI by Mark Choo, ...
Apidays Singapore 2024 - Privacy Enhancing Technologies for AI by Mark Choo, ...
 
Apidays Singapore 2024 - Blending AI and IoT for Smarter Health by Matthew Ch...
Apidays Singapore 2024 - Blending AI and IoT for Smarter Health by Matthew Ch...Apidays Singapore 2024 - Blending AI and IoT for Smarter Health by Matthew Ch...
Apidays Singapore 2024 - Blending AI and IoT for Smarter Health by Matthew Ch...
 
Apidays Singapore 2024 - OpenTelemetry for API Monitoring by Danielle Kayumbi...
Apidays Singapore 2024 - OpenTelemetry for API Monitoring by Danielle Kayumbi...Apidays Singapore 2024 - OpenTelemetry for API Monitoring by Danielle Kayumbi...
Apidays Singapore 2024 - OpenTelemetry for API Monitoring by Danielle Kayumbi...
 
Apidays Singapore 2024 - Connecting Product and Engineering Teams with Testin...
Apidays Singapore 2024 - Connecting Product and Engineering Teams with Testin...Apidays Singapore 2024 - Connecting Product and Engineering Teams with Testin...
Apidays Singapore 2024 - Connecting Product and Engineering Teams with Testin...
 
Apidays Singapore 2024 - The Growing Carbon Footprint of Digitalization and H...
Apidays Singapore 2024 - The Growing Carbon Footprint of Digitalization and H...Apidays Singapore 2024 - The Growing Carbon Footprint of Digitalization and H...
Apidays Singapore 2024 - The Growing Carbon Footprint of Digitalization and H...
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Apidays Singapore 2024 - API Monitoring x SRE by Ryan Ashneil and Eugene Wong...
Apidays Singapore 2024 - API Monitoring x SRE by Ryan Ashneil and Eugene Wong...Apidays Singapore 2024 - API Monitoring x SRE by Ryan Ashneil and Eugene Wong...
Apidays Singapore 2024 - API Monitoring x SRE by Ryan Ashneil and Eugene Wong...
 
Apidays Singapore 2024 - A nuanced approach on AI costs and benefits for the ...
Apidays Singapore 2024 - A nuanced approach on AI costs and benefits for the ...Apidays Singapore 2024 - A nuanced approach on AI costs and benefits for the ...
Apidays Singapore 2024 - A nuanced approach on AI costs and benefits for the ...
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
 
Apidays Singapore 2024 - How APIs drive business at BNP Paribas by Quy-Doan D...
Apidays Singapore 2024 - How APIs drive business at BNP Paribas by Quy-Doan D...Apidays Singapore 2024 - How APIs drive business at BNP Paribas by Quy-Doan D...
Apidays Singapore 2024 - How APIs drive business at BNP Paribas by Quy-Doan D...
 

Recently uploaded

IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Enterprise Knowledge
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
Earley Information Science
 

Recently uploaded (20)

IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 

apidays LIVE Australia 2020 - From micro to macro-coordination through domain-centric DDL pipeline by Alex Khilko

  • 1. From micro to macro coordination Through domain centric DDL pipeline Alex Khilko, CTO PlayQ Inc. Alex Khilko, CTO PlayQ Inc.
  • 2. API Days Live, From Micro to Macro Coordination, Sep 2020 PlayQ 2 Domain: Mobile Games Distributed Team: California USA, Ireland, Ukraine, Australia Tech: Client and back-office facing platform serving millions of players
  • 3. API Days Live, From Micro to Macro Coordination, Sep 2020 PlayQ Platform 3 Areas Covered: Authentication, Analytics, Cloud Storage, Real-time leaderboards, Payments, Ad-Networks & attribution providers integrations, Push Notifications, Orchestration… Term: 4 years in production Languages:
  • 4. API Days Live, From Micro to Macro Coordination, Sep 2020 4 20+ High-performance services: 10-70ms response for the 99th percentile PlayQ Platform
  • 5. API Days Live, From Micro to Macro Coordination, Sep 2020 5 Services Team: 6 persons PlayQ Platform
  • 6. API Days Live, From Micro to Macro Coordination, Sep 2020 6 Services API development
  • 7. API Days Live, From Micro to Macro Coordination, Sep 2020 7 API Design Breakdown Business Logic Domain Design Dispatchers Models & Codecs Routing Transport If user A is of org B, then do C There are entities: Users, Organizations Logic execution dispatching Entity representation: on the wire Delivery routing: URIs, Path, Versions, ... Delivery mechanism: HTTP, Sockets, ... API
  • 8. API Days Live, From Micro to Macro Coordination, Sep 2020 8 Problems 1. Information is fragmented and decentralized Business Logic Domain Design Dispatchers Models & Codecs Routing Transport - Coming from multiple stakeholders - Written and delivered using Confluence, Spreadsheets, emails, etc. - Ad-hoc requests - Often times is incomplete, especially during design phase API
  • 9. API Days Live, From Micro to Macro Coordination, Sep 2020 9 Business Logic Domain Design Dispatchers Models & Codecs Routing Transport - Entities are usually complex: hierarchical, relational - Composition is not engineer friendly API Problems 1. Information is fragmented and decentralized 2. No solutions to map business domain to code
  • 10. API Days Live, From Micro to Macro Coordination, Sep 2020 1 0 Problems 1. Information is fragmented and decentralized 2. No solutions to map business domain to code 3. Most work is very mechanical and time-consuming Business Logic Domain Design Dispatchers Models & Codecs Routing Transport- Once entities are designed, require a lot of mechanical work to reflect them in code - Coordination with other teams / consumers to make sure implementation is consistent - Team interlocking API
  • 11. API Days Live, From Micro to Macro Coordination, Sep 2020 11 Problems 1. Information is fragmented and decentralized 2. No solutions to map business domain to code 3. Most work is very mechanical and time-consuming 4. Evolution and Refactoring is very error prone Business Logic Domain Design Dispatchers Models & Codecs Routing Transport - Any change in the upper layers, has to be propagated down - Any error in the upper layers, has to be fixed all the way down API
  • 12. API Days Live, From Micro to Macro Coordination, Sep 2020 12 Multiplied with every new consumer Business Logic Domain Design Dispatchers Models & Codecs Routing Transport Business Logic Domain Design Dispatchers Models & Codecs Routing Transport Business Logic Domain Design Dispatchers Models & Codecs Routing Transport Business Logic Domain Design Dispatchers Models & Codecs Routing Transport API
  • 13. API Days Live, From Micro to Macro Coordination, Sep 2020 13 Solution 1. Single source of truth 2. Rich type system 3. Full reliance on code generation 4. CI/CD based changes propagation https://izumi.7mind.io/idealingua/ API
  • 14. API Days Live, From Micro to Macro Coordination, Sep 2020 14 Single Source of Truth API
  • 15. API Days Live, From Micro to Macro Coordination, Sep 2020 15 Rich Type System package user.api enum Role = Admin | Moderator | User id EntityID { uuid: uuid } mixin Entity { id: EntityID } mixin Person { name: str surname: str role: Role } data User { & Entity + Person password: str } data PublicUser { + User - password: str } adt Result = Success | Failure data Success { message: str } data Failure { code: int8 } API
  • 16. API Days Live, From Micro to Macro Coordination, Sep 2020 16 Intuitive & Easy to read definitions mixin Pet { } enum HuntingSkill { lazy clueless } /** * A representation of a cat */ data Cat { &Pet /** * The measured skill for hunting * @default lazy */ huntingSkill: HuntingSkill } "Cat": { "description": "A representation of a cat", "allOf": [ { "$ref": "#/definitions/Pet" }, { "type": "object", "properties": { "huntingSkill": { "type": "string", "description": "The measured skill for hunting", "default": "lazy", "enum": [ "clueless", "lazy" ] API vs
  • 17. API Days Live, From Micro to Macro Coordination, Sep 2020 17 Full Reliance on Code Generation mixin Person { name: str surname: str role: Role } data User { & Entity + Person password: str } data PublicUser { + User - password: str } API
  • 18. API Days Live, From Micro to Macro Coordination, Sep 2020 18 CI / CD Changes Propagation mixin Person { name: str surname: str role: Role } Change CI / CD API
  • 19. API Days Live, From Micro to Macro Coordination, Sep 2020 19 Authentication Service API Example
  • 20. API Days Live, From Micro to Macro Coordination, Sep 2020 20 Providers support: 1. Support Email login 2. Support Google login Auth Service
  • 21. API Days Live, From Micro to Macro Coordination, Sep 2020 data LoginWithEmail { email: string passHash: string } data LoginWithGoogle { accessToken: string } adt LoginRequest { LoginWithEmail LoginWithGoogle } 21 Domain Models data LoginResponse { name: string } data GenericFailure { code: int message: string } service AuthService { def login(data: LoginRequest) => LoginResponse !! GenericFailure } Auth Service
  • 22. API Days Live, From Micro to Macro Coordination, Sep 2020 22 Iteration 2 changes: Add support for companyId, so we can have multi-tenant deployment. Auth Service
  • 23. API Days Live, From Micro to Macro Coordination, Sep 2020 23 Domain Models (rev 2) mixin LoginWith { companyId: CompanyID } data LoginWithEmail { &LoginWith email: string passHash: string } data LoginWithGoogle { &LoginWith accessToken: string } adt LoginRequest { LoginWithEmail LoginWithGoogle } data LoginResponse { name: string } data GenericFailure { code: int message: string } service AuthService { def login(data: LoginRequest) => LoginResponse !! GenericFailure } Auth Service
  • 24. API Days Live, From Micro to Macro Coordination, Sep 2020 24 TypeScript Models Generated mixin LoginWith { companyId: CompanyID } data LoginWithEmail { &LoginWith email: string passHash: string } Auth Service
  • 25. API Days Live, From Micro to Macro Coordination, Sep 2020 25 TypeScript Client Generated service AuthService { def login(data: LoginRequest) => LoginResponse !! GenericFailure } Auth Service
  • 26. API Days Live, From Micro to Macro Coordination, Sep 2020 26 // Client Definition export declare class AuthServiceClient implements IAuthServiceClient { login(data: LoginRequest): Promise<LoginResponse | BasicFailure>; } // Server Definition export interface IAuthServiceServer<C> { login(context: C, data: LoginRequest): Promise<LoginResponse | GenericFailure>; } TypeScript Client & Server Generated Auth Service
  • 27. API Days Live, From Micro to Macro Coordination, Sep 2020 27 Iteration 3 changes: Add support for 2-factor authentication during login. Auth Service
  • 28. API Days Live, From Micro to Macro Coordination, Sep 2020 28 Domain Models (rev 3) data LoginResponse { name: string } data MfaRequest { message: string token: string } adt LoginResult { LoginResponse MfaRequest } data LoginWith2FA { code: string token: string } data GenericFailure { code: int message: string } adt LoginRequest { LoginWithEmail LoginWithGoogle LoginWith2FA } service AuthService { def login(data: LoginRequest) => LoginResult !! GenericFailure } Auth Service
  • 29. API Days Live, From Micro to Macro Coordination, Sep 2020 29 TypeScript Client Change if (loginResponse instanceof MfaRequest) { // TODO Ask user for a code and retry login return; } // Successful, continue with execution Auth Service
  • 30. API Days Live, From Micro to Macro Coordination, Sep 2020 30 Summary
  • 31. API Days Live, From Micro to Macro Coordination, Sep 2020 31 1. Roughly 60-70% of the code is generated (e.g. 250K generated vs 95K actual business code in TypeScript codebase, 187K vs 120K in Scala) 2. We focus only on business logic and design 3. Every stakeholder contributes in an async way 4. No coordination on UserName or user_name when it comes to actual implementation 5. Any API / Design change is immediately visible to all consumers 6. Refactoring is orders of magnitude easier 7. New APIs and changes through pull requests 8. Integration is a bliss and error free, no typos or missing data Business Logic Domain Design Dispatchers Models & Codecs Routing Transport Summary
  • 32. API Days Live, From Micro to Macro Coordination, Sep 2020 32 Q & A Alex Khilko akhilko@playq.net
  • 33. API Days Live, From Micro to Macro Coordination, Sep 2020 33 Through evolution: 1. Add new services 2. Add new methods to existing services 3. Add new optional fields to existing models 4. Add new models Through deployment address: 1. Version 1: /api/v1 2. Version 2: /api/v2 Through custom headers routing Versioning
  • 34. API Days Live, From Micro to Macro Coordination, Sep 2020 34 1. Extensive primitive types, including Date, Time, DateTime with offsets, signed / unsigned numbers, and so on. 2. Unique algebraic and ID types 3. Definitions are parsed and AST is built using all of the inheritance, structural composition information 4. Code is generated, not templated, making each language transpiler unique and that follows semantics of the target language 5. Vertically sliced, making switching any layer an easy process: for instance going from HTTP to WebSockets requires zero changes to the logic 6. Built-in support for HTTP and WebSocket transports, routing, JSON encoding 7. Server to Client requests system 8. Generated codecs tests 9. Converters: expand / contract are generated Unique Features