Santoshshinde2012 Node Boilerplate Save

Node Typescript Boilerplate for Microservices. Skeleton for Node.js Apps written in TypeScript (with Setup Instructions for ESLint, Prettier, and Husky)

Project README

Node-Typescript-Boilerplate Quality Gate StatusGithub action workflow statusCodeQL Analysisnjsscan Analysis

Skeleton for Node.js applications written in TypeScript

Introductions

Purpose

Our main purpose with this Skeleton is to start server application with node js and typescript.

Try it!! I am happy to hear your feedback or any kind of new features.

Common Features

  • Quick start

    • Simple and Standard scaffolding
    • Based on Typescript Syntax
    • Simple & Global Enviroment Configuration
    • Global Error & Response Handler
    • Easily Add new feature
    • Request/Response Encryption & Decryption Implementation
  • Contiuous Integration

    • Added Github Action Workflow
  • Documentation Standards

    • Swagger Documentation Support
    • Postman Collections
    • Readme with instructions
  • Test Coverage Maintenance

    • Integrated eslint, prettier and husky
    • Added Unit Test cases and Intgration Test Cases
    • 80% + Code Coverage
  • Prodcution Ready Setup

    • Follwed Production Ready Best Practices: Security
    • Integrated winston Logger
    • Added only used npm modules

Core NPM Module

  • express, @types/express
  • @types/node
  • typescript
  • dotenv
  • cors
  • helmet
  • http-status-codes
  • winston

Start the application

Workflow

Start The application in Development Mode

  • Clone the Application git clone https://github.com/santoshshinde2012/node-boilerplate.git
  • Install the dependencies npm install
  • Start the application npm run dev

Start The application in Production Mode

  • Install the dependencies npm install
  • Create the build npm run build
  • Start the application npm run start
  • Before starting make sure to update your .env values for your refrence just check .env.example

Project Structure

Name Description
wiki/ You can add project documentation and insructions file here
src/ Source files
src/abstractions Abstarct classes and Interfaces
src/components REST API Components & Controllers
src/lib Reusable utilises and library source code like a logger
src/middleware/ Express Middlewares like error handler feature
build/ Compiled source files will be placed here
tests/ Test cases will be placed here
tests/helpers/ Helpers for test cases will be placed here
tests/unit-tests/ Unit Test cases will be placed here
tests/integration-tests/ API routes (Integration) Test cases will be placed here

Workflow

Workflow

Encryption

Set the APPLY_ENCRYPTION environment variable to true to enable encryption.

Swagger API Documentation

The swagger documentation is available at the following url ${host}/docs:

http://localhost:8080/docs

Default System Health Status API

  • ${host}/api/system/info - Return the system information in response
  • ${host}/system/time - Return the current time in response
  • ${host}/system/usage - Return the process and system memory usage in response
  • ${host}/system/process - Return the process details in response
  • ${host}/system/error - Return the error generated object in response

Swagger API Documentation

Postman Collections

Refrences

Notes

1. Why is my git pre-commit hook not executable by default?

  • Because files are not executable by default; they must be set to be executable.
chmod ug+x .husky/*
chmod ug+x .git/hooks/*

2. Production Best Practices: Security

  • Don’t use deprecated or vulnerable versions of Express
  • Use TLS
  • Use Helmet
  • Use cookies securely
  • Prevent brute-force attacks against authorization
  • Ensure your dependencies are secure
  • Avoid other known vulnerabilities
  • Additional considerations

3. Tutorials


Connect with me on

Open Source Agenda is not affiliated with "Santoshshinde2012 Node Boilerplate" Project. README Source: santoshshinde2012/node-boilerplate

Open Source Agenda Badge

Open Source Agenda Rating