Giter VIP home page Giter VIP logo

darshitvvora / node-api-boilerplate Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 1.0 1.45 MB

NodeJS Rest API - Express | Sequelize ORM(Postgres) | WinstonLogger ElasticSearchLogging | Security Hardened

Home Page: https://darshitvvora.github.io/node-api-boilerplate/

License: MIT License

JavaScript 15.71% HTML 75.67% CSS 8.39% Dockerfile 0.23%
nodejs rest sequelize-orm postgres elastic security-hardened node-restful buddy jsdoc elasticsearch

node-api-boilerplate's Introduction

NodeJS REST API BoilerPlate

Node API Boilerplate can be used to start a new NodeJS PostgresSQL based backend REST API project. This is best suitable for small microservices as well as large scale monolith API

Technologies Used

Pre Requisite

  • Install NodeJS. Recommended to use NVM
  • Install PostgresSQL for Backend DB
  • Install ElasticSearch (ELK) for Logging. The recommended way to do is using docker. Follow these steps for installing on local

Installation

Use the node package manager npm to install a boilerplate.

git clone [email protected]:darshitvvora/node-api-boilerplate.git
# Create .env and add config
cp sample.env .env
npm i
npm run migrate
npm start

Usage

  • Add resource and corresponding rest API using below steps
    • To create API, you will have to focus only on src/api folder
    • Make sure to use REST resource structure standards and add standard API
    • Add route in index.js of resource folder
    • Add model and properties as per backend table structure in .model.js and .properties.js (Use sample user resource for reference)
    • Add migration if its a new folder. Migration will use .properties.js file
    • Use the .controller.js to call logical function
    • Add pure logical function code in .service.js
    • Add fanout service in .hookshot.js file
    • Add common function model-specific function as class methods in .model.js
  • Use the below steps to commit and push the code to your repo
    • Stage the files to be committed
      git add .
  • Commit file, fix any errors reported, and add a proper commit message. Use .gitmessage file for commit message guidelines
      git commit
  • Push file and create PR
      git push

Roadmap

  • Folder structure
  • Express configuration
  • Postgres integration
  • Sequelize ORM integration
  • Sequelize Migration integration
  • Helmet and other security middleware integration
  • Code Quality and sanity workflow integration (editorconfig, eslint, prettier, husky, commitizen, buddy.js)
  • ELK logger component integration
  • Unit Testing integration (Chai + Mocha)
  • JSDoc integration
  • Docker integration

Coding Guidelines

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to write proper commit message and test before raising a PR

References

License

MIT

node-api-boilerplate's People

Contributors

darshitvvora avatar dependabot[bot] avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Forkers

yatishbalaji

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.