Node.js Project - Invent a commenting system that works

By Ev Bogue - August 5th 2015

I used the Minimalist Unicorn piece to test having comments on blog using Gitlab, which is a hackjob solution because I'm outsourcing the comments to Gitlab. This is bad because I'm using someone else's platform, but there are some benefits such as exposing readers to a git diff of the post they are commenting, as well as Gitlab's somewhat robust commenting system.

Almost every solution to having comments is a hackjob solution. I did a search on comments on npmjs.org and it turned up nada. I don't want to use Disqus because Disqus is a horrible centralized commenting virus that has invaded most of the distributed web.

The way I see it, there are two problems with comments.

  1. Conversation entropy. Comments are at their heart a customer service application. Once upon a time I had a heated debate with a guy who was trying to sell smart passive income books on the Internet in an attempt to convince him in front of a large audience that he was running a dumb active business if he answered every one of his comments and all of his emails. He obviously didn't hear my point, because it would have undermined all of the sales of his get rich quick books. However, the point is still true, comments are a customer service business because you are dealing with people. The biggest problem with clients is how to keep people and spammers from destroying the system with unqualified drivel. To some extent this can be managed by a hands-on-approach of verbal smackarounding, but at a certain point a business will scale too big and the trolls will win. How does a commenting system handle this? news.ycombinator.com and reddit seem to be some of the best answers to this question, but they suffer from the next problem

  2. Centralization. Because commenting is a dumb active business with a lot of maintenance involved, it's hard to get them going on your own VPS. Part of this is because there isn't a platform independent open source solution to comments. The other part is comments are a lot of work, and if you just leave them on without checking in on them regularly you might find your blog has become a hotbed of comment spam leading to get rich quick websites either run by bots or people who answer all of their comments. Comments are a risk becuse of spam and abuse, and any company that hosts centralized comments is taking on that risk and employing people to moderate flagged comments all day long whether they can afford to do this or not.

So let's say in theory you or I wanted to build a commenting system in Node.js, what needs to happen to have a minimum viable commenting system?

Start simple

I think the simple way to build a commenting system is to start with a guestbook. A guestbook is a simple commenting system with only one route.

The frontend would look similar to this:

<form action="http://localhost:4000/guestbook" method="post">
<input type="input" name="name" placeholder="Full name"/><br />
<input type="input" name="email" placeholder="Email"/><br />
<input type="input" name="website" placeholder="Website (optional)"/><br />
<textarea name="comment" placeholder="Your comment"></textarea><br />
<button type="submit">Comment</button>

Which would render similar to this.

[Please note that this form doesn't actually work and probably will not even return an error.]

If you note, this isn't all that different from Koa.js application that I use for signups to The Mailing in the right navigation bar of this site.

To get started building this guestbook application we'd need to...

Write a short application in Node.js Pick a web application framework such as Koa.js Parse the contents of the POST body that the browser is sending to the Koa.js application. The co-body module would work perfect to this, similar to how I'm using it in The Mailing's Koa.js application Next we need to save the parsed body somewhere. This probably needs to be a json object saved to a database. This can be any database, but it'd be easier if it's a database that can be installed using npm install, so that the end user doesn't have to do any configuration to use the application. Finally we need to have the Koa.js call the database and return the value of the objects saved to the database for the guestbook.

Once this is figured out, it isn't hard to imagine that it can be scaled up to contain objects for every blog post in the collections available within the current Metalwork blog that I'm using...

One of the biggest issues with doing this on the backend is compatibility with Metalwork. Because Metalwork is rendering posts down to static HTML, it's not rendering the routes on the fly (that'd be slower), so realtime comments would be difficult.

Another option is to have a seperate application that handles the comments and then call this application using a frontend JavaScript embed.

This is where Node.js gets really interesting, because you're coding the backend and the frontend using the same language. That's why every Ruby on Rails developer shits themselves when you talk to them about Node.js.

Anyway, that is the idea. I'm thinking about implementing it. I'm also interested if you do. The current world of commenting systems is abismal, and there's a lot of opportunity for growth. If you look at the amount of people using slightly advanced commenting systems such as Disqus or Reddit or HN you can see just how much of a market opportunity there is for developers who know how to develop this kind of application. The trouble is, it's hard and do you want to? Also it's first and foremost a customer service app, so there's only dumb active income to be gained here.

Go develop! Answer comments! Make lots of dumb active income!

What will it take to bring minimalism back? →

← Four months of The Client List