Giter Site home page Giter Site logo

talesofthislife / node-boilerplate Goto Github PK

View Code? Open in Web Editor NEW

This project forked from santoshshinde2012/node-boilerplate

0.0 0.0 0.0 13.54 MB

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

Home Page: https://blog.santoshshinde.com/skeleton-for-node-js-apps-written-in-typescript-444fa1695b30

License: Apache License 2.0

Shell 0.41% JavaScript 1.06% TypeScript 97.01% Dockerfile 1.52%

node-boilerplate's Introduction

Skeleton for Node.js applications written in TypeScript

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
  • Integrated eslint, prettier and husky
  • Global Error & Response Handler
  • Simple and Standard scaffolding
  • Based on Typescript Syntax
  • Simple & Global Enviroment Configuration
  • Request/Response Encryption & Decryption Implementation
  • Easily Add new feature
  • Integrated winston Logger
  • Production Ready Skeleton
  • Follwed Production Ready Best Practices: Security
  • Added only used npm modules
  • Swagger Documentation Support
  • Unit & Integration Test Cases

Core NPM Module

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

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

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/*
  • 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


Please connect with me on Twitter @shindesan2012 & https://blog.santoshshinde.com

node-boilerplate's People

Contributors

santoshshinde2012 avatar dependabot[bot] avatar mohammadhh avatar zhiephie avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.