Simple Node.js Boilerplate for simple Node.js Applications. Inspired by Kunal Kapadia's express-mongoose-es6-rest-api.
A boilerplate for building applications in Node.js using ES6 with Code Coverage. Follows Airbnb's Javascript Style Guide.
Feature |
---|
ES6 using Babel |
Run tests using Mocha |
Code linting using ESLint |
Automatic syntax formatting using prettier |
Auto-restart server using nodemon |
Logging using debug |
HTTP access control using cors |
API parameter validation using express-validation |
Code coverage using istanbul |
HTTP status code and message http-status |
Consistent commit syntax using commitizen and AngularJS's commit message convention |
Precommit hook by running the linter and code coverage tool |
Authentication using Passport.js and JSON Web Tokens |
Password hashing using bcryptjs |
Object Data Modeling (ODM) using mongoose |
Clone the repository and name it as you like.
git clone https://github.com/septa97/node-boilerplate.git <your-project-name>
cd your-project-name/
rm -rf .git/ && git init
git remote add origin https://github.com/<USERNAME>/<REPOSITORY>.git
npm run --silent create
cp .env.example .env
rm README.md
mv README.sample.md README.md
npm install
Then fill up the prompt for modifying the package.json.
You must delete the .git folder and re-initialize it using git init
.
You must also create a new README.md. Open the new README.md then modify it depending on your project.
The above code installs the dependencies, creates an environment file, and modifies the package.json file.
To start developing with code linter,
npm run dev
To safely follow the standards of a commit,
npm run cm
then follow the instructions.
To run tests,
npm run test