We use hapi for the project I work on. The decision was made before I joined and at first I was mildly grumpy about it. My reasons were silly like how I’d rather be gaining experience in the most famous/popular libraries and frameworks and at first I disagreed with some of the style decisions. The way only programmers can get really upset about the tiniest things.
Maybe it is just stockholm syndrome, but I really started liking it and also appreciating it more and more over the years. There is just something to be said for a coherent, well thought out vision and for frameworks and libraries that work really well together.
My favourite part of the hapi ecosystem is probably lab. The test coverage calculator is second to none. Linting is integrated and just works. The test runner’s output is really usable and code (the assertion library)’s error formatting is incredibly helpful especially if you’re smart about your test assertions. I use it in my pet projects wherever it makes sense too.
After that joi is unparalleled as far as schema validation libraries go. To say that we use it extensively is an understatement.
You can read the styleguide if you’re interested, but I just want to highlight a few of the things I came around to over the years:
Imported modules names are uppercased and the only other module-level declaration is an object called internals
. All constants and non-exported functions go there. This means you can tell exactly where any identifier comes from at a glance. It is either an imported module, an export, internals or something that was declared in the chunk of code you’re working on. I now use this style everywhere and I think it is brilliant.
There are a number of other style rules that make it easy to scan through code like this or that makes code easily “greppable”. Like single quote strings only. Top-level functions are declared via assignment with the function keyword only. Nested functions are declared as arrow functions. No chained declarations. const and let only. camelCase, no underscores. Plural for arrays, single for each element in an array. All scopes get wrapped in {}. Array function arguments must be wrapped in parenthesis. Probably a number of others I can’t think of off the top of my head. The rest are just style choices where you have to pick a way and the exact way you choose matters less than the fact that you made a decision.
I’m a complete convert to 100% test coverage and I now do that everywhere I can.
There are probably more, but those are the main ones that stand out. Really I think it boils down to the overall quality which is just second to none.