Mircea Dinoiu

Moving from PHP with Laravel to NodeJS with Express

April 29, 2017

One of my long term applications I’m working on is Financial. I started it with a composition of:

  • DB: MySQL
  • Backend: PHP with Laravel
  • UI: Desktop interface with ExtJS
Early this year I added to the stack a Mobile UI created with React and Material-UI.

Now I feel it was not the right choice to bring PHP in this game as it involves too much of a ceremony and complexity to do development with it.

I believed that doing NodeJS was premature at that time and didn’t offer enough tools to develop an application like this easily, but things have changed in the meantime.

Here are the architectural changes I had to do during this migration:

  1. Routing with Express (before: Laravel Routing)
  2. Database interaction with Sequelize (before: Laravel Eloquent)
  3. Session with connect-session-sequelize and express-session (before: Laravel Session)
  4. Authentication with passport and passport-local (before: Laravel Authentication)
  5. Password hashing with bcrypt-nodejs (before: PHP password_hash)
  6. CSRF Token with csurf (before: Laravel CSRF)
  7. Config management with config (before: Laravel Config)
  8. md5 hashing with md5 (before: PHP md5)
  9. XML parsing with xml2js (before: PHP simplexml_load_file)
  10. Input validation with validator (before: Laravel Validation)
  11. Platform detection with UAParser.js (before: MobileDetect)
  12. Shell view generation with Handlebars.js (before: Laravel Blade)
Pull Request for reference: GitHub

Kyle Mathews
Front End Dev living in Bay Area. I love video games and snowboarding.