1.2.3 • Published 2 months ago

eco-rewards-hub v1.2.3

Weekly downloads
3
License
GPL-3.0
Repository
github
Last release
2 months ago

Eco Rewards Hub

Travis codecov David

API to ingest and process passenger travel transactions and calculate eco rewards.

Installation

Node +12 and a MySQL compatible database are required. The Ubuntu set up is:

sudo apt-get install -y nodejs mariadb-server
# warning this will blank your root mysql password
sudo mysql -u root mysql -e "update user set authentication_string=password(''), plugin='mysql_native_password' where user='root'; flush privileges;"

Installing and running the service:

git clone git@github.com:EcoRewards/eco-rewards-hub.git
npm install --save eco-rewards-hub
npm run migrate
npm start

Running with pm2:

pm2 start ecosystem.config.js

CLI commands

There are some CLI commands to help get set up:

npm run cli -- create-scheme [name]
npm run cli -- create-organisation [name] [schemeId]
npm run cli -- create-group [name] [organisationId]
npm run cli -- create-user [name] [email] [password] [role]
npm run cli -- export-all-members

Functional requirements

The scope of the API is defined by a number of user stories in cucumber format.

See features.

Non-functional requirements

  • Swagger documentation
  • Secure API access
  • Continuous integration with automated tests

Decision log

DateDecisionReasoning
2019-11-01Implement with node.jsDevelopers familiar with it, fast iteration speed
2019-11-01Use a MySQL compatible databaseDevelopers familiar with it, widely used
2019-11-01Use AWSIt's convenient and widely used
2019-11-18Do not use dockerUnnecessary for a project this size
2019-11-18Make the code open-sourceNo need for private repository, cheaper tooling (Travis et al)
2019-11-18Use travis CIIt's free
2019-11-18Use cucumber to capture functional requirementsTrack the evolution of requirements and use as a basis for functional tests
2019-11-18Use use KoaWidely used and supports promises
2019-11-18Use db-migrateMost widely used database migration tool
2019-11-18Do not use an ORMSeems like overkill when there are so few models
2019-11-18Bcrypt passwordsMost secure, widely used method to salt passwords
2019-11-19Basic auth for API accessSimple, widely used and easy to implement
2019-11-21Swagger documentationComes with a slick UI and package to validate requests and responses
2019-11-21Link based API responsesReduces duplication in API responses. See this post
2019-11-27Travis deploymentSimple, easy, as seen here
2019-11-27PM2 process managementMakes the travis deployment easier

License

This software is licensed under GNU GPLv3.