schnack.js is a simple node app for Disqus-like drop-in commenting on static websites.
- Say hello to Schnack.js
- Follow @schnackjs on Twitter
This is not a new idea, so there are a few projects that are doing almost the same thing:
- CoralProject Talk - Node + MongoDB + Redis
- Discourse - Ruby on Rails + PostgreSQL + Redis
- Commento - Go + Node
- Isso - Python + SQLite3
Node 6+ and SQLite.
The app runs as a node server that provides a JS file to be dropped into any website.
<div class="comments-go-here"></div>
<script src="//comments.yoursite.com/embed.js"
data-schnack-slug="post-slug"
data-schnack-target=".comments-go-here">
</script>
So far, users who want to post a comment need to Twitter or Github. More auth providers can be added easily, thanks to Passport.js.
Comments are stored in a SQLite database. For a normal sized blog this should last a couple of decades.
New comments need to be approved by the site admin, who can see and approve or reject them right in the comments section. To save some work, admins can "trust" certain authors so their comments are approved automatically.
Schnack.js provides two mechanisms to remind you of new comments. The old-school way is an RSS feed that you can use in services like IFTTT. Alternatively you can hook into a push notification service like Pushover to get notifications right to your phone.
New: web-push notifications
If you want you can be notified about new comments using web-push notifications. To configure this you need to do 3 things:
- Generate the vapid-keys using
node_modules/.bin/web-push generate-vapid-keys
and copy them into your config.json. - Copy the sw.js into your website's root path.
- Next time you log into your site you will be asked to allow notifications.
You can provide a list of user IDs of people you trust for each authentication provider. For instance, you could use the Twitter API to get a list of all the people you follow and drop that into the config.
"trust": {
"twitter": [
"916586732845400064",
"902094599329591296"
],
"github": [
1639, 2931, 2946, 3602, 4933
]
}
Schnack is yet another happy collaboration between Webkid and Gregor Aisch.
Schnack would never track who is using the software, so we don't know! If you are a Schnack user, let us know and we'll add your website here. So far Schnack is being used on: