/powerzone-inventory

An inventory, transaction, and delivery management system for Powerzone, a fuel company in Bicol, Philippines

Primary LanguageHTML

Powerzone Inventory

badge badge badge badge badge badge badge badge
badge badge badge badge

Actions Status badge

This project is a software solution for Powerzone Inventory, a fuel company based in Catanduanes, Bicol. This web application seeks to serve as an all-in-one management system for tracking the three major components handled by Powerzone: inventory, transactions, and deliveries. The inventory management system in the application will log all products that come in and out the inventory of the company. This includes both the purchasing of products from suppliers and the selling of products through transactions.

This is the major course output in an advanced software engineering class:

💡 UPDATE (12/27/2022): With the shutting down of free Heroku services, we have migrated to Railway: https://powerzone-inventory.up.railway.app/

Project Structure

The project consists of the following folders:

Folder Description
.github Contains the YML file for the continuous integration/continuous delivery (CI/CD) pipeline and the template for issues
controllers Contains the JavaScript files that define callback functions for client-side requests
helpers Contains the JavaScript files that define helper functions for server-side validation
misc Contains the JavaScript files for initial database population
models Contains the JavaScript files for database modeling (schemas) and access
public Contains the static CSS and JavaScript files, as well as the project assets (image files), for front-end display
routes Contains the JavaScript file that defines the server response to each HTTP method request
test Contains the JavaScript files that define the unit tests
views Contains the Handlebars template files to be rendered and displayed upon request

It also includes the following files:

File Description
.eslintrc.json Specifies the environment and rules for configuring the linter (ESLint)
package-lock.json and package.json Store information on the project dependencies
index.js Entry point of the web application
Procfile Specifies the commands run by the application's dynos on Heroku

Running the Application

Running on the Web

Open the following website: https://powerzone-inventory.up.railway.app/

Running Locally

  1. Before running the application locally, the following software have to be installed:

    Software Description License
    Node.js JavaScript runtime built on Chrome's V8 JavaScript engine MIT License
    git (optional) Distributed version control system GNU General Public License v2.0

    Download Node.js v12.16.3 to ensure compatibility with dependencies.

  2. Create a copy of this repository:

    • If git is installed, type the following command on the terminal:

      git clone https://github.com/STSWENG-T1-AY2122-AWS-CodeBuild/powerzone-inventory
      
    • If git is not installed, click the green Code button near the top right of the repository and choose Download ZIP. Once the zipped folder has been downloaded, extract its contents.

  3. On the main project directory, run the following command to install the dependencies:

    npm install
    

    If the command is executed successfully, the dependencies will be installed into the folder node_modules following the dependency tree found in package-lock.json.

The project uses a pre-populated remote database. DO STEP 4 ONLY AFTER A DATABASE RESET OR FOR TESTING PURPOSES.

  1. Run the following commands to populate the database with the necessary collections:

    node misc/populate-account.js
    node misc/populate-delivery.js
    node misc/populate-inventory.js
    node misc/populate-price.js
    node misc/populate-transaction.js
    node misc/populate-transaction-number.js
    
  2. Run the following command to run the server:

    node index.js
    
  3. Open the web application by accessing the following link on a browser:

    http://localhost:3000
    
    Homepage

Credentials (For Testing Only)

To log in as an administrator, enter the following credentials:

  • Username: powerzoneadmin
  • Email Address: administrator@gmail.com
  • Password: password123

Dependencies

This project uses the following production dependencies:

