This is a pure nodeJS solution to solution to generate and communicate payslip for every employee. While this is an automated cron job that has been scheduled once a month on the first day of the month at 00.00, this UI is for demonstration purpose to trigger the payslip generation and sending of emails. A live environment for this app can be accessed at Payslip Generator
- AWS Free Tier Limit
- MailTrap Free Tier Limit (<500 total emails to be sent and throttled email per second)
Name | Purpose |
---|---|
csv-parse | parser to convert CSV text input into arrays or objects. |
email-templates | send custom email templates for nodeJS |
express | nodeJS web application framework |
lodash | web development facilitator with ootb utility functions |
moment | JS date library for date utility functions |
node-cron | task scheduler |
nodemailer | facilitates email sending |
html-to-text | generates text content from html for nodemailer emails |
optimist | parse CLI arguments |
pug | template engine for nodeJS |
serverless-http | deploy nodeJS code to cloud infrastructure |
stream-transform | object transformation for stream data |
-
Open terminal and clone this project :
git clone https://github.com/kebearry/jnj_payroll.git
-
Change directory to this project directory in terminal :
npm install
This will install dependencies, including node_modules.
-
Run the project :
Through https://5rd9wixb27.execute-api.ap-southeast-1.amazonaws.com/dev
or through invoking through Command Line Interface:node app.js --input sample.csv --output output.csv
The second method will modify the output.csv in root folder
- AWS CloudFormation template is created from serverless.yml
- If a Stack has not yet been created, then it is created with no resources except for an S3 Bucket, which will store zip files of the function code
- The code of the function(s) is then packaged into zip files.
- Serverless fetches the hashes for all files of the previous deployment (if any) and compares them against the hashes of the local files
- Serverless terminates the deployment process if all file hashes are the sam
- Zip files of functions' code are uploaded to S3 Bucket.
- The CloudFormation Stack is updated with the new CloudFormation template
- Each deployment publishes a new version for each function in your service
- Handler defines what function to execute upon lambda invocation
- This serverless approach has created a lambda function with respective api gateways and cloudwatch logging mechanism