I have added a paragraph addressing this:

Several people commented that domain module is deprecated and it should not be used.

Deprecation notice.

Despite the big red banner stating that this module is deprecated — domain module is not deprecated. If you read the paragraph following the banner, it states that the module is pending deprecation once a replacement API is finalised. It is likely that async_hooks will eventually provide all functionality provided by domain module and will supersede it. Behind the scenes domain module is already implemented using async_hooks. However, it is not happening any time soon (because loads of popular NPM modules and Node.js internals depend on domain module) and until that time it safe to use domain module.

The preference for using domain module over cls_hooks or async_hooks is simply because they provide a friendlier API (for this purpose).

Tech / Product Founder — building https://contra.com/

Tech / Product Founder — building https://contra.com/