Skip to content
Get started with node-js in small incremental steps
Find file
Pull request Compare This branch is even with bigbinary:master.
Latest commit 53f79d7 Sep 7, 2010 Neeraj Singh Fixing typo ht: fisherwebdev
Failed to load latest commit information.
README.textile Fixing typo ht: fisherwebdev Sep 7, 2010
client.js step13 Mar 25, 2010
index.html step11 Mar 22, 2010
jquery-1.4.2.js step4 Mar 15, 2010
server.js step5 Mar 15, 2010
style.css step8 Mar 16, 2010
util.js step10 Mar 16, 2010



node-chat is a good working example of the power of nodejs . However some people have trouble getting started with the source code of node-chat application. In order to help to you get started I have developed the skeleton of application in 12 different steps.

The step1 is as simple as this .

Installing nodejs

I developed this application with node version 0.1.32 . Installing node is easy.

git clone git:// 
cd node 
git checkout v0.1.32 
make install 

Checking out source code

All the 12 steps are tagged with step1 to step12. This is how you can get code for tag step1.

git clone git:// 
cd node-chat-in-steps
git checkout -b personal_step1 step1

If you want to go to step2 the just do

git checkout -b personal_step2 step2

Starting server and visiting page

node server.js

After the server has been started visit http://localhost:8002 .

Functionalities in different steps


  • create a server that responds with hello world on port 8002


  • create an index.html and serve it


  • introduce util.js
  • change the logic so that any static file is served
  • show 404 in case no file is found


  • add jquery-1.4.2.js
  • add client.js
  • change index.html to prompt user for nickname


  • send a join request when user enters nick name
  • respond with a JSON in reply to /join request


  • after ther nick name is accepted display chat screen


  • create session object which identifies if a person is already in
  • send this session object back to client when a person joins in
  • if the nick is in use the provide that feedback to user


  • add style.css


  • after logging in display current time


  • display number of active users logging in
  • after showing the toolbar send a request /who
  • capture the number of active users


  • display message that user joined after a user joins chat


  • better timestamp while displaying message


  • when user hits enter then invoke send function
Something went wrong with that request. Please try again.