Node.JS Tutorial #1: What is Node.JS?

Node.js is an amazing tool. It exponentially speeds up all kinds of web development, aiding your working ability immensely. In spite of this, many designers are wary of it because it requires learning a command line interface.

the Node.js logo in hexagonal lettering on a light grey background

Knowing how daunting this can seem, I'm here to help. In this series, I plan to go through how to install and learn Node.js (as well as Linux terminals) as clearly as I can. In this article I will cover what is Node.js and what it can be used for.

What is Node.js?

Node.js is primarily a server side platform. This means it works primarily as a server, handling requests from applications and sending information to be displayed by the front-end.

Doesn't sound super exciting, right? Then why is everyone and their Mum starting to use NodeJS for every web development task?

While NodeJS can be used for a lot of things, Googling what it's functions are will just give you a variety of vague answers. In fact, I'd love to see statistically how many people became interested in Node and then decided not to learn it after reading some of the shabby descriptions online.

So here are some of my favorite reasons as to why you should use Node. Have a read through and see if any of them sound like something you'd find useful.

1. It's a library manager

This might sound familiar:

You're working on a website and it depends on a bunch of different Javascript and CSS libraries. The only way to manage them is to manually add the files into your html. There's no easy way to remove them unless you want to manually delete all the files. This - not to mention having to manually update these files - is downright painful.

Node does all of this for you. Yes, all of it.

Installing libraries is very similar to the way Linux handles programs. If you want to install or remove something new you just need to run:

npm install [library-name-here]


npm remove [library-name-here]

And updating is just as easy:

npm update

Here's the best thing about this functionality however. If you upload your code to Github, you simply need to share what you wrote, along with a file that contains a reference to everything you have installed. If you download those files on another machine, you just need to run:

npm install

And it will install every single library you previously downloaded for that project. Obviously this will make your file-sizes a lot more manageable, as well as making it easier to work on projects across different machines.

2. It's built like a native program

If you've never worked with a non web-based programming language, this might be a bit confusing. Unlike HTML, CSS, Javascript, PHP and many other scripts that can be used right after being written, most modern languages require you to "build" your program before using it.

During this build process, files are optimized and compressed to reduce filesize and improve execution speed.

The same happens for many frameworks based in Node, such as React and Angular. When you're ready to release what you've made, you will need to "build" it - Node will then output a production ready product that you can publish to the public.

This is extremely important for websites, as speed and loading times are tightly connected to how well you will be ranked in search engines. Node ensures that all the libraries and code you have written are as optimized as possible, giving you a massive SEO boost.

3. Post-Processing and other advantages

Node also has a myriad of helpful libraries to help speed up development that are not used on production-ready sites.

Is having to ensure that your code is compatible with every browser consuming valuable time? Something like post-css is probably what you're looking for. This, and the many plugins available for it, will automatically parse your code to a more compatible version.

Do you hate reloading the page every time you make a change? Then Grunt and its array of plugins can help you with that.

And to top it all off, Node is also the fastest way to get up and running with my favorite CSS framework: TailwindCSS, which I discussed here.

What do I need?

To use Node locally, you don't need anything but your PC. It's primarily supported on Linux and MacOS distributions, but since the inclusion of WSL2 it's fairly easy to install on Windows too.

To actually publish what you made to the web however, things get a little more complicated.

If you're just creating a traditional site and using Node for post-css and Grunt, then the process is very similar to traditional web development. Finish coding - take your files and upload them to an FTP - Done.

When working with frameworks like React and NextJS, these usually give you a few different options.

If you're working on a static site, then you can just choose to export your project as html files. This has its uses for simple sites that aim to showcase specific information.

On the other hand, if you're looking to create a site or app that relies on an API and generates pages automatically depending on the information you feed to it, you will need a Server.

That sounds very complicated and expensive

But don't back out yet! Running your own server is cheaper than you'd think, especially when compared to standard hosting plans. GoDaddy for instance, one of the most popular hosting services, asks £5.99 for a basic plan alone, which is not ideal.

By running your own server with a service like Digitialocean (my go-to!), you can run as many sites as you want, receive free SSL certificates and host both standard websites as well as Node.js apps. You get all of this for £5 a month - that's less than a Spotify subscription - with the opportunity of directly upgrading your hardware whenever needed.

I understand that all of this can sound a bit scary at first. However, I can assure you that you'll be glad to gain a whole host of valuable skills you can learn by just remembering a few terminal commands. From personal experience, I'm telling you this experience can make or break the decision to hire you.

And I'll be here to explain further on how to get there in the next part of this series, coming soon.

In Conclusion

Although Node is fundamental to front-end design in 2019, people are still easily confused by what it does and how to properly use it. I want to change this, by letting people know how Node.js actually functions, and showing them how it can help them become better developers, even if it requires stepping a little outside their comfort zone.

There's a lot to learn and unpack here, but ultimately it's all fairly easy. So follow my guide, be prepared to learn a few things, and you'll be just fine!