Javascript NodeJs ExpressJs MongoDb Boilerplate

This is a server side repository created using Express Js to reduce the initial server side project configuration and get things started fast. Use this repository as boilerplate for your application.

Info

  1. Langauge :- Javascript
  2. Envirnoment :- Node Js
  3. Framework :- Express Js ( https://expressjs.com/ )
  4. Manual API Testing :- Swagger ( https://swagger.io/ )
  5. Email Integration: Nodemailer ( https://www.npmjs.com/package/nodemailer )

Envirnoment Setup

  1. Install eslint package in your IDE or Text Editor
  2. Install edirtorconfig package in your IDE or Text Editor
  3. add .env file in your project after clonning the project and follow the instruction provided in env.example.txt

Folder Structure and Explaination

.
├── server
|   ├── config
|   |   ├── index.js
|   |   └── swagger.js
|   ├── middleware
|   |   ├── auth.js
|   |   └── morgon.js
|   ├── models
|   |   ├── administrator
|   |   |   └── user.js
|   |   ├── authetication
|   |   |   └── session.js
|   |   └── index.js
|   ├── routes
|   |   ├── api
|   |   |   ├── administrator
|   |   |   |   └── example.js
|   |   |   └── authetication
|   |   |       └── auth.js
|   |   └── index.js
|   ├── utils
|   |   ├── email.js
|   |   └── error.js
|   └── index.js
├── .editorconfig
├── .gitignore
├── env.example.txt
├── LICENCE
├── pakage-lock.json
├── package.json
└── README

Project Explaination

./Server:- this folder contails all the APIs, Database Models, utils Functions and config information

./Server/middleware:- this folder contails middleware currently there are two middlewares provided one of them is for authorization and another is for morgon required logger

./server/config:- this folder contails configuration info about modules, server or any other info you want to put

./server/models:- this folder contails schema of modules (user, session ,etc) you can seperate them using different folder like I did you just have to create files in folder all the importing of those file is done in index.js so don't worry about importion any files

./server/routes:- this folder contails APIs I have created some sample APIs to get you started and to tell you how to add API you just add the files in repective folder you can create new folders if you like dont worry about importing any files all the importing is handled in index,js file just follow the basic structure.Also remember to Write Swagger comments as provided in auth.js file also add this file path to swagger config file in config folder

./server/utils:- This folder will contain all the third party integration functions or functions you used frequently currently it has email.js in which i have provided a normal usage of mail using nodemailer you can add another email configuration if you want. For email purpose i used nodemailer ( https://www.npmjs.com/package/nodemailer )

./server/index.js:- this file is entry point for application everythinsg is integrated here

./.editorconfig:- this file contails editor config you have to add editorconfig module to your IDE to use this.

./.gitignore:- I hope I don't have to decribe the useof this file.

./env.example.com:- instructions are provided in this file.

./LICENCE:- don't worry about this file just don't remove it.

./package-lock.json:- this file generated by npm do not remove this file and commit this file every thiswhen you add an new packages to this project

./package.json:- this is most important file of this project this file contains project info , eslint confi info (if you want to change any rules you can change them in this file), nodemon config, dependncies and devdependan and lots of other info

./README.md:- You are currently reading this file