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

carrots

v0.1.3

Published

This package started out as a very simple way for me to test & prove that Enmap was easy to use an integrate into an express.js app. The best way, I thought, to do this, was to write a blog platform. So I started doing that. And then I wrote an admin for

Downloads

6

Readme

Carrots (work in progress)

This package started out as a very simple way for me to test & prove that Enmap was easy to use an integrate into an express.js app. The best way, I thought, to do this, was to write a blog platform. So I started doing that. And then I wrote an admin for it. Then I started writing an API for it. Then a CLI feature.

And now we have this. This is a boilerplate for making your own blog. It's not meant to be directly used as-is, because the styling is pretty basic, the wording of the templates is not-funny-to-passive-agressive, and it might still be missing features you want in a blog platform. But, it's at least secure enough (passwords are salted, hashed, bcrypted, the API is token-secured, etc), and stable enough, that it's useable in its current state.

Carrots? If you plop in "Lorem ipsum dolor sit amet" into Google Translate, it translates to... Lorem ipsum carrots. I found this funny... And so I took it. :D

Pre-Requisites

Carrots uses enmap for data storage, which is a wrapper around better-sqlite3. Thus, the data is in fact stored in sqlite. But, as with any sqlite module on node, it requires a build system to work. Rather than reproduce my enmap docs here, let me point you to the pre-requisites docs. Please follow the instructions in the tabbed box for your operating system, then come back here.

Getting and Installing

To install Carrots, once the pre-requisites are properly installed, open a new command prompt and type the following commands:

git clone https://github.com/eslachance/carrots.git
cd Carrots
npm install

You also have to copy config.json.example to config.json and edit its contents to your desired configuration:

  • saltRounds: Used for bcrypt. More rounds means more secure, but a little slower.
  • secret: The secret used for salting sessions. Can be just any unique string.
  • port: The port you want the http server to listen on. 8080 by default, 80 for the regular http port.

Once you've saved the config.json file, simply run node . and it should start the blog server.

Additional Utilities

There are 2 useful tools you might want to consider for use with this module.

pm2

pm2 is a process manager, meaning it can keep your project running even if you close the command prompt. It also gives you the console log output of your project and saves it to a log file, making for easy and painless debugging and running.

Initial Setup:

npm i -g pm2
pm2 start index.js --name="myblog"

Other Commands:

  • pm2 logs myblog to see the logs in realtime
  • pm2 stop myblog to stop the project
  • pm2 start myblog to start the project in the future
  • pm2 restart myblog to... you get the picture, right?
  • pm2 save to save the current configured app to a file
  • pm2 resurrect to restore the saved configuration after a computer reboot.

ngrok

ngrok is an http tunnel, meaning it can give you a public URL for your project so you can show it off. With a paid subscription you can also have a custom subdomain that's permanent, but by default it will change every time you launch it.

  • Follow The setup instructions to download, configure, and setup ngrok initially.
  • Make sure the ngrok.exe file is in your PATH (or in the same folder as your project)
  • Run ngrok http 8080 (or replace with your port in config.json) to start the tunnel.

As long as ngrok is running, the "Forwarding" URL shown in the console log will be your blog's public address.

Documentation / API

To be done. I'll wait for them to be actually complete before I document them :P