/node-server-template

This is Node.js server tidy template / boilerplate with Express (with asyncified handlers, custom error handler) framework and MongoDb. The server use ES6 and above. On different branches you can see different techniques' and technologies' usage, such as Kafka, nodemailer, file download... You also can find postman collections.

Primary LanguageJavaScriptMIT LicenseMIT

Node.js server template

Table of contents

General info

25.09.22. Updates. We create a new version of the template. It is already written in Typescript ! 12.03.21 Updates. Great news ! 🔥 ❤️
In this template every time we manually create 7 files for one CRUD logic. Now you can create your CRUD new files at once just using rest-resource-file-generator npm module made by me 🎩
Here is the link of instructions in npm rest-resource-file-generator
This is a simple Node.js server application boilerplate with CRUD operations simple logic. It provides REST APIs. Before using it, please ensure that you've already installed the following programs
Git as version control,
Node.js as server program,
Yarn as Node.js package manager,
MongoDb as database program.
If you haven't, these are their links for installing.

Technologies

Program/lib | version | command for checking
Git | 2.39.3 | git --version
Node.js | v20.8.0 | node -v
Express | ^4.19.2 | see in app package.json
MongoDB | v7.0.2 | mongosh (on MacOS)
Mongoose | ^8.2.4 | see in this app package.json
Mocha | ^10.4.0 | see in this app package.json
Eslint | ^8.57.0 | see in this app package.json
Yarn | 1.22.19 | yarn -v

Setup

  1. Clone this repository
    git clone https://github.com/Vladinho10/node-server-template.git
  2. Fill in your git credentials (if required)
  3. Enter the downloaded directory.
    cd node-server-template
  4. Create your .env files like .env file in envs directory.

for npm

  • install packages
    npm i
  • run server
    npm run start or
    npm start
  • if you want your server stay always running
    npm run nodemon

for yarn

  • install packages
    yarn
  • run server
    yarn run start or
    yarn start
  • if you want your server stay always running
    yarn run nodemon

Style guide

We suggest our ESLint configs which are inspired by AirBnB configs. We are open to any suggestions from contributors if they are inline with our philosophy.
These ESLint configs are written and tuned for modern JavaScript development. So we don’t support old, outdated JavaScript methods, e.g. obj = new Object() this construct because we can just use const obj = {};
more

Architecture guide

The software architecture (SA) is one of the most important parts of the software development. It helps developers to easily integrate into the existing codebase. The architecture describes a set of aspects and decisions of the software.
more app-architecture