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

lean-boilerplate

v0.0.12

Published

A simple cli to scaffold your Node JS app fast for REST API's, Shopify Apps, Machine Learning and AI

Downloads

17

Readme

Lean Boilerplate

A simple cli to scaffold your Node JS app fast for REST API's, Shopify Apps, Machine Learning and AI.

Installation

npm install -g lean-boilerplate

Getting Started

After installing the package as a global executable. You will be able to use "Boilerplate" command to generate new boilerplate.

$~ boilerplate

Boilerplate Structure

A basic User Controller and Model has already been made with it collection schema for mongodb with some examples of the validations.

The boilerplate uses lang files for the storage of static data and mail structures to be used in the API.

JsonWebToken and Nodemailer integration has also been made using the helpers file integration.

├── app
│   ├── controllers
│   │   └── UserController.js
│   ├── controllers.js
│   ├── helpers
│   │   ├── jwt.js
│   │   └── mailer.js
│   ├── helpers.js
│   ├── lang
│   │   └── user.js
│   ├── lang.js
│   ├── models
│   │   ├── user.js
│   │   └── validator
│   │       └── schemaValidator.js
│   └── models.js
├── app.js
├── bin
│   └── www
├── package.json
├── package-lock.json
├── public
│   └── css
│       └── style.css
└── routes.js

Preinstalled Packages

  • axios
  • bcrypt
  • cors*
  • dotenv*
  • jsonwebtoken*
  • lodash
  • mongodb*
  • mongoose*
  • mongoose-beautiful-unique-validation*
  • mongoose-validator*
  • multer
  • nodemailer*
  • randomstring
  • express-swagger-generator* (dev)
  • pm2

(*) Indicates that the package has been integrated with helpers files for plug and play usage. (dev) Indicates its a Developer Dependency

Environment Variables

A predefined .env.example file is present in the root of the boilerplate.

The variables are being used throughout the boilerplate and new variables can be added to it and can be accessed anywhere in the boilerplate using process.env.VARIABLE_NAME

Use the command below to copy the .env.example to a new .env file which the boilerplate will use.

cp .env.example .env

Contents of the .env

MONGO_URL=mongodb://localhost:27017/database-name

SWAGGER_TITLE=Boilerplate API
SWAGGER_DESCRIPTION=Boilerplate - API Sandbox
SWAGGER_VERSION=1.0.1
SWAGGER_API_HOST=localhost:3000

SMTP_HOST=smtp.gmail.com
SMTP_PORT=465
SMTP_SSL=tls
SMTP_USER=
SMTP_PASS=

JWT_KEY=tHisAvErYsECuReKeY
JWT_AUDIENCE=NoDeGeNeRaToR
JWT_EXPIRY=10h

PORT=3000

Swagger Integration

Swagger has been integrated as a middleware in the boilerplate.

The documentation will be available at

http://SWAGGER_API_HOST/api-docs

Documentation will be generated automatically by making comments over the methods in the controller files.

Example can be found in app > controllers > UserController.js

PM2 Integration

Now you can start the PM2 Process Manager and listin to your code changes

npm install -g pm2
pm2 start

You can use the above script to run your code through the pm2 process manager.

Auth Module

A new fully functional Authentication Module has been added to the boilerplate. It can be used as is with any of your new website or it can be taken as a reference on how to follow the standards as set by the boilerplate.

Author

Anurag Makol