Package Version Description License
@babel/eslint-parser 7.16.5 Package for allowing the linting of all valid Babel code with ESLint Apache License 2.0
bcrypt 5.0.1 Package for hashing passwords Apache License 2.0
connect-mongo 3.2.0 MongoDB session store for Connect and Express MIT License
dotenv 10.0.0 Package for loading environment variables from an .env file BSD 2-Clause "Simplified" License
express 4.17.1 Unopinionated and minimalist framework for Node.js MIT License
express-handlebars 6.0.1 Handlebars view engine for Express BSD 3-Clause "New" or "Revised" License
express-session 1.17.2 Session middleware for Express MIT License
express-validator 6.13.0 Express middleware for validator, a library of string validators and sanitizers MIT License
gridfs-stream 1.1.1 Package for streaming files to and from MongoDB GridFS MIT License
hbs 4.2.0 Express view engine for Handlebars MIT License
jquery 3.6.0 Fast, small, and feature-rich JavaScript library MIT License
mongodb 4.2.0 Official MongoDB driver for Node.js Apache License 2.0
mongoose 6.0.13 MongoDB object modeling tool designed to work in an asynchronous environment MIT License
multer 1.4.3 Middleware for handling multipart/form-data, primarily used for file uploads MIT License
multer-gridfs-storage 5.0.2 GridFS storage engine for Multer to store uploaded files directly to MongoDB MIT License
nocache 3.0.1 Middleware for setting some HTTP response headers to try to disable client-side caching MIT License
nodemailer 6.7.1 Package for sending emails with Node.js MIT License

The following table lists the development dependencies:

Package Version Description License
chai 4.3.4 Behavior- and test-driven development assertion library for Node.js MIT License
chai-jquery 2.1.0 Extension to the chai assertion library that provides a set of jQuery-specific assertions MIT License
deep-equal-in-any-order 1.1.15 Chai plugin to match objects and arrays deep equality with arrays (including nested ones) being in any order MIT License
eslint 8.6.0 Tool for identifying and reporting on patterns found in ECMAScript/JavaScript code MIT License
eslint-config-google 0.14.0 ESLint shareable config for the Google JavaScript style guide (ES2015+ version) Apache License 2.0
esm 3.2.25 Babel-less, bundle-less ECMAScript module loader MIT License
jsdom 18.1.1 Pure-JavaScript implementation of many web standards, notably the WHATWG DOM and HTML Standards, for use with Node.js MIT License
mocha 9.1.3 Simple and flexible JavaScript test framework for Node.js and the browser MIT License
mocha-jsdom 2.0.0 Test framework for frontend libraries in the console using Node.js, Mocha, and JSDom MIT License
mochawesome 7.0.1 Custom reporter for use with Mocha for generating an HTML/CSS report to help visualize test runs MIT License
nyc 15.1.0 Istanbul's state of the art command line interface with support for applications that spawn subprocesses ISC License
sinon 12.0.1 Standalone and test framework agnostic JavaScript test spies, stubs, and mocks BSD-3-Clause License

The descriptions are taken from their respective websites.

GitHub's dependabot alerts are also enabled to check for vulnerable dependencies automatically.

Built Using

This project follows the Model-View-Controller (MVC) architectural pattern. In light of separation of concerns, the key technologies used are:

  • Database: MongoDB as the database program and Mongoose as the object data modeling tool
  • Back-end: Node.js as the server environment and Express.js as the back-end framework
  • Front-end: Handlebars as the template engine and Bootstrap as the primary CSS framework

To implement continuous integration and continuous delivery (CI/CD), the following technologies are also included:

  • Unit Testing: Mocha as the primary test framework, Chai as the assertion library, Sinon as the test framework for spies, stubs, and mocks, and Istanbul as the code coverage tool
  • Task Runner: GitHub Actions as the CI/CD platform
  • Automation Testing: Selenium as the automation testing tool and Robot Framework as the automation framework

ESLint is used for linting and enforcing uniform and consistent coding style.

GitGuardian has been added to the CI/CD pipeline to protect against the leakage of secrets (e.g., database connection URLs).

This web application is deployed on Heroku, a cloud platform as a service (PaaS).

💡 UPDATE (12/27/2022): With the shutting down of free Heroku services, we have migrated to Railway, another cloud PaaS.

Contributing

Kindly refer to this page for the documents and guidelines on contributing to this repository.

Software Development Team

  • Sandra Angela E. Berjamin, Analyst
  • Lander Peter E. Cua, Analyst
  • Jacob Bryan B. Gaba, Quality Assurance
  • Mark Edward M. Gonzales, Developer
  • Hylene Jules G. Lee, Developer
  • Angeli Dianne F. Mata, Designer
  • Phoebe Clare L. Ong, Designer
  • Ian Angelo T. Racoma, Quality Assurance