Hapi-Together
@DealerTire
Conquering the Monolithic Application
Sean Grasso
Senior Web Developer
sgrasso
@spgrasso
sgrasso@dealertire.com
Manages replacement-tire and maintenance-parts programs for more than 10,000 car dealers, spanning two dozen automotive brands.
Uses a refined mix of old-fashioned salesmanship and newfangled technology.
Dealer Tire revs up long-vacant Victory Center
-- cleveland.com
Two Primary Sites
B2B order portal and tools for car dealerships
dealertire.com
B2C website
rightturn.com
project/� config/� routes.js� settings.js� index.js� controllers/� index.js� movies.js� models/� index.js� movie.js� repositories/� index.js� movie.js� views/� index.jade� movies/� index.jade� tests/� controllers/� index.js� models/� index.js� repositories/� index.js� index.js� package.json
Hapi enables developers to focus on writing reusable application
logic instead of spending time building infrastructure.
Hapi was created around the idea that configuration is better than code, that business logic must be isolated from the transport layer, and that native node constructs like buffers and stream should be supported as first class objects. But most importantly, it was created to provide a modern, comprehensive environment in which as much of the effort is spent delivering business value.
- Eran Hammer
Hold onto your butts!
Logical groups of web application sections handled as plugins.
Essentially, decoupling individual pieces of application logic and managing them as typical dependencies with a Private NPM.
By modularizing in this way, each plugin could be per team, and in its own repository that the team owns and works on.
Hapi plugins can be thought of as isolated sandboxes communicating
to each other but not
knowing anything about
the other.
Take over the World!
Discover the ability to control logic through configuration.
Hapi route config, pre methods, extension methods and request lifecycle as a whole.
Tip
You also can decorate the server, request and reply objects with your own functions.
Tip
Hapi lets you extend any of the request’s lifecycle phases.
Tip
Hapi modules like Glue and Rejoice allow us to run a server completely through configuration.
Tip
You have the ability to define settings at an application or plugin level.
What does this isolation look like?
Example #1
Theory of Everything
What if it was simple and scalable and FAST! Anything and Everything can be a module and served independent of the other.
Built out of private and public modules (plugins), then deployed as a single entity knowing of it’s own dependencies to operate.
Micro Services? �How about Micro Applications?
APP
Private Modules
Public Modules
Micro Application
So wait I can serve a different route version on the fly?
Look at the request lifecycle and extending that behavior.
Example #2
Request Life Cycle
Let’s Plugins extend functionality of the current request.
Be Careful! Ext. points are executed in the order plugins are registered, which is asynchronous...
Look at the request lifecycle and extending that behavior.
Example #3
What’s Left?
Host your modules and micro applications privately.
Deploy using a container environment
Thanks For Coming!