Node.js: is frontend or backend?

I’ve recently noticed a bit of popularity of the question from the subject – “Node.js: is frontend or backend?”. That made me think about what is obvious for someone may be not that obvious for someone else. The question is probably coming from people beginning their journey in computer science (CS) space. And most of the articles I saw from my perspective missed technical insight, so here’s my try to contribute to that.

I’ve already wrote about Node.js from the backend perspective last year. The key takeaway from that piece – Node.js enabled JavaScript backends. And it pioneered non-blocking I/O what have opened up new horizons in regards to backend I/O-intensive workloads throughput.

Fair enough but what about frontend? A typical article on the topic says something along these lines: “Node. js can be used on the frontend as well as the backend”. And that sounds unsatisfactory from my perspective to answer “Node.js: is frontend or backend?”, so let’s dive deeper.

Node.js for frontend

The first disambiguation to handle – what does “frontend” exactly mean? Let’s consider at least two possible options: frontend app or frontend development. Node.js has nothing to do with the frontend apps because the browser running on the user’s device executes any frontend app. The irony is that the browser may use the same V8 JavaScript engine as Node.js. That definitely doesn’t mean that Node.js is USED for frontend apps, though.

If we talk about frontend development that’s completely different story. The most of frontend development tools use Node.js. Create React App, Angular CLI or Webpack – all these major players in the tools space are Node.js-based and written in JavaScript.

On the other hand it doesn’t mean that JavaScript + Node.js combo is the only option for frontend development. It’s just the most popular option. That also makes sense frontend devs create frontend tools. And frontend devs are proficient, well, in JavaScript =)