Node.js for side projects

There is one thing that unites people who work on software: we like to create things that work. Nothing is more satisfying than finishing a feature or project that simply does what it was intended to do. When it comes to my side projects, I love learning new frameworks, technologies, and languages. But in the end, the most rewarding and satisfying part is finishing the project and releasing something to the wild. Let’s be honest, if you work full-time and worry about things like exercising, chores, and possibly sleeping – then you understand me when I say it is not always easy finding time to complete a side project. We can help ourselves by planning ahead and perhaps utilizing some fancy project management tools. But what about our technology stack? If our end goal is to finish and release our project, then it makes sense to pick a technology stack that is well-suited for rapid development.

Node.js has become a popular server-side platform used to power the web servers for many modern web applications. When developing a Node.js application, you will be writing everything in Javascript and you will be able to run your applications on any type of server (Windows, Mac, or Linux). Node.js consists of a large pool of tightly-scoped modules and packages that you can utilize. What is great though is that you only use what you need, keeping your application as lightweight as possible. At the end of the day, side projects should still be enjoyable, and Node.js applications are fun to write.

I. What is Node.js exactly?

Node.js by itself is really just a runtime environment that is best used for creating server-side applications written in Javascript. Node.js is not a Javascript framework, but most Node.js applications use a framework. Express.js is the most popular Node.js framework and has fantastic documentation and a plethora of excellent resources. So for a Node.js web application stack you will have Node.js and Express.js installed and running on your web server, which will be a fast, lightweight middleman that quickly relays requests and responses between your client and your database.

II. When you shouldn’t use Node.js

Before we move deeper into the awesome parts of Node.js development, let’s first draw the line where you should not be using Node.js.

You should not use Node.js if you are building an application that involves any CPU-intensive operations. Node.js is single-threaded, so having processes that take a long time to run on the server is going to cripple the performance of your application. Your application should not do any sort of processing of large data sets on the server. Either offload the work to your database or simply switch to a more appropriate platform.

You should not use Node.js if you do not enjoy Javascript development. Your side project should be enjoyable, so don’t force something unpleasant on yourself just because someone on the internet told you to. But before you leave, let me say that I have met a lot of people that disregard Javascript without ever giving Javascript a fair chance. Javascript can seem like a wild, untamed jungle at first, but once you learn how to use it correctly, you begin to see how powerful it is at letting you just get stuff done. Javascript is one of the most widely used programming languages and it is going to get better with the recent ECMAScript 6 release.

III. Javascript – Front and Back

Now let’s dive into the ways Node.js allows you to maximize productivity on your side project. Javascript has taken over the web and is no longer just used for trivial enhancements. For many modern web applications, core functionality is provided by Javascript that is run on the client-side. Not only does that improve the user experience, but it pulls a lot of the work away from the web servers. Remember earlier when we talked about having a lightweight server? By having the client’s browser pull its own weight for a change, we are able to take full advantage of  the greatest strength of Node.js – lightening fast I/O.

Our application logic is now spread between both our front-end and our back-end; luckily for us Node.js developers, we get to use the exact same programming language for both ends. Most developers are well-aware of the cost of context switching. Having to refocus and recalibrate your mind to a new task, new language, and/or new problem often takes a developer several moments of valuable productive time. By reducing the distance between each context leap, we can more comfortably jump between tasks with much quicker recovery times.

IV. JSON – King of the Data Jungle

When it comes to transferring data between your server and your clients, JSON (Javascript Object Notation) has become the de facto data format. In my experience developing web applications on other platforms, there is just a ton of extra time spent converting your data into various formats and models. With Node.js applications, JSON can be used in all three areas of your application – client, server, and database. MongoDB and CouchDB are popular NoSQL databases that use JSON to store data. PostgreSQL, a popular open-source relational database system, also allows storing of JSON objects. Microsoft has even announced  that JSON will be supported in SQL Server 2016. With a wealth of great options, it is easy to pick a solid database for your Node.js application that allows you to squeeze out every last drop of productivity by not having to worry about converting your data formats.

V. Modules – Just what you need, nothing more

A good rule of thumb for side projects is to keep it small and focused. That rule will help you make sure that you actually complete your project. This same concept is mirrored in Node.js projects – you will only be using modules that you actually need. This keeps your application extremely lightweight. Unlike other more enterprise-focused platforms, you won’t have tons of extra baggage that won’t ever be used. Your builds and deploys will be faster, your project will take up less space, and you will have peace of mind knowing that everything in your project is exactly what you need and nothing more. NPM, Node Package Manager, is a major selling point for Node.js applications. It gives you quick and easy access to all public Node modules with a selection of over 150,000 packages. Being able to reduce development time and utilize existing open-source software and tools has never been easier. 

VI. Wrapping up

Node.js provides us with a fantastic application platform that really excels with web applications with high I/O requirements. If you decide to build a Node.js application for your next side project, try your best to build a lean web server API that minimizes the workload on the actual server. Node.js is incredibly accessible and it is relatively easy for a programmer to pick up and learn, so why not give it a shot?

VII. What is my next step?

I wanted to include a short list of some fantastic resources that helped me get a handle on Node.js.

https://thinkster.io/mean-stack-tutorial/ – This was by far the most helpful tutorial for me. The tutorial is structured nicely and covers a ton of extremely useful content. The tutorial is free but you can also pay extra to gain access to the source code and videos (when I used it I paid $25 for the source code, but it appears they have since switched to a $20 monthly subscription for all their tutorials).

http://www.toptal.com/nodejs/why-the-hell-would-i-use-node-js – This was a well-written article that helped me understand the strengths and weaknesses of Node.js.

If you want updates from me on my future blog posts or on my future projects, please sign up for my email list below!

Processing…
Success! You're on the list.

One thought on “Node.js for side projects

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: