Node.js vs Rails

Samantha Aleman
3 min readApr 19, 2021

Howdy!

Today I’m going to talk a little about myself and the decisions I am making for my career. At the beginning of my job search I was interested in learning Python because I wanted to apply for full-stack positions with a stack of javascript and python since there were more openings for Python vs Rails. I was advised to not go crazy with learning new languages; that it’s better to truly understand and grasp one language than to half know multiple languages. As I started becoming busier with networking, blogging, applying for jobs, and working at my part-time job I realized I truly didn’t have the time to fully learn a new language the way I wanted to. I also realized that as much as I love backend work, I have a passion for front-end development.

In the process of me going back into Javascript and improving my React & Redux skills, I also started diving into learning other JS frameworks like Next.js and Ember which both are so similar to React so it was easy to pick up on.

I was looking at a job posting today that was looking for a Javascript developer preferably with React skills, but they also wanted Node experience. That’s when I realized I can still apply to full-stack positions that offer Node as a back-end language, and because it’s still Javascript it’ll be way easier to pick it up as oppose to starting from scratch again with a different language.

So in the spirit of me delving into Node I’m going to go over some of its main features and how it compares to Rails.

Node basically lets you execute Javascript code on the server. Node is known for its speed, which is due to the asynchronous programming as well as being able to handle more requests. Also being able to use just one language in both the frontend and the backend adds to the progress. Which is great when scaling websites, however there are drawbacks to Node. Node.js is great for applications which involve small, frequent and simultaneous requests. However, it can struggle with applications which create high CPU (Central Processing Unit) usage in each thread because Node.js is single-threaded (meaning the processes contain the execution of instructions in a single sequence). If you’re going to manipulate images and/or video on your server, you may find that Node.js slows down. There are ways around it but it adds to development time and cost.

Now how does this compare to Rails?

Well, Rails is a fully-fledged website framework which includes everything you need to complete a website project including the ability to manage logic, routing and applications, all out of the box. In other words with Rails you can type out one command in the terminal and all of the basics of a website such as routes, controllers, and view pages will be auto generated. As well as the basics these handy tools also include database integration such as being able to type out what your database table is going to contain in the terminal and it’ll create the actual database for you to just migrate after which makes it easier to facilitate web development on an end to end basis. This allows for quicker development because it included an integrated web server, and it has a database with generators and scripts. As with Node there are drawbacks to Rails. The Rails platform imposes a lot of authority on the developmental process. So there can come a point where adjusting RoR to fit your requirements takes up a huge amount of your time. Whereas simply starting from scratch would have been quicker. When it comes to coding, debugging in Rails can be difficult because there are so many layers to it, finding an error can take forever.

Now my opinion on which is better?

In my opinion they both can be better than the other depending on the case. If you’re creating a single page app then Node would be ideal because Node is event-based (event-based programming is a programming model in which the flow of the program is determined by events such as user actions.). These apps are real-time and handle a lot of concurrent requests. Under these scenarios, data constantly goes between the client and server. Then there’s Rails which is a better solution when your applications are very CPU intensive. And where development needs to happen quickly. Because of what I want to do and pursue, I think for myself I’d benefit more from learning and improving my Node skills than pursuing Rails.

--

--

Samantha Aleman

Fullstack software engineer with a passion for code, space, and corgis