Update on Node.js npm Tool and Express Module

243

The second day at Node Interactive Europe last week had two keynotes that concentrated on specific tools and modules. Kat Marchán talked about the npm packaging tool, and Doug Wilson explored the state of the express module.

Kat Marchán on npm

Kat Marchán gave a comprehensive talk on the state of npm. For those of you new to npm, it may seem that npm is to Node.js what APT is to Debian and Ubuntu, but deep down, it is much more.

Kat reviewed core and basic functionalities of the utility and then moved on to more exotic commands. She explained what was new in the upcoming version 4 and what was being phased out for existing versions. Specifically, npm 2 will go into maintenance mode. This means no updates, just the occasional patch for major vulnerabilities. The current version — npm 3 — will become the long-term support (LTS) version that will go into Node.js 6 (even-numbered Node releases are LTS by default). Becoming LTS implies receiving patches but no new features. Version 4 of npm will probably go into Node.js 7, and npm 5 will probably be part of Node.js 8, another LTS release.

Probably the most surprising moment of Kat’s talk was when she revealed that she is part of a team of only three people, and only two of them actually code. This is, of course, a problem. Feature requests have to be ignored, for example, in favor of patching and stabilizing the code.

This is consistent with what Kat feels is the team’s responsibility with the entire community. Pursuing the development of new features that may have been required by some users, but not others, takes a back seat, she says, to developing a tool that is reliable and consistent and that improves its performance with each release.

Doug Wilson on Express

Doug Wilson talked about what has become the other essential piece to complete the Node.js jigsaw puzzle. Express is the undisputed crown jewel of modules. As Doug modestly puts it: “Express adds a little bit of sugar on top of the core.” Express simplifies building HTTP-enabled servers and provides utilities for routing, low-level HTTP functions, and more.

Express became a part of the Node.js Foundation as an incubated project at the beginning of 2016, and, although this will have little impact on the users of the code, it does help to internally manage the project, said Doug. The developers now have mentors to guide the project and help with the project governance, thus improving its chances of survival and making it more transparent to contributors.

As for the code itself, Doug explained how express is not so much a monolithic piece of code, as much as it is the sum of three projects spread over three GitHub organizations. The expressjs organization is the main entry point where the actual express module is stored and developed.

The pillarjs organization contains what Doug calls the “building blocks” of express. The express module is made up of several pieces, such as the router, how requests to a view engine are handled, error handling, and so on. All these pieces are split out in pillarjs. If you want to use some pieces of express, but not the whole thing, or want to use some of express’s code in your own module, this is where you will find it.

Finally, the jshttp organization contains the low-level code for http-related interactions. After laying out the current state of the project, Doug described what was in store for express 5.0, the next version of express. Version 5.0, among other things, promises support for routing, a better template rendering system which will read templates asynchronously, improved query string and cookie handling, and new route syntax additions.

Doug ended his talk by explaining what the team is doing to get more contributors into the project. As part of the mentoring, they are receiving from the Node.js Foundation, the members of express are working on making their project more transparent by publishing documentation about the internal workings of the organization, by explicitly stating their goals, guides on how to contribute, how the organization is structured, and where their resources are located. They are also publishing what they call “Level up guides” that help users become committers, or even opt to become a member of express’s technical board.

Being understaffed seems to be a common issue even within Node.js’s most popular projects. Hopefully, the strategies they are implementing will pay off.

Want to learn Node.js? See our tutorial on how to get started writing web applications with Node.js.