technology

Moving from PHP to NodeJS

I started my career in Web development using PHP. Since that day, PHP was evolving and getting more robust and performant than before. With Frameworks like Laravel, PHP has increased its popularity, keeping it one of the main programming languages that companies choose to create their websites.

 

If PHP with Laravel is a very good option for making high scalable websites, why have I decided to switch to the Node.JS/Javascript ecosystem?

 

Many reasons make me move from my comfort zone to challenge myself with a new programming language.

 

One programming language

notion image
 

When you are creating successful websites/services, one of the most important factors is if they have a good UI/UX. In the past, these interfaces were static, but now, they are more reactive to the users' interactions and require you to combine Javascript with your backend language.

 

This combination makes you to master two different programming languages and switches the way you write code from one to another.

 

In the end, most of the time is spent on the user interface and less on the backend. The hard work is now on the frontend.

 

The first reason for moving to Node.JS is to utilize the same language both on the frontend and backend. And this leads to the next point.

 

One type of programmer

notion image
 

Utilizing the same programming languages across all of our projects simplifies the hiring process. Because if you hire a programmer who is good at Javascript/Node.JS, they can participate in the frontend and backend, etc.

Today companies, need to create their website and mobile applications, and Javascript with hybrid solutions such as React Native allows you to use Javascript to create multi-platform applications.

 

Sharing responsibilities between the team

notion image
 

One common programming language allows having more synergy between your team.

Now all the team can switch between projects and collaborate with other members.

 

There is no more, the backend guy or the just frontend guy. Of course, all of us have our strengths and weaknesses, but It doesn't block to support other members with problems or deadlines.

 

Code review across projects

notion image
 

Because all the team members use the same languages, They can review each other code allowing them to strengthen the team.

 

Package compatibility

notion image
 

In the PHP world, some libraries depend on a specific version of PHP, but in the Node.JS world, everything is compiled at the end with the help of webpack, etc., so you don't need to worry so much about these problems.

Same as PHP with composer packages, there are NPM with millions of packages to help you to create sophisticated websites.

 

Speed of Development

notion image

It's just javascript, As long as you are using the latest version of Node.JS on your computer and, You can share part of your code between all of your projects (web, mobile app, backend).

 

Testing

notion image
 

Without any doubt, Javascript is very mature when it comes to testing applications. And the good part is that you can use the same testing framework for your website, backend, and mobile apps.

 

If you use Javascript with Typescript adding strong typing will save you time catching errors and proving fixes before running code. You will be surprised about how good it works.

 

Host Anywhere

notion image
 

Because your app mostly depends on Node.JS that comes by default in most of the OS. It's effortless to host your application anywhere.

 

Node.JS/JS apps are the best fit for serverless solutions, saving you cost, and ensuring that your applications scale together with your traffic. You don't have to worry anymore about managing servers.

 

Final Conclusions

PHP still an excellent option. I really like PHP; don't misunderstand me. But at the end of the day, Node.JS makes my developer experience(DX) much better, and It's what the market is requiring.