Lighthouse Scanner: Microservice Development with the Hapi Framework

5 min readJun 4, 2020

Lighthouse is a scanner for improving SEO, performance and security of websites. My service delivers lighthouse scans on demand. The service is provided through a webpage and realized by a microservice. You can use it here:

I started to develop this microservice with the Express framework, a standard choice for Node.js web applications. After some time, adding feature after feature, I found myself thinking “The application logic is hidden between all those expressive logging statements and complex validations”. It was hard to have a complete overview with one glance!

Aren’t there other frameworks available? Of course, and I picked Hapi. For these reasons: Its syntax is clear and similar to Express. It has a set of well-integrated modules. And it claims to be very performant and secure because it withstands Walmart’s Black Friday sales. Hapi is enterprise express!

In this article, I will walk through the microservice development and show the relevant Hapi features.

This article originally appeared at my blog.

Switch from Express to Hapi

My initial development went smoothly. Within one day, I implemented the basic functions of starting and executing scans. The microservices is a self-contained unit providing a clear HTTP API: accepting scan request with /scan, communicating job status with /job, and delivering scan results with /report. On the next day, I added detailed validation, error handling and logging. The code base evolved, but mutated to so many logging statements and complex validations that I could not see the main flow of the application.

So it was clear: I need to add specific npm packages that encapsulate loggoing and validation, or I switch to a framework which integrates these essential aspects already. From lists like node frameworks or web api frameworks, I gathered and checked these:

Again, the choice is huge! I narrowed it down by considering my core requirements…


IT Project Manager & Developer