Last Updated: March 29, 2021
·
38.28K
· Ionut-Cristian Florescu

Node.js is not suitable for generic web projects (V)

Part IPart IIPart IIIPart IV • Part V


This is just my opinion. It's not immutable, but I can at least say it's well founded; during my career I've been writing code in C#, Java, PHP, Ruby, JavaScript, etc. I used to work on "serious" business applications for large financial corporations and I've also managed to survive as a private entrepreneur in a non-IT domain, so I've learnt to see the world through "non-IT lens" as well. But coding definitely became a lot more fun since I've discovered Node.js.

Based on that opinion, I had no second thoughts when I chose Node.js to rebuild LeasingSH.ro, a well-known repossessed car sales website in Romania. It's not a large project but it's exactly the kind of generic web project we're talking about here:

LeasingSH.ro - Auto recuperate și second hand de vânzare

One of the advantages of using Node.js is that we can probably handle more traffic than we'll ever get. Also, our response time improved significantly, despite the fact that we're still only using a single web instance:

LeasingSH.ro is now faster than ever

The codebase also became more readable and maintainable, because using a new technology indirectly brings new habits (versus the old PHP), such as using BitBucket for source-control, a cleaner separation of concerns - mostly due to using Jade templates, efficient client-side asset packaging and compression with ASPAX.

As a conclusion, I'd like to see more generic web projects built on Node.js. Too many of those are still powered by PHP. Don't get me wrong, I've used PHP for years and I'm not against it, but sometimes we have to look up to the future.

// END


Part IPart IIPart IIIPart IV • Part V

15 Responses
Add your response

Sorry for having to break it up into 5 parts, but apparently there's a limit on the text size somewhere...

over 1 year ago ·

great post!

over 1 year ago ·

Thanks for reading, @samwu123 !

over 1 year ago ·

Good post. I personally enjoyed converting some projects to Node during my learning process, and I did not have issues in terms of "this can't be done". I think one nice thing that could be produced is a CMS equivalent to Joomla or Wordpress in terms of ability, so that more "light-users" will adopt it! After all, isn't that what a lot of (lighter-weight or agency) sites these days are based on?

over 1 year ago ·

In the end its still javascript and that is tolerable at best. I'd like to hear your opinion on what you think the future-future of javascript should look like? Dart or Typescript (although this seems to really be just another layer on top of javascript. and yes I know dart can do the compiling to javascript too but it also runs natively in its own vm)

over 1 year ago ·

Thanks for reading, @sb8244 !

About a CMS comparable to Joomla or Wordpress - yes, I think you're right, and I was seriously considering the idea of starting such an initiative, then I discovered this successfully-funded Kickstarter project:

http://www.kickstarter.com/projects/johnonolan/ghost-just-a-blogging-platform

They say they're planning to have the first public release in September this year, and I'm kind of anxious what they'll come up with. If they'll keep up to the campaign, I think they have a good chance to change the landscape!...

over 1 year ago ·

@battlemidget - thanks for reading!

"[...] still javascript and that is tolerable at best" - I thought the same initially, but in the end it's a matter of personal preference and - as I was saying in my too-long pro tip - the subject will always spur "religious" debates :-).

The far-future? I really have no idea... I mean, who'd have thought about Node.js five years ago? As you were saying, like CS, TypeScript is another layer on top of JS (although it does bring some interesting features). Dart definitely looks interesting. But in the end, I thinks it's a matter of building an rich and open ecosystem around it. I think we won't really know until it's there.

over 1 year ago ·

great article! thanks!
Recently I've started a new project using Node.Js, but "callback hell" chasing me every step. Looking to your code at screenshots I found it very clean and understandable. IcedCoffeeScript was a big surprise for me and I begin to dig it deeper. Unfortunately there not to much information about it. Could you please make some post with simple example of architecture of LeasingSh? Did you use any frameworks such as Brunch for the skeleton? How do you implement API and main code communication? Leasingsh is closed source, but maybe you could publish some not sensitive parts as example of "how to do the things right and not reinvent the wheel"?
thank you in advance

over 1 year ago ·

Thanks for reading, @tiberule!

