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 🙏

© 2025 – Pkg Stats / Ryan Hefner

nodeserver-backend-boilerplate

v0.1.0

Published

Boilerplate for API Server written in Node.js and ES6

Readme

NODESEVER-BACKEND-BOILERPLATE

A complete initial boilerplate for any WEB and MOBILE application to provide REST APIs, written in Node.js and ES6.

Key features

1. API exposed

  • /api/v1/register -For signUp.
  • /api/v1/login -For logIn.
  • /api/v1/logout -For logOut.
  • /api/v1/resetPassword -For reset password.
  • /api/v1/updatePassword -For update password.

2. Introduced Prisma which support MySQL, PostgreSQL, MongoDB.

3. Proper error handling.

4. Nodemailer implemented for Reset Password.

5.For encryption/decryption, methods have been written in CRYPT.JS

6.All APIs can be seen in SWAGGER DOCS on http://localhost:5001/api-docs/

Swagger configuration

  • After starting the server in development mode swagger can be run with this url. http://localhost:5001/api-docs/

  • After adding any new API, need to update SWAGGER.js for that API.

Requirements

To start any WEB or MOBILE application, we need complete package of REST APIs like signup/login/logout/resetPassword/UpdatePassword. This boilerplate can be used.

Dependencies

  • Watcher and hot-reload: nodemon
  • Build: babel
    • tools: babel-cli, babel-core
    • presets: babel-preset-es2015-node6, babel-preset-stage-3
  • Deployment: PM2
  • Tech Stack:

Logger implemented

Build Setup

# install dependencies
npm install

# run for development with hot reload at localhost:5001
npm start

# build for production
npm run build

# run for production.
npm run serve

# run for test
npm run test

Mailer service configuration

  • Copy env file to .env
  • Write necessary mailer service information.

To connect to database, need to start prisma server.Below is the prisma configuration

Prisma configuration

# Install the Prisma CLI
brew install prisma

# Install Docker
To use Prisma locally, you need to have Docker installed on your machine. If you don\'t have Docker yet, you can download the Docker Community Edition for your operating system here.
https://www.docker.com/products/docker-engine

1. Prisma setup for new data-base

1. Make new folder

# Set up and connect Prisma with a database
mkdir hello-world
cd hello-world

# Create Docker Compose file
To launch Prisma on your machine, you need a Docker Compose file that configures Prisma and specifies the database it can connect to.
touch docker-compose.yml

# Add Prisma and database Docker images
Paste the following contents into the Docker Compose file you just created: for MongoDB

version: '3'
services:
  prisma:
    image: prismagraphql/prisma:1.30
    restart: always
    ports:
    - "4466:4466"
    environment:
      PRISMA_CONFIG: |
        port: 4466
        databases:
          default:
            connector: mongo
            uri: mongodb://prisma:prisma@mongo
  mongo:
    image: mongo:3.6
    restart: always
    environment:
      MONGO_INITDB_ROOT_USERNAME: prisma
      MONGO_INITDB_ROOT_PASSWORD: prisma
    ports:
      - "27017:27017"
    volumes:
      - mongo:/var/lib/mongo
volumes:
  mongo:

# Launch Prisma and the connected database
docker-compose up -d

2. Configure your Prisma API

To bootstrap the configuration files for your Prisma client run the following command: prisma init --endpoint http://localhost:4466 The endpoint needs to match the URL of a running Prisma server.

3. Deploy the Prisma datamodel

The prisma init command created the minimal setup needed to deploy the Prisma datamodel: prisma.yml and datamodel.prisma. prisma deploy

4. View and edit your data in Prisma Admin

If you want to view and edit the data in your database, you can use Prisma Admin. To access Prisma Admin, you need to append /_admin to your Prisma endpoint, for example: http://localhost:4466/_admin.

5. Generate your Prisma client

The Prisma client is a custom, auto-generated library that connects to your Prisma API. Append the following lines to the end of your prisma.yml: prisma generate

2. Prisma setup for existing data-base

1. https://www.prisma.io/docs/get-started/01-setting-up-prisma-existing-database-JAVASCRIPT-a003/

prisma init hello-world
  1. This launches an interactive wizard. Here's what you need to do:
  2. Select Use existing database
  3. Select your database, either PostgreSQL or MongoDB
  4. Provide the connection details for your database (see below for more info)
  5. Select the Prisma JavaScript client

2. Launch Prisma

cd hello-world
docker-compose up -d

3. Deploy the Prisma datamodel

prisma deploy

3. Process when you need to update databasemodel.prisma

  1. Update databasemodel.prisma
  2. docker-compose up -d (Start server if not started)
  3. prisma deploy
  4. prisma generate (To generate prisma client plug in)