Home

Awesome

rant.js, a comment system

rant.js is a comment system built using node.js and raw js. It uses a flat json file for the storage of the comments, and can be deployed in under a minute in any website. I use it to power the comments of my blog, which uses Jekyll, and therefore has no builtin way of handling comments. I could have used Disqus, but for some reasons, I didn't want to put the comments of my blog somewhere in the cloud.

Hence I created rant.js, to scratch my own itch. You can see a demo at http://blog.paul.cx/2011/09/Vasa-museum/. Mind the french.

Features

Features planned

Usage

  git clone https://github.com/joyent/node.git
  cd node
  ./configure
  make
  sudo make install
  # in your server directive :
  location /rant { \# This redirects example.com/rant to the node instance
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header Host $http_host;
    proxy_set_header X-NginX-Proxy true;
    proxy_pass http://app_cluster_1/;
    proxy_redirect off;
  }
  # somewhere else
  upstream app_cluster_1 {
    server 127.0.0.1:8125;
  }
  git clone https://github.com/padenot/rant.js.git
  cd rant.js
  node rant.js
<div id="rant_thread" lang="en"></div>
</div>
<script type="text/javascript">
<!-- Put the url to the node server here -->
  var script_url = 'http://localhost/rant/'; 

  (function() {
      var rant = document.createElement('script');
      rant.type = 'text/javascript';
      rant.src = script_url + "embed.js";
      (document.getElementsByTagName('head')[0] ||
       document.getElementsByTagName('body')[0]).appendChild(rant);
  })();
</script>
<noscript>Activez Javascript pour voir les commentaires</noscript>

If you want to display the recent comments, use something like this :

<div id="rant_recent"></div>

FAQ

Yes, I know I should refactor, and it is somewhat planned, but I'm not a web developper, and someone once said « Release early, release ofter ».

No, It works quite well for the low traffic my blog represents. I might change that to learn Redis, though.

Open a pull request, ping me on twitter, send me a mail, not all at once.

Yeah, suggestions welcome, patches too.

Dependencies

You should have an md5sum binary somewhere in your path on the server.