Node.js or PHP for a large-scale web platform?

PHP is great, especially with the latest releases, it offers great performance and a lot of improvements, but still, Node.js shows better performance thanks to the async approach.

tufayalhossin
tufayalhossin
Tufayal Hossin Emon

  • The Riskiest Thing Is To Take No Risks.
  • Writen article 12
Node.js or PHP for a large-scale web platform?

Here's what we've been up to recently.


Node.js or PHP for a large-scale web platform?

Both PHP (with Laravel) and Node.js (with NestJS) will do the job, but there are a few things we took into account that helped us make our decision:

  • PHP is great, especially with the latest releases, it offers great performance and a lot of improvements, but still, Node.js shows better performance thanks to the async approach
  • The well-known advantage of using JavaScript for the back end and front end also gives us a lot more flexibility in the development team — this means that more developers can contribute to both the front and back end and collaborate more on different components of the product we will be building
  • NestJS enforces good DDD architecture and separation of concerns, so one can invite an Angular Front-End developer to work on the back end and he/she would manage with ease
  • Node.js is better when it comes to building a JSON API — it is not messing up with HTML (separation of concerns), while with PHP you may have the temptation to serve HTML right from the monolith
  • Node.js and especially the NestJS communities feel more conversant. In the PHP world, it takes more time to filter out the noise, there is a lot of information for every potential problem you have in PHP, but most of the solutions are far from the best
  • With the rapidly growing ecosystem around JavaScript, which has its pros and cons, comes NestJS which gives the promise of LTS and relies on proven architecture and principles
  • A lot of popular programming languages like Python, Java, C and Ruby can be compiled to JavaScript — see here
  • npm/yarn have a large pool of dependencies and they require more wise picking and double-checking when it comes to installing yet another dependency in the project. Personally, I don’t think the composer world is much different. you always have to think twice and verify when you invite someone else to contribute to the code inside a project
  • TypeScript is way better than PHP’s native types of “warning” support. Of course, it comes with a learning curve for people who have never used a strongly typed language and it has drawbacks when you want to use some npm dependency that doesn’t have TypeScript support, but the truth is that almost all of the popular packages already have it

In the end, based on all of the above, we chose Node.js and so far everything looks promising in terms of performance, development speed, unit testing. We will be happy to share another update after a couple of months, where we will cover the biggest challenges we have faced and essentially provide an answer to the question “Would it be better if we were doing this with PHP?”


Further Resources For You

Here's what we've been up to recently.

View all