Logo

Express-Boilerplate

PRs Welcome

A boilerplate/template for building RestAPI's using NodeJS, TypeScript, Express and Mongoose

Installation

Clone the Repo

- Clone the project https://github.com/kyooowe/ecommerce-portal.git
- Open terminal

Install the dependencies

  npm i
  or
  yarn install

Setup .env

  Create .env file in root folder and Add the following
  PORT=yourChoicePort
  TOKEN_KEY=yourChoiceTokenKey
  MONGO_DB=yourMongoDbConnection

Documentation

Framework and Libraries

Features

  • NoSQL database using MongoDB
  • JWT Authentication
  • Password encryption using Bcrypt
  • Cron Job
  • Testing: automated testing using Jest
  • Dependency management with NPM
  • Environment variables using cross-env and dotenv
  • CORS
  • Git hooks using hustky and lint-staged
  • Linting using prettier, eslint and tslint
  • Compression using GZIP
  • Middleware HTTP Protection using Helmet
  • Email sender using NodeMailer

Folder Structure

- Src
    - Config        (project configurations)
    - Controller    (project controllers/services)
    - Helpers       (project custom helpers)
    - Inteface      (global interface in project)
    - Middleware    (projects custom middleware)
    - Models        (mongoose schemas)
    - Routes        (projects routes)

Steps for creating API

- Create your own interface in inteface (Folder)
- Create schemas in models (Folder)
- Add your services in controller (Folder)

Commands

Run local

npm run start

Test

npm run test

Linting

npm run lint

Demo

Incoming

Roadmap

  • Socket.io
  • Logger

Authors