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 🙏

© 2026 – Pkg Stats / Ryan Hefner

pern-boilerplate-backend

v0.0.1

Published

![PERN Header](https://github.com/DFMichelangelo/DFMichelangelo/blob/main/media/PERN%20Header.png?raw=true)

Downloads

11

Readme

PERN Boilerplate Backend

PERN Header

A PERN (Postgres, Express, React, Node) Boilerplate for developing and go-prod

Technologies

  • 🖥️ Node
  • 🖼️ React
  • ⛓️ Typescript
  • 🐘 PostgreSQL

Platforms

| Platform | Hosted On | Github Actions | |------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------| | 🖥️ Backend | Heroku App Status | workflow badge | | 🖼️ Webapp/App/PWA - Client Side | Netlify Status | workflow badge | | 🎛️ Admin - Admin Side | Netlify Status | workflow badge |

Features

  • 🖼️ Basic Frontend Theme
  • 🧑‍🤝‍🧑 User Management System
  • 🤴 User Roles & Permissions
  • 📱 Multiplatform
  • ➡️ Authentication through Refresh Token & Cookies
  • 📘 Email Login & Social Login (Google and Facebook)
  • 💥 Logs System and Logs Rotation
  • ⚖️ GDPR Compliant

Get Started

The Get Started is quite long, but it's easy.

1. Clone Repository and Install

The first thing to do is to clone the repository and install the packages

💡 Be sure to have Git and Node installed

git clone https://github.com/dfmihce/PERN-Docker-Boilerplate-Backend.git
cd PERN-Docker-Boilerplate-Backend
npm install

2. Setup the Database

The database could be created natively on your machine, or through a cloud platform such as Elephant SQL or locally through Docker.

Specifically, if it has been chosen the third way, there is a docker.compose.db.html in dockerServices/db. If you want to run the Database through this way, type the following commands from the root folder:

cd dockerServices/db
docker-compose -f docker-compose.db.yml up

3. Setup Environement Variables for Production and Development

In order to develop and deploy the Repository, it is needed to create ENV files with ENV Variables. To do so, create in the root folder (the folder in which there is the index.ts file ) 2 files: .env.developent and .env.production.

Write in the files the following environement variables.

#Server
CLUSTER=
PORT=
NODE_ENV=

#Secrets
ACCESS_TOKEN_SECRET=
REFRESH_TOKEN_SECRET=

#Access Token
ACCESS_TOKEN_EXPIRATION=

#Logs
LOG_FILE=
LOG_LEVEL=
LOG_DIRECTORY=

#Urls
ADMIN_FRONTEND_URL=
WEBAPP_FRONTEND_URL=
BACKEND_URL=

#Database
DB_USER=
DB_PASSWORD=
DB_NAME=
DB_HOST=

#Mail
MAILER_USER=
MAILER_PASSWORD=
MAILER_HOST=

#Firebase
FIREBASE_TYPE=
FIREBASE_PROJECT_ID=
FIREBASE_PRIVATE_KEY_ID=
FIREBASE_PRIVATE_KEY=
FIREBASE_CLIENT_EMAIL=
FIREBASE_CLIENT_ID=
FIREBASE_AUTH_URI=
FIREBASE_TOKEN_URI=
FIREBASE_AUTH_PROVIDER_X509_CERT_URL=
FIREBASE_CLIENT_X509_CERT_URL=
FIREBASE_DATABASE_URL=

#FACEBOOK LOGIN
FACEBOOK_CLIENT_ID=
FACEBOOK_CLIENT_SECRET=

#GOOGLE LOGIN
GOOGLE_CLIENT_ID=
GOOGLE_CLIENT_SECRET=

In the following part, it will be explained how to compile each variable.

Clustering and Environment

CLUSTER= needs to be set false if you don't want to use the cluster mode. true, if you want to use it.

PORT= refers to the port on which the express server will listen. If not set, the default port will be set to 8000

NODE_ENV= should be set production in .env.production, while should be set development in .env.development

Secrets for Authentication

ACCESS_TOKEN_SECRET= refers to the secret key for the access token of the authentication

REFRESH_TOKEN_SECRET= refers to the secret key for the refresh token of the authentication

ACCESS_TOKEN_EXPIRATION= is the amount of days set for the expiration fo the access token (i.e. 1, 2, 3)

Logs Settings

LOG_FILE= the name of the file to store the logs (i.e. logs.log)

LOG_LEVEL= the log level according to the Winston Package (i.e. error, warn, info, verbose, debug, silly)

LOG_DIRECTORY= the directory path to store the log file (it can be either relative to the main folder such as ./src/logs or absolute)

URL Settings

ADMIN_FRONTEND_URL= the url of the frontend of the admin side

WEBAPP_FRONTEND_URL= the url of the frontend of the app side

BACKEND_URL= the url of the backend

Database Settings

DB_USER= the database user that will be used to connect to the database DB_PASSWORD= the database password that will be used to connect to the database DB_NAME= the database name DB_HOST= the database host

Mail Settings

MAILER_USER= MAILER_PASSWORD= MAILER_HOST=

The settings of the mailer from your mail provider

Social Logins

FACEBOOK_CLIENT_ID= FACEBOOK_CLIENT_SECRET=

GOOGLE_CLIENT_ID= GOOGLE_CLIENT_SECRET=

These settings are received after the configuration of the Google and Facebook Login through Google Login and Facebook Login

4. Setup certificates for Development

In order to develop, certificates are needed and need to be stored in the server/keys folder. They need to have the following names: privatekey.pem, certificate.pem

It's suggested to create self signed certificated for development using these commands:

5. Configs

In ` Link 1 , While using the comments, add '-config <folder_Of_openssl.cnf> ' openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -days 365

Link 2

6. Deploy

It's possible to deploy the application using the following ways: with node, with docker or with PM2. in the package.json are defined the following commands:

"deployWithPM2": "env-cmd -f .env.production pm2 start ecosystem.config.js"

"deployWithNode": "env-cmd -f .env.production ts-node ./build/index.js"

"deployOnDocker": "env-cmd -f .env.production ts-node ./build/index.js"

prebuild and postbuild are used to run the commands before and after the build and are triggered automatically

7. Development

In order to develop, the .env.development file is needed. In order to set up a development database, create a container using the docker-compose.db.yml in the dockerServices folder. lastly, run the following command:

npm run dev

The localhost should be available at https://localhost:PORT where PORT is the port defined in the .env.development file.