Code Monkey home page Code Monkey logo

wave-payroll-system's Introduction

Quick demo

demo-wave mov

Design wave-payroll-system

screen shot 2018-04-29 at 10 30 10 pm

Main components

There is a frontend application, a backend server, a daemon service (for writing data to database) and a mysql database instance.

A typical user workflow

#1. A user uploads a CSV through web UI which makes an POST /upload API call.

#2. POST /upload saves uploaded file to a configured upload directory and returns HTTP 201 status code with a jobId on success.

#3. The file uploaded in the upload directory gets automatically picked up by a deamon service (which continuously watches the upload directory) for processing. The deamon process parses the file and writes to the mysql database. On successful file processing, the file is removed from the upload directory. However, if the error occur either on parsing or writing, the file is moved to another directory called error directory.

#4. Web app polls GET /upload with jobId to get the status of the file processing. The status could be fail, success or in-progress.

#5. GET /upload endpoint returns in-progress when file (related to jobId) is found under upload directory, fail when file is found under error directory or success when file is present neither in upload directory nor in error directory.

#6. Once the file processing is done successfully, the payroll report table is automatically reloaded with new data by fetching the latest contents from GET /report.

Run & Build Instructions

Step 0: Install npm and node

First of all, make sure you have node and npm installed on your system. It can be installed by simply running following command on Mac terminal:

brew install node

To check whether you have got node and npm, run following commands:

node -v
npm -v

Refer. https://nodejs.org/en/download/package-manager/ for node installation instructions on other OS.

Step 1: Run frontend application

  1. Go to cd wave-payroll-frontend.

  2. Install all dependencies of frontend application first. Run npm i.

  3. Start application npm start.

  4. Open http://localhost:3000/ on your browser.

Step 2: Run backend API server

  1. Go to cd wave-payroll-backend.

  2. Install dependencies by running npm i.

  3. Update config.json and provide uploadDir and errorDir paths. (create two empty directory and update paths)

  4. Start server.

Either

npm start

Or

pm2 start app.js

It is recommended to use pm2 to make sure our server remain alive forever.

To install pm2, run npm install pm2 -g.

Step 3: Start daemon node service for processing uploaded files

  1. Go to cd wave-payroll-backend.

  2. Start service.

Either

node ./api/lib/save_to_db_deamon.js

Or

pm2 start ./api/lib/save_to_db_deamon.js

Note: The backend and daemon service combined logs can be viewed by running following command:

pm2 logs 

Step 4: MySql database instance

MySql database instance is already up and running on AWS. No need to do any special setup there.

That's it! Start playing. Go to http://localhost:3000/.

wave-payroll-system's People

Contributors

parminder7 avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.