This repository uses node.js and it's ecosystem.
System prerequisites:
- Docker
- Docker Compose
To run the development server
- cd to
payroll-backend
directory - Run the command
cp .env.dev .env
- Run the command
docker-compose -f docker-compose.dev.yml up --build
- Stop the docker-compose now(This is required only for first time and not in subsequent running, an interesting problem)
- Run the previous command again
docker-compose -f docker-compose.dev.yml up --build
The server will be running on 4242
port on localhost
.
Note: Run the frontend from frontend repo
- It is easy to work individually but hard to collborate in teams if specific guidelines are not agreed upon.
- The application has been build from the perspective of working in team by following coding standards, easy development and deployment of code.
- Node.js (Server)
- MongoDB (Database)
- Mocha & Chai (Testing)
- Docker & Docker Compose (Development/Deployment)
- Code is modular, usable and with separation of concern.
- There are two models WorkLog and JobGroupRate.
- Worklog stores the uploaded data for archival reason and generating payroll report
- JobGroupRate stores pay per hour rate as per job group. It could have been constants but rates can be modified and added on the fly. This perspective will be huge plus.
- All models have required fields for proper validation.
- ESLint is configured and followed very strictly via Airbnb's ESLint with few modifications
- Testing is important, each API has atleast one test in
test
folder, tests can be run vianpm run test
- API docs can be found
gh-pages
branch or generated vianpm run apidoc:generate
. These docs will be used for frontend's API integration and other peers. - Similarly common utility has their own doc in
out
folder ingh-pages
branch and can be generated vianpm run jsdoc:generate
.
- Logging is essential for debugging especially in production, catching the errors earlier, easier it is to fix them and debug.
- Error handling is extensive throughout the code.
- Error reporting is done via Sentry.
- Docker compose configures database and app automatically, no hassle of managing different services.
- Deployment and development has been separated by individual environment, docker and docker compose files.
- Each dev, test, production has own environment and databases.
- Appropriate message have been provided for each API to frontend.
- Proper API validation is done on each request
It is important to setup automation, coding standards and have strong foundation early on since more and more people are going to contribute to code base. This will immensely help in reducing/avoiding technical debt.
As always feedback and suggestions are heartly welcomed.
- Following guidelines from the discussion with Ashok
- Other open source projects