npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

commentcan

v0.0.1

Published

Out of the box comment solution for your statically built blog

Downloads

7

Readme

Commentcan

The out of the box comment solution for a statically built blog.

Launch a comment app in a docker container. Inject it to any page just by inserting a <script> tag. Can be easily used with static sites built with Jekyll and so on.

Usage

Run

What you will need is a running mongodb instance.

Here is an example of how it might be set up with a docker-compose project:

---

version: '3'

services:
  mongo:
    image: mongo:4.4
    ports:
      - 27017:27017
    environment:
      MONGO_INITDB_ROOT_USERNAME: root
      MONGO_INITDB_ROOT_PASSWORD: example
  commentcan:
    build: .
    ports:
      - 80:3000
      - 443:3000
    environment:
      PORT: 3000
      APP_URL: http://localhost:1992
      CONSUMER_URL: http://localhost:14000
      SECRET: any-randomly-choosen-string
      MONGO_URI: mongodb://mongo:27017/commentcan
      MONGO_USER: root
      MONGO_PASS: example
      FACEBOOK_CLIENT_ID: 111111111111111
      FACEBOOK_CLIENT_SECRET: 11111111111111111111111111111111

Here's an explanation of what the env variables mean here:

  • PORT - Port on which the app will listen. Should be equal to the port that is exported by the ports directive. There's basically nothing to change here.
  • APP_URL - Full app URL (if the app is behind the proxy, put the external URL of the app here)
  • CONSUMER_URL - The URL of your external APP (e.g. your static blog) where you plan to inject the comments
  • SECRET - Any randomly choosen secret string of text
  • MONGO_URI - MongoDB connection URI
  • MONGO_USER - MongoDB username
  • MONGO_PASS - MongoDB password
  • FACEBOOK_CLIENT_ID - Facebook APP client ID
  • FACEBOOK_CLIENT_SECRET - Facebook APP client secret

Inject to a page

First of all you will need to give your page an Id by setting a specific meta tag with a property attribute equal to commentcanPageId and a content attribute equal to any random unique value which will be used to identify a page on your website:

<meta property="commentcanPageId" content="page1" />

You might (optionally) want to apply the predifined stylesheets:

<link rel="stylesheet" href="<APP_URL>/comments.css">

Now define the root area for the comments and finally inject a script:

<div id="commentcan-root"></div>
<script src="<APP_URL>/embed-script.js"></script>

Just don't forget to replace the <APP_URL> with the URL of your running commentcan instance.

TODO

  • Allow authentication with a way more providers (Github, Reddit, Twitter etc.)
  • Testing
  • Pagination
  • Pipe the FE code through babel to make it ES-5 compatible
  • Prettify the default styles
  • Implement several style themes
  • Implement a simple admin panel with an UI
  • Basic CSRF protection
  • Optional WebSocket support
  • Support of multiple consumer apps
  • Making more plans...