Moving from PHP to NodeJS
Tags: php, javascript, node, laravel
Published: 2021-02-02 07:30:04

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

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/owx6u1e8r1mcv9kaz3x7.png)

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


![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/jhfbj4lixla3g9mknn64.png)

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

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/fh0phvc3tittiqhisnw0.png)

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

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/hpkt3vw6bl8sgepq6mz6.png)

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


## Package compatibility

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/3wbbs6x6q607jymstq7m.png)

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

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/hduh8prpuh30wuxd5sec.png)

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

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/66cmapssdoyn0sfbxujc.png)

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

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/tianlvxr0fpcgvis15pp.png)

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.