Is Node.js a good alternative to build complete websites? Is Node.js a good alternative to build complete websites? node.js node.js

Is Node.js a good alternative to build complete websites?


I imagine it must lack many thingsRails offers.

I gave a short list below but I would like to know what you could be missing and I think(almost certain) we can give you some alternatives on node.js.


Modules

node.js is getting pretty complete and I think you can run your entire site using only node.js using for example the following modules. I assume you know about npm. If not I really advice you to google for it and learn that. To search npm you can use http://search.npmjs.org:

web framework:

  1. High performance, high class webdevelopment for Node.js
    https://github.com/visionmedia/express

  2. Socket.IO aims to make realtime apps possible in every browser and mobiledevice, blurring the differencesbetween the different transportmechanisms.https://github.com/learnboost/socket.io-node

I believe with these two web-frameworks you can create a lot of sites. For example express is a very powerfull web framework and supports a lot of cool things like:

  • session support.
  • a lot powerful template engines. I like Jade for example. You could also share these between client and server a lot of the times easily.
  • excellent routing.

just to name a few.

database:

  1. Redis is an open source, advancedkey-value store. It is often referredto as a data structure server sincekeys can contain strings, hashes,lists, sets and sorted sets.
    https://github.com/mranney/node_redis

  2. MongoDB (from "humongous") is a scalable, high-performance, open source,document-oriented database.Mongoose is a MongoDB object modeling tool designed to work in anasychronous environment.
    https://github.com/learnboost/mongoose/

With those two databases I think you should be able to accomplish most of your tasks. The nice thing is that Redis is extremely fast/simple advanced KV-store(dataset in memory/also supports VM) and supports replication while Mongodb is more completely(slower then redis) and also supports sharding.

authentication:

  1. Authentication and authorization (password, facebook, & more) for your node.js Connect and Express apps.
    https://github.com/bnoguchi/everyauth

Like I said previously you can get a long way with only these modules.


Express.js is more akin to Sinatra. They're simpler frameworks than rails.

Express's list of sites is fairly small http://expressjs.com/applications.html

So I think it's also good to look at Sinatra's list http://www.sinatrarb.com/wild.html

So to answer your questions in reverse order. Yes it lacks all the features of rails. Yes there are sites written completely in Express. And going to 100% Node.js might be the right decision for your site.

It depends on which features you'd miss and what performance you need.


I'm not sure, but I guess it's perfectly possible. I have built complete sites using plain server side javascript for years without problems. The advantage of node.js seems to be its event driven model and things like socket.io. I just started experimenting with it, I'll probably will try porting an existing site to node.js.

Here you can find a large list of sites built with node.js.

Finally, you may want to read: What it’s like building a real website in Node.js