Node Pg Sequelize Boilerplate

screenshot of Node Pg Sequelize Boilerplate
express

Node.js Express Sequelize Boilerplate with PostgreSQL Integration and Comprehensive Unit/Integration Test Setup

Overview

The Node-Express-Sequelize-API Boilerplate is a simple boilerplate codebase designed to create APIs using Node.js Express framework and Sequelize with a PostgreSQL database. The boilerplate includes features like error handling middlewares, tests with coverage using mocha, ESDoc for documentation, and more.

Features

  • ES6 import/export with type "module"
  • Error handling middlewares
  • Tests setup with mocha configuration
  • Code coverage using c8
  • Eslint for linting
  • Winston logger for logging

Prerequisite

Install nodemon globally using the command:

npm install -g nodemon

Install PostgreSQL as the database.

Getting Started

Clone the repository:

git clone [repository-url]

Local Setup

  1. Enter the cloned folder.
  2. Install dependencies.
  3. Create a file called .env and copy the contents from .env.example to .env.
  4. Run the application locally.

Tests & Coverage

  • Run unit/integration tests.
  • Run tests with coverage.

Migrations

  • Running and undoing migrations.

Environment Variables

| Variable | Description | Default Value | | -------- | ---------------------- | ------------- | | DB_HOST | Database connection host | localhost | | DB_PORT | Database port | 5432 | | DB_NAME | Database name | postgres | | DB_USER | Database username | postgres | | DB_PASS | Database password | postgres |

Summary

The Node-Express-Sequelize-API Boilerplate is a comprehensive tool for building APIs using Node.js, Express, and Sequelize with a PostgreSQL database. From setting up the environment, handling migrations, running tests, to documenting the codebase, this boilerplate provides a structured foundation for API development. It encourages contributions and welcomes feedback to enhance the project further.

express
Express

Express.js is a simple Node.js framework for single, multi-page, and hybrid web applications.

fullstack
Fullstack

A fullstack boilerplate provides a starter application that includes both frontend and backend. It should include database, auth, payments, user roles and other backend services to build a fully featured saas or webapps.

eslint
Eslint

ESLint is a linter for JavaScript that analyzes code to detect and report on potential problems and errors, as well as enforce consistent code style and best practices, helping developers to write cleaner, more maintainable code.