SlideShare a Scribd company logo
1 of 29
Download to read offline
SERVICE-ORIENTED
ARCHITECTURE
By Samantha Geitz
LET’STALK ABOUT A PROJECT
(A HYPOTHETICAL ONE)
THE API ENGINEER
THE PROJECT
SOUNDS SIMPLE, RIGHT?
LET’S DO IT IN LARAVEL!
THE ENTITIES
• Users
• Admins
• Shirts
• Images
• Orders
• Shipping
• Payment Methods
• (Blog) posts
• Comments
• Mugs
• Laptop Stickers
• 3rd-party prices
• Search indexing
• Customer Service
• Reviews
• Videos
• ???
• 16 entities means (at minimum):
• 16-22 database tables
• 80-160 classes
• 800-1600+ unit tests
• A routes file that makes you want to
throw your computer out of a window
AND IF SOMETHING BREAKS,
IT ALL GOES DOWN
THIS IS A
MONOLITH
Keep building on top
of the project you
already have
SO WHAT IS
SERVICE-ORIENTED
ARCHITECTURE?
Lots of little separate
pieces (that talk to
each other when they
need to)
BOTH APPROACHES HAVE
THEIR PROS AND CONS
Just don’t do this
LET’S LOOK ATTHIS AGAIN
• Users
• Admins
• Shirts
• Images
• Orders
• Shipping
• Payment Methods
• (Blog) posts
• Comments
• Mugs
• Laptop Stickers
• 3rd-party prices
• Search indexing
• Customer Service
• Reviews
• Videos
• ???
SO WHAT MIGHTTHIS LOOK
LIKE USING SOA?
• Users
• Admins
Users API
• Shirts
• Images
• Mugs
• Laptop Stickers
• Reviews
Products API
• (Blog) posts
• Comments
• Videos
News API Orders API
• Orders
• Payment
Methods
• Customer
Service
• Shipping
Price Collector
• Price collecting
• Add prices to
product API
Search API
• Search indexing
• Search results
MICROSERVICES
• APIs organized around business capability /
function
• Only call other APIs when needed
• Single-responsibility principle
THE GOOD!
• Less code = easier to onboard new developers
• Fewer merge conflicts
• Easier to make changes and upgrades
• Improved fault isolation
• Running the test suite is far quicker
• Easier to scale and load-balance servers
THE BAD :(
• Deployment / Dev Ops complexity
• Cost
• Time investment for new microservices
• Shared code between projects can be a hassle
• More planning required
SO HOW DO I ACTUALLY
BUILD USING SOA?
LARAVELVS. LUMEN
• Lumen is great if you are building:
• APIs
• Small worker services (such as the search indexer)
• Use Laravel if:
• You don’t want to manually install front-end niceties like Elixir or
Bootstrap
• You know you’ll be using packages that don’t support Lumen
• You want/need Symfony’s more powerful routing component
• You’ve never built a Laravel application before
MAKINGYOUR
MICROSERVICES PLAY NICE
• Build APIs with a standard formatting schema
• JSON API / JSend / Other — just be consistent!
• Standardize HTTP codes / errors
• APIs call ONLY the endpoints they need using cURL or Guzzle
• Front-end clients (JavaScript application or Laravel project with
Blade templates) call endpoints they need
EXAMPLE
• Order API needs user info to print shipping label
• Send GET request to http://user-api.artisanalswag.com/
api/v1/user/{id} with user ID
• Check for API response
• If 200, return user
• If 400 / 404 / 500 / etc., pass along error message
AUTHENTICATION
• A few problems:
• How do you know what user is logged in?
• How do you keep unauthorized users out?
• Can you share session data? Should you?
USE OAUTH2!
• Authentication should be *stateless*
• You send user credentials to an authentication endpoint in User
API (along with client ID and secret)
• User API sends back two things — access token and refresh token
• Access token — short expiration time
• Refresh token — longer expiration time
• You send access token in header with your API requests
• User API confirms access token is still valid
• If access token is expired, the client should
send refresh token instead
• If refresh token is still valid, User API sends new
tokens (and deletes old ones)
• If refresh token is expired, require user to log
in again
SCOPES
• OAuth2 supports scopes (client permissions)
• Different clients can have different scopes
• Use with roles to protect your APIs
LOCAL DEVELOPMENT
• Homestead for local
• All software you need to run Laravel is included
• Same versions as your team / Forge
• List all applications in Homestead.yaml and hosts file
• Database — local or remote?
DEPLOY
• Laravel Forge
• Your Dev Ops guy
• Same cost no matter how many projects
• Taylor Otwell support
• Continuous integration (Travis, Codeship, etc.)
• Envoyer
AREYOU SAYING
MONOLITHS ARE BAD?
No! Do what makes sense for your application.
QUESTIONS?
Twitter: @samanthageitz
Email: samanthamichele7@gmail.com

More Related Content

What's hot

Oracle API Platform Cloud Service Best Practices & Lessons Learnt
Oracle API Platform Cloud Service Best Practices & Lessons LearntOracle API Platform Cloud Service Best Practices & Lessons Learnt
Oracle API Platform Cloud Service Best Practices & Lessons Learntluisw19
 
New Relic Infrastructure in the Real World: AWS
New Relic Infrastructure in the Real World: AWSNew Relic Infrastructure in the Real World: AWS
New Relic Infrastructure in the Real World: AWSNew Relic
 
Postman Introduction
Postman IntroductionPostman Introduction
Postman IntroductionRahul Agarwal
 
Applications Performance Monitoring with Applications Manager part 1
Applications Performance Monitoring with Applications Manager part 1Applications Performance Monitoring with Applications Manager part 1
Applications Performance Monitoring with Applications Manager part 1ManageEngine, Zoho Corporation
 
Building a Microservices-based ERP System
Building a Microservices-based ERP SystemBuilding a Microservices-based ERP System
Building a Microservices-based ERP SystemMongoDB
 
Matematika-geometrija-8. razred-formule
Matematika-geometrija-8. razred-formuleMatematika-geometrija-8. razred-formule
Matematika-geometrija-8. razred-formuleZorana Raičević
 
WSO2 Identity Server - Product Overview
WSO2 Identity Server - Product OverviewWSO2 Identity Server - Product Overview
WSO2 Identity Server - Product OverviewWSO2
 
[Scorebook final]
[Scorebook final][Scorebook final]
[Scorebook final]Freelancer
 
Blood bank E-R diagram by Foysal
Blood bank E-R diagram by FoysalBlood bank E-R diagram by Foysal
Blood bank E-R diagram by FoysalFoysal Mahmud
 
Slavomir nastasijević legende o milošu obiliću
Slavomir nastasijević   legende o milošu obilićuSlavomir nastasijević   legende o milošu obiliću
Slavomir nastasijević legende o milošu obilićuzoran radovic
 
Geometrijska tela
Geometrijska telaGeometrijska tela
Geometrijska telaverica1979
 
UiPath Culture Deck
UiPath Culture DeckUiPath Culture Deck
UiPath Culture DeckUiPath
 
новац наставни листић
новац наставни листићновац наставни листић
новац наставни листићIvana Milic
 

What's hot (20)

Oracle API Platform Cloud Service Best Practices & Lessons Learnt
Oracle API Platform Cloud Service Best Practices & Lessons LearntOracle API Platform Cloud Service Best Practices & Lessons Learnt
Oracle API Platform Cloud Service Best Practices & Lessons Learnt
 
New Relic Infrastructure in the Real World: AWS
New Relic Infrastructure in the Real World: AWSNew Relic Infrastructure in the Real World: AWS
New Relic Infrastructure in the Real World: AWS
 
Postman Introduction
Postman IntroductionPostman Introduction
Postman Introduction
 
Applications Performance Monitoring with Applications Manager part 1
Applications Performance Monitoring with Applications Manager part 1Applications Performance Monitoring with Applications Manager part 1
Applications Performance Monitoring with Applications Manager part 1
 
Building a Microservices-based ERP System
Building a Microservices-based ERP SystemBuilding a Microservices-based ERP System
Building a Microservices-based ERP System
 
Matematika-geometrija-8. razred-formule
Matematika-geometrija-8. razred-formuleMatematika-geometrija-8. razred-formule
Matematika-geometrija-8. razred-formule
 
WSO2 Identity Server - Product Overview
WSO2 Identity Server - Product OverviewWSO2 Identity Server - Product Overview
WSO2 Identity Server - Product Overview
 
[Scorebook final]
[Scorebook final][Scorebook final]
[Scorebook final]
 
Насеља
НасељаНасеља
Насеља
 
Govorne vezbe
Govorne vezbeGovorne vezbe
Govorne vezbe
 
Srpsko-makedonska masa Tanja Gagić
Srpsko-makedonska masa Tanja GagićSrpsko-makedonska masa Tanja Gagić
Srpsko-makedonska masa Tanja Gagić
 
Blood bank E-R diagram by Foysal
Blood bank E-R diagram by FoysalBlood bank E-R diagram by Foysal
Blood bank E-R diagram by Foysal
 
Dinarske planine Tanja Gagić
Dinarske planine Tanja GagićDinarske planine Tanja Gagić
Dinarske planine Tanja Gagić
 
Evropa
EvropaEvropa
Evropa
 
Slavomir nastasijević legende o milošu obiliću
Slavomir nastasijević   legende o milošu obilićuSlavomir nastasijević   legende o milošu obiliću
Slavomir nastasijević legende o milošu obiliću
 
подела саобраћаја
подела саобраћајаподела саобраћаја
подела саобраћаја
 
Geometrijska tela
Geometrijska telaGeometrijska tela
Geometrijska tela
 
What is an API
What is an APIWhat is an API
What is an API
 
UiPath Culture Deck
UiPath Culture DeckUiPath Culture Deck
UiPath Culture Deck
 
новац наставни листић
новац наставни листићновац наставни листић
новац наставни листић
 

Viewers also liked

SOA - Service Oriented Architecture ( Basic Concept & Principle )
SOA - Service Oriented Architecture ( Basic Concept & Principle )SOA - Service Oriented Architecture ( Basic Concept & Principle )
SOA - Service Oriented Architecture ( Basic Concept & Principle )DevTalk
 
Semantic SOA Governance
Semantic SOA GovernanceSemantic SOA Governance
Semantic SOA Governancearivolit
 
Introduction to Service Oriented Architecture
Introduction to Service Oriented ArchitectureIntroduction to Service Oriented Architecture
Introduction to Service Oriented ArchitectureDATA Inc.
 
20130123 og-aogeami-soa4 bt-overview
20130123 og-aogeami-soa4 bt-overview20130123 og-aogeami-soa4 bt-overview
20130123 og-aogeami-soa4 bt-overviewSUNDAR RAMANATHAN
 
A Study on the Taxonomy of Service Antipatterns
A Study on the Taxonomy of Service AntipatternsA Study on the Taxonomy of Service Antipatterns
A Study on the Taxonomy of Service AntipatternsFrancis Palma
 
SOA for business technology
SOA for business technologySOA for business technology
SOA for business technologyCapgemini
 
Service Oriented Architecture
Service Oriented ArchitectureService Oriented Architecture
Service Oriented ArchitectureRobert Sim
 
Service Oriented Architecture & Beyond
Service Oriented Architecture & BeyondService Oriented Architecture & Beyond
Service Oriented Architecture & BeyondImesh Gunaratne
 

Viewers also liked (8)

SOA - Service Oriented Architecture ( Basic Concept & Principle )
SOA - Service Oriented Architecture ( Basic Concept & Principle )SOA - Service Oriented Architecture ( Basic Concept & Principle )
SOA - Service Oriented Architecture ( Basic Concept & Principle )
 
Semantic SOA Governance
Semantic SOA GovernanceSemantic SOA Governance
Semantic SOA Governance
 
Introduction to Service Oriented Architecture
Introduction to Service Oriented ArchitectureIntroduction to Service Oriented Architecture
Introduction to Service Oriented Architecture
 
20130123 og-aogeami-soa4 bt-overview
20130123 og-aogeami-soa4 bt-overview20130123 og-aogeami-soa4 bt-overview
20130123 og-aogeami-soa4 bt-overview
 
A Study on the Taxonomy of Service Antipatterns
A Study on the Taxonomy of Service AntipatternsA Study on the Taxonomy of Service Antipatterns
A Study on the Taxonomy of Service Antipatterns
 
SOA for business technology
SOA for business technologySOA for business technology
SOA for business technology
 
Service Oriented Architecture
Service Oriented ArchitectureService Oriented Architecture
Service Oriented Architecture
 
Service Oriented Architecture & Beyond
Service Oriented Architecture & BeyondService Oriented Architecture & Beyond
Service Oriented Architecture & Beyond
 

Similar to Service-Oriented Architecture

Lessons learned on the Azure API Stewardship Journey.pptx
Lessons learned on the Azure API Stewardship Journey.pptxLessons learned on the Azure API Stewardship Journey.pptx
Lessons learned on the Azure API Stewardship Journey.pptxapidays
 
APIs distribuidos con alta escalabilidad
APIs distribuidos con alta escalabilidadAPIs distribuidos con alta escalabilidad
APIs distribuidos con alta escalabilidadSoftware Guru
 
Escaping the yellow bubble - rewriting Domino using MongoDb and Angular
Escaping the yellow bubble - rewriting Domino using MongoDb and AngularEscaping the yellow bubble - rewriting Domino using MongoDb and Angular
Escaping the yellow bubble - rewriting Domino using MongoDb and AngularMark Leusink
 
Azure Functions Real World Examples
Azure Functions Real World Examples Azure Functions Real World Examples
Azure Functions Real World Examples Yochay Kiriaty
 
Swagger APIs for Humans and Robots (Gluecon)
Swagger APIs for Humans and Robots (Gluecon)Swagger APIs for Humans and Robots (Gluecon)
Swagger APIs for Humans and Robots (Gluecon)Tony Tam
 
Tech Talk on Cloud Computing
Tech Talk on Cloud ComputingTech Talk on Cloud Computing
Tech Talk on Cloud ComputingITviec
 
Building a REST API for Longevity
Building a REST API for LongevityBuilding a REST API for Longevity
Building a REST API for LongevityMuleSoft
 
#SPSNYC 2018 Migrate your custom components to the #SharePoint Framework #SPFX
#SPSNYC 2018 Migrate your custom components to the #SharePoint Framework #SPFX#SPSNYC 2018 Migrate your custom components to the #SharePoint Framework #SPFX
#SPSNYC 2018 Migrate your custom components to the #SharePoint Framework #SPFXVincent Biret
 
(ATS6-DEV02) Web Application Strategies
(ATS6-DEV02) Web Application Strategies(ATS6-DEV02) Web Application Strategies
(ATS6-DEV02) Web Application StrategiesBIOVIA
 
Serverless Meetup - Event Sourcing
Serverless Meetup - Event SourcingServerless Meetup - Event Sourcing
Serverless Meetup - Event SourcingLuca Bianchi
 
Integrate Applications into IBM Connections Cloud and On Premises (AD 1632)
Integrate Applications into IBM Connections Cloud and On Premises (AD 1632)Integrate Applications into IBM Connections Cloud and On Premises (AD 1632)
Integrate Applications into IBM Connections Cloud and On Premises (AD 1632)TIMETOACT GROUP
 
code talks Commerce: The API Economy as an E-Commerce Operating System
code talks Commerce: The API Economy as an E-Commerce Operating Systemcode talks Commerce: The API Economy as an E-Commerce Operating System
code talks Commerce: The API Economy as an E-Commerce Operating SystemAdelina Todeva
 
Build Modern Web Apps Using ASP.NET Web API and AngularJS
Build Modern Web Apps Using ASP.NET Web API and AngularJSBuild Modern Web Apps Using ASP.NET Web API and AngularJS
Build Modern Web Apps Using ASP.NET Web API and AngularJSTaiseer Joudeh
 
API Gateways are going through an identity crisis
API Gateways are going through an identity crisisAPI Gateways are going through an identity crisis
API Gateways are going through an identity crisisChristian Posta
 
Application Insights for Integration Developers
Application Insights for Integration DevelopersApplication Insights for Integration Developers
Application Insights for Integration DevelopersSriram Hariharan
 
Designing your API Server for mobile apps
Designing your API Server for mobile appsDesigning your API Server for mobile apps
Designing your API Server for mobile appsMugunth Kumar
 

Similar to Service-Oriented Architecture (20)

Lessons learned on the Azure API Stewardship Journey.pptx
Lessons learned on the Azure API Stewardship Journey.pptxLessons learned on the Azure API Stewardship Journey.pptx
Lessons learned on the Azure API Stewardship Journey.pptx
 
APIs distribuidos con alta escalabilidad
APIs distribuidos con alta escalabilidadAPIs distribuidos con alta escalabilidad
APIs distribuidos con alta escalabilidad
 
SGCE 2015 REST APIs
SGCE 2015 REST APIsSGCE 2015 REST APIs
SGCE 2015 REST APIs
 
Escaping the yellow bubble - rewriting Domino using MongoDb and Angular
Escaping the yellow bubble - rewriting Domino using MongoDb and AngularEscaping the yellow bubble - rewriting Domino using MongoDb and Angular
Escaping the yellow bubble - rewriting Domino using MongoDb and Angular
 
Azure Functions Real World Examples
Azure Functions Real World Examples Azure Functions Real World Examples
Azure Functions Real World Examples
 
Swagger APIs for Humans and Robots (Gluecon)
Swagger APIs for Humans and Robots (Gluecon)Swagger APIs for Humans and Robots (Gluecon)
Swagger APIs for Humans and Robots (Gluecon)
 
Tech Talk on Cloud Computing
Tech Talk on Cloud ComputingTech Talk on Cloud Computing
Tech Talk on Cloud Computing
 
Building a REST API for Longevity
Building a REST API for LongevityBuilding a REST API for Longevity
Building a REST API for Longevity
 
#SPSNYC 2018 Migrate your custom components to the #SharePoint Framework #SPFX
#SPSNYC 2018 Migrate your custom components to the #SharePoint Framework #SPFX#SPSNYC 2018 Migrate your custom components to the #SharePoint Framework #SPFX
#SPSNYC 2018 Migrate your custom components to the #SharePoint Framework #SPFX
 
(ATS6-DEV02) Web Application Strategies
(ATS6-DEV02) Web Application Strategies(ATS6-DEV02) Web Application Strategies
(ATS6-DEV02) Web Application Strategies
 
Serverless Meetup - Event Sourcing
Serverless Meetup - Event SourcingServerless Meetup - Event Sourcing
Serverless Meetup - Event Sourcing
 
Platforms FTW!
Platforms FTW!Platforms FTW!
Platforms FTW!
 
Platforms FTW!
Platforms FTW!Platforms FTW!
Platforms FTW!
 
Integrate Applications into IBM Connections Cloud and On Premises (AD 1632)
Integrate Applications into IBM Connections Cloud and On Premises (AD 1632)Integrate Applications into IBM Connections Cloud and On Premises (AD 1632)
Integrate Applications into IBM Connections Cloud and On Premises (AD 1632)
 
code talks Commerce: The API Economy as an E-Commerce Operating System
code talks Commerce: The API Economy as an E-Commerce Operating Systemcode talks Commerce: The API Economy as an E-Commerce Operating System
code talks Commerce: The API Economy as an E-Commerce Operating System
 
Build Modern Web Apps Using ASP.NET Web API and AngularJS
Build Modern Web Apps Using ASP.NET Web API and AngularJSBuild Modern Web Apps Using ASP.NET Web API and AngularJS
Build Modern Web Apps Using ASP.NET Web API and AngularJS
 
Scaling
ScalingScaling
Scaling
 
API Gateways are going through an identity crisis
API Gateways are going through an identity crisisAPI Gateways are going through an identity crisis
API Gateways are going through an identity crisis
 
Application Insights for Integration Developers
Application Insights for Integration DevelopersApplication Insights for Integration Developers
Application Insights for Integration Developers
 
Designing your API Server for mobile apps
Designing your API Server for mobile appsDesigning your API Server for mobile apps
Designing your API Server for mobile apps
 

Recently uploaded

Computer 10: Lesson 10 - Online Crimes and Hazards
Computer 10: Lesson 10 - Online Crimes and HazardsComputer 10: Lesson 10 - Online Crimes and Hazards
Computer 10: Lesson 10 - Online Crimes and HazardsSeth Reyes
 
Nanopower In Semiconductor Industry.pdf
Nanopower  In Semiconductor Industry.pdfNanopower  In Semiconductor Industry.pdf
Nanopower In Semiconductor Industry.pdfPedro Manuel
 
UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7DianaGray10
 
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...Aggregage
 
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...UbiTrack UK
 
VoIP Service and Marketing using Odoo and Asterisk PBX
VoIP Service and Marketing using Odoo and Asterisk PBXVoIP Service and Marketing using Odoo and Asterisk PBX
VoIP Service and Marketing using Odoo and Asterisk PBXTarek Kalaji
 
ADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDE
ADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDEADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDE
ADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDELiveplex
 
20230202 - Introduction to tis-py
20230202 - Introduction to tis-py20230202 - Introduction to tis-py
20230202 - Introduction to tis-pyJamie (Taka) Wang
 
NIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 WorkshopNIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 WorkshopBachir Benyammi
 
Building Your Own AI Instance (TBLC AI )
Building Your Own AI Instance (TBLC AI )Building Your Own AI Instance (TBLC AI )
Building Your Own AI Instance (TBLC AI )Brian Pichman
 
Igniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration WorkflowsIgniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration WorkflowsSafe Software
 
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve DecarbonizationUsing IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve DecarbonizationIES VE
 
OpenShift Commons Paris - Choose Your Own Observability Adventure
OpenShift Commons Paris - Choose Your Own Observability AdventureOpenShift Commons Paris - Choose Your Own Observability Adventure
OpenShift Commons Paris - Choose Your Own Observability AdventureEric D. Schabell
 
Introduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptxIntroduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptxMatsuo Lab
 
Basic Building Blocks of Internet of Things.
Basic Building Blocks of Internet of Things.Basic Building Blocks of Internet of Things.
Basic Building Blocks of Internet of Things.YounusS2
 
COMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online CollaborationCOMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online Collaborationbruanjhuli
 
Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024SkyPlanner
 

Recently uploaded (20)

Computer 10: Lesson 10 - Online Crimes and Hazards
Computer 10: Lesson 10 - Online Crimes and HazardsComputer 10: Lesson 10 - Online Crimes and Hazards
Computer 10: Lesson 10 - Online Crimes and Hazards
 
Nanopower In Semiconductor Industry.pdf
Nanopower  In Semiconductor Industry.pdfNanopower  In Semiconductor Industry.pdf
Nanopower In Semiconductor Industry.pdf
 
201610817 - edge part1
201610817 - edge part1201610817 - edge part1
201610817 - edge part1
 
UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7
 
20150722 - AGV
20150722 - AGV20150722 - AGV
20150722 - AGV
 
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
 
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
 
VoIP Service and Marketing using Odoo and Asterisk PBX
VoIP Service and Marketing using Odoo and Asterisk PBXVoIP Service and Marketing using Odoo and Asterisk PBX
VoIP Service and Marketing using Odoo and Asterisk PBX
 
ADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDE
ADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDEADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDE
ADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDE
 
20230202 - Introduction to tis-py
20230202 - Introduction to tis-py20230202 - Introduction to tis-py
20230202 - Introduction to tis-py
 
NIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 WorkshopNIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 Workshop
 
Building Your Own AI Instance (TBLC AI )
Building Your Own AI Instance (TBLC AI )Building Your Own AI Instance (TBLC AI )
Building Your Own AI Instance (TBLC AI )
 
Igniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration WorkflowsIgniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration Workflows
 
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve DecarbonizationUsing IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
 
OpenShift Commons Paris - Choose Your Own Observability Adventure
OpenShift Commons Paris - Choose Your Own Observability AdventureOpenShift Commons Paris - Choose Your Own Observability Adventure
OpenShift Commons Paris - Choose Your Own Observability Adventure
 
Introduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptxIntroduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptx
 
Basic Building Blocks of Internet of Things.
Basic Building Blocks of Internet of Things.Basic Building Blocks of Internet of Things.
Basic Building Blocks of Internet of Things.
 
20230104 - machine vision
20230104 - machine vision20230104 - machine vision
20230104 - machine vision
 
COMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online CollaborationCOMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online Collaboration
 
Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024
 

Service-Oriented Architecture

  • 2. LET’STALK ABOUT A PROJECT (A HYPOTHETICAL ONE)
  • 5. SOUNDS SIMPLE, RIGHT? LET’S DO IT IN LARAVEL!
  • 6. THE ENTITIES • Users • Admins • Shirts • Images • Orders • Shipping • Payment Methods • (Blog) posts • Comments • Mugs • Laptop Stickers • 3rd-party prices • Search indexing • Customer Service • Reviews • Videos • ???
  • 7. • 16 entities means (at minimum): • 16-22 database tables • 80-160 classes • 800-1600+ unit tests • A routes file that makes you want to throw your computer out of a window
  • 8. AND IF SOMETHING BREAKS, IT ALL GOES DOWN
  • 9. THIS IS A MONOLITH Keep building on top of the project you already have
  • 10. SO WHAT IS SERVICE-ORIENTED ARCHITECTURE? Lots of little separate pieces (that talk to each other when they need to)
  • 11. BOTH APPROACHES HAVE THEIR PROS AND CONS Just don’t do this
  • 12. LET’S LOOK ATTHIS AGAIN • Users • Admins • Shirts • Images • Orders • Shipping • Payment Methods • (Blog) posts • Comments • Mugs • Laptop Stickers • 3rd-party prices • Search indexing • Customer Service • Reviews • Videos • ???
  • 13. SO WHAT MIGHTTHIS LOOK LIKE USING SOA? • Users • Admins Users API • Shirts • Images • Mugs • Laptop Stickers • Reviews Products API • (Blog) posts • Comments • Videos News API Orders API • Orders • Payment Methods • Customer Service • Shipping
  • 14. Price Collector • Price collecting • Add prices to product API Search API • Search indexing • Search results
  • 15. MICROSERVICES • APIs organized around business capability / function • Only call other APIs when needed • Single-responsibility principle
  • 16. THE GOOD! • Less code = easier to onboard new developers • Fewer merge conflicts • Easier to make changes and upgrades • Improved fault isolation • Running the test suite is far quicker • Easier to scale and load-balance servers
  • 17. THE BAD :( • Deployment / Dev Ops complexity • Cost • Time investment for new microservices • Shared code between projects can be a hassle • More planning required
  • 18. SO HOW DO I ACTUALLY BUILD USING SOA?
  • 19. LARAVELVS. LUMEN • Lumen is great if you are building: • APIs • Small worker services (such as the search indexer) • Use Laravel if: • You don’t want to manually install front-end niceties like Elixir or Bootstrap • You know you’ll be using packages that don’t support Lumen • You want/need Symfony’s more powerful routing component • You’ve never built a Laravel application before
  • 20. MAKINGYOUR MICROSERVICES PLAY NICE • Build APIs with a standard formatting schema • JSON API / JSend / Other — just be consistent! • Standardize HTTP codes / errors • APIs call ONLY the endpoints they need using cURL or Guzzle • Front-end clients (JavaScript application or Laravel project with Blade templates) call endpoints they need
  • 21. EXAMPLE • Order API needs user info to print shipping label • Send GET request to http://user-api.artisanalswag.com/ api/v1/user/{id} with user ID • Check for API response • If 200, return user • If 400 / 404 / 500 / etc., pass along error message
  • 22. AUTHENTICATION • A few problems: • How do you know what user is logged in? • How do you keep unauthorized users out? • Can you share session data? Should you?
  • 23. USE OAUTH2! • Authentication should be *stateless* • You send user credentials to an authentication endpoint in User API (along with client ID and secret) • User API sends back two things — access token and refresh token • Access token — short expiration time • Refresh token — longer expiration time • You send access token in header with your API requests
  • 24. • User API confirms access token is still valid • If access token is expired, the client should send refresh token instead • If refresh token is still valid, User API sends new tokens (and deletes old ones) • If refresh token is expired, require user to log in again
  • 25. SCOPES • OAuth2 supports scopes (client permissions) • Different clients can have different scopes • Use with roles to protect your APIs
  • 26. LOCAL DEVELOPMENT • Homestead for local • All software you need to run Laravel is included • Same versions as your team / Forge • List all applications in Homestead.yaml and hosts file • Database — local or remote?
  • 27. DEPLOY • Laravel Forge • Your Dev Ops guy • Same cost no matter how many projects • Taylor Otwell support • Continuous integration (Travis, Codeship, etc.) • Envoyer
  • 28. AREYOU SAYING MONOLITHS ARE BAD? No! Do what makes sense for your application.