A simple boilerplate from Node.js web applications.
This project focuses on a showcasing a usable Continuous Integration / Continuous Deployment (CI-CD) process. This boilerplate is not opinionated as for the type of application, thus express was ommitted.
The project borrowed from and is heavily inspired from the following sources:
- Egghead.io - How to Write an Open Source JavaScript Library
- KunalKapadia/express-mongoose-es6-rest-api
- sahat/hackathon-starter
- awslabs/eb-node-express-sample
- Pre-commit hooks to ensure 100% test pass rate
- Coverage tests to ensure 100% code coverage by tests
- Fully working CI/CD process using Circle CI web service
- Deployment to AWS Elastic Beanstalk service
Yarn: a fast, reliable, and secure dependency management
Mocha: a feature-rich JavaScript test framework Chai: a BDD / TDD assertion library Istanbul: a JavaScript test coverage tool ESLint: a pluggable linting utility
Codecov: a code coverage service Circle CI: a continuous integration and delivery platform AWS Elastic Beanstalk: an easy-to-use service for deploying and scaling web applications and services
The easiest way to get started is to clone the repository:
Get the latest snapshot:
git clone https://github.com/tomers/node-devops-boilerplate.git myproject
# Change directory
cd myproject
Install yarn:
npm install -g yarn
Install dependencies:
yarn
Create a new GitHub project and commit your code to it.
Create a Codecov project
Simply enter the Codecov website and follow instructions. It should be rather straightforward.
After you have created your GitHub project, sign-up to Circle CI, then create a new project. Add the following environment variables in the project settings console:
- AWS_ACCESS_KEY_ID (how to get)
- AWS_SECRET_ACCESS_KEY
- CODECOV_TOKEN (how to get)
Follow instructions here.
Commit any code change to your repository and push the changes back to Github. Verify the build is monitored by Circle CI.
This project includes a yarn.lock
file by default and as project dependencies are updated, this file will be updated to reflect those changes.
To upgrade your local dependencies using Yarn, simply run yarn upgrade
. This will update all dependencies to their latest version based on the version range specified in the package.json
file. The yarn.lock file will be recreated as well.
For further information, please see the official documention for managing dependencies and upgrading dependencies. This Yarn vs NPM article by SitePoint also has some very useful information.