DEV Community

Rodrigo Ramirez
Rodrigo Ramirez

Posted on • Originally published at xpromx.me

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

Alt Text

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

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

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

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

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

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

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

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.

Top comments (12)

Collapse
 
laurensiusadi profile image
Laurensius Adi

Any framework that closely resembles what Laravel offers in Node JS?

Collapse
 
willvincent profile image
Will Vincent

AdonisJS. Thank me later

Collapse
 
kalecio profile image
Kalécio

You should definetly give AdonisJs a try

Collapse
 
xpromx profile image
Rodrigo Ramirez

adonisjs.com is the Laravel version for NodeJS. I plan to write a blog soon about alternatives for those who have experience with Laravel.

Collapse
 
adegbengaagoro profile image
Agoro, Adegbenga. B

You should look into AdonisJs - adonisjs.com

Collapse
 
mezie profile image
Chimezie Enyinnaya

Yes, AdonisJS

Collapse
 
laurensiusadi profile image
Laurensius Adi

Got it, thanks everyone

Collapse
 
martyonthefly profile image
Sylvain Marty

I'm from the PHP Symfony framework and I really like NestJS! Check it out, it may be an interesting for you.

Collapse
 
sroehrl profile image
neoan

Hey Rodrigo,
I uploaded a video about how I digest content for devs for my students (I teach webdev on wyzant). As I found myself being relatively critical of this article, I would like to give you the chance to respond - maybe even meet online and talk through it if you want.
Let me know if you are interested: youtu.be/Yzqc_3dzGxM

Collapse
 
xpromx profile image
Rodrigo Ramirez

Hey neoan, thank you for your honest feedback, It was one of my first articles, and you let me know what information is important for technical blogs.

I plan to re-write this one, adding a context that will make things clearer because it applies to my particular case.

Collapse
 
chukwuemekaigbokwe profile image
Chukwuemeka Igbokwe

Expresswebjs

Collapse
 
truekontrast profile image
Gabriel Audette

NestJs !