Yes, IcedCoffeeScript does help a lot; actually I believe it is one of the main triggers enabling people to approach "generic" web projects in Node.js. I know there aren't many examples of you could/should use it in real-word apps and I was also considering the idea of publishing some kind of "how to" (and I'll do my best, but unfortunately I don't think I can do it sooner than 2-3 weeks :-).

Until then, I'll try to answer some of your questions here.

No, I haven't used Brunch (but it does look interesting).
LeasingSH.ro has a rather simple Express.js-based MVC architecture; I'm using Mongoose models and a custom controller definition & loading implementation, because the routing mechanism had to be very flexible. For client-side asset management & packaging I wrote and used ASPA (you can check it up on npmjs.org), but there are many alternatives out there.
Also, to get most of our PaaS instance I used Node.js cluster processes - they're still marked as an experimental feature, but in my experience they've been working perfectly, and are making a difference in speed. I plan to write a quick tip about that as well soon :-).

over 1 year ago ·

I'm a web developer (.net) with a good knowledge and experience of javascript; in your opinion what is the best way to start learning and using node.js?

I forgot to say: it was a very good post..
Thanks.

over 1 year ago ·

Excellent article.

Coming over to NodeJS has been an interesting battle for me. I had written a couple simple generic service apps in NodeJS, and never really got to "liking" it. Primarily because of Callback Hell. Just dealt with some of the idiosyncrasies that it has. Then I ended up doing a much larger project in it, and that 'sealed the deal' for me. Comparing what NodeJS offers to other frameworks doesn't really capture the feel of the language, and the power that it has. I'm not really sure there is a good way to capture the feeling. It's almost something that you have to just jump in with both feet (as opposed to dipping in a toe), and see for yourself.

over 1 year ago ·

@crueber - we've had the same experience, I believe.

Well said, about "jumping in with both feet" vs. "dipping in a toe" :-)

over 1 year ago ·

@borntorun - thank you for your kind words!

About starting to learn and use Node.js, for me it was a long - if not convoluted - yet rewarding path. Years ago I used to do a lot of coding in .NET (C#), then, due to a switch in my "career" and lifestyle I became more and more interested in open-source technologies. I went through Ruby / RoR for a while, then I found Node.js.

To build a good understanding of the language/platform, there are two excellent books I'd recommend every day, "The Node Beginner Book" by Manuel Kiessling and "Mixu's Node book" by Mikito Takada.

Also, if you're coming from the .NET world, you'll probably find that this is a completely different type of ecosystem and you'll need to get used to a completely different approach to learn things - for one, there's no MSDN you can rely on :-).

I'd also say a good understanding of functional and event-based programming is necessary, and I know many people have difficulties when switching from a purely OOP-based environment.

And there's the issue of ecosystem, as - in my opinion - the power of Node.js lays not only in the language flexibility and the V8 engine, but in the richness of its ecosystem as well; there's probably a module out there on Npm.js/GitHub for every use-case you can think of: authentication mechanisms, sockets, template engines, data storage, image manipulation, etc. So you'll have to get used to digging through them and choosing what's best for you :-).

If you're a .NET developer, you're probably using Windows; using Node.js in real life goes better with OS X or Linux.

And finally, build a REAL, complete "generic web project". As @crueber was saying above, there's a huge difference between "dipping in a toe" and "jumping in with both feet" :-).

over 1 year ago ·

Thanks so much for the response.
I'm also making an approach to open source technologies (work with linux too) because I realized that's where things are moving very quickly, and javascript applications-based are going to continue to get a big boost.
Your advice to build a REAL project was inded in my mind (I' really very saturated trying to "learn" from "to-do list" tutorials and apps because the real-world applications poses other problems and issues that do not exist in that kind of projects).
I'll will look for those books you mentioned... and others too.
And again... thanks!

over 1 year ago ·

I had heard of iced coffeescript before, but never bothered to investigate deeper; thanks for that! Also, for an even more "railsy" framework, Sails.js fits the bill. It isn't quite to v1 yet, and their ORM -- waterline -- is a bit immature as of writing, but it's incredibly promising.

Cheers.

over 1 year ago ·

Have a fresh tip? Share with Coderwall community!

Post
Post a tip