A project based primarily on a TypeScript, JavaScript, NodeJS, Express, and MongoDB app with EJS templating view engine and Mongoose ODM. It uses JEST for testing along with aws-sdk-client-mock for AWS mocking in tests.
The goal is to create an app ecosystem for an organization selling computer hardware by actings as a full-fledged Inventory Management WebApp while also providing RESTful APIs for the Shopping Cart App.
The ecosystem consists of two apps:
-
Inventory App: Is an app that allows inventory mangement and order processing for the orders placed on the Shopping Cart App.- Provides RESTful APIs for the Shopping Cart App.
- Provides a CMS for managing Products and Promos shown on the Shopping Cart App.
-
Shopping App: Is a React App that allows users to purchase products and subscribe to offers.- Uses RESTful Apis provided by the
Inventory App.
- Uses RESTful Apis provided by the
The app ecosystem consists of two user roles:
Customers:They use the Shopping Cart App to place and managed orders.Employees: They use thisInventory Appto perform inventory and logistics operations, including processing orders received through theShopping Cart App.
The Inventory App part of the application (except the RESTful APIs provided for Shopping Cart App) makes use of the following technologies and packages:
NodeJS & Express: NodeJS and Express are used to create the server and APIs.EJS Template Engine: EJS Template rendering engine is used for the front-end of theInventory App.MongoDB Atlas & Mongoose ORM: MongoDB Atlas is the database of choice with Mongoose ORM being used for data modeling.Connect Mongo & Express Session Based Login: Employee authentication utilizes session-based login throughExpress SessionandConnect Mongopackages.JWT: Used to authenticate api users, Customers of the Shopping Cart App.Bcrypt Password Encryption: Bcrypt is used for encrypting the passwords.Express File Upload: Media files are uploaded using theExpress File Uploadpackage.Javascript & Typescript: Typescript is used for type safety with it being converted to Javascript build.Jest: Jest is the framework used for testing.AWS SDK Client Mock: To mock AWS services for testing.
The app is hosted on AWS EC2 and implements the following AWS cloud services:
SES V2: For sending transactional emails to users.Lamda: For generating thumbnails of images uploaded in S3 Bucket.SQS: For decoupling the services receiving and handling the orders placed by customers on the Shopping Cart app.S3 Buckets: For storing files and images as objects.SNS: For sending subscription emails to customers of the Shopping Cart app.
The Inventory App is deployed using the following technologies:
CI/CD Pipeline With GitHub: A CI/CD pipeline is created by leveraging GitHub actions to automatically deploy newly implemented features to the production environment.AWS EC2 Cloud Instance: The application is deployed on the cloud on an AWS EC2 instance running Linux OS.AWS CodeDeploy: AWS CodeDeploy is used to automate the deployment process. It usesAppSpecandLinux Shell Scriptsto deploy theInventory Appto the EC2 instance.AWS Parameter Store:AWS Parameter Storeis used to manage environment variables and secrets.Docker: This Inventory App is deployed as a Docker container on the EC2 instance.Nginx & Certbot: Used to enable SSL certificates with auto renewal.
In addition to the above, the app also uses the following AWS technologies:
VPC Gateway Endpoint - S3- To retrieve S3 objects while disabling public access to the S3 bucket.SSM Parameter Store: For storing env variables.CodeDeploy: To deploy the app via a GitHub Actions CD pipeline to deploy the app.STS: To allow GitHub to assume a role that enables deployment to AWS without using access keys.IAM: To create a programmatic role with the required permissions for the application.
Inventory App has two distinct functions:
-
Inventory Management:
Inventory Appis a full-fledged app that assists an organization in inventory management. The employees canRegisterandLogin, createCategoriesdescribing products, addProductsto categories, and manage customerOrders. -
RESTful APIs:
Inventory Appprovides RESTful APIs required by another app,Shopping Cart App, to function. TheCustomersof the business interact with Shopping Cart App, to place and manage orders.
ThePromosshown in theCarouselof theShopping Cart Appare uploaded and managed in theInventory App.
Similarly, theOrdersplaced by theCustomersin theShopping Cart Appare managed by theEmployeesin theInventory App.
The application is created to demonstrate the following coding abilities:
1. Build a full-stack app utilizing TypeScript, Node, Express, MongoDB Atlas / Mongoose, AWS cloud, and EJS templating engine.
2. Creating RESTfuls APIs for connecting to a single-page web app.
3. Utilizing a CI/CD pipeline for integration and deployment of new features automatically.
4. Usage of Docker containerization to build and deploy the application and persist data using Docker volumes.
5. Use of SSL certificates to provide an https server.
6. Exhibit familiarity with the AWS cloud platform, with the project showing deployment to an EC2 instance using AWS CodeDeploy via AppSpec and Linux shell scripts, and storing environment variables in the AWS Parameter Store, and permission management through IAM.
The webapp has the following functional objectives:
1. Allows a computer hardware retailer to manage product inventory, promotions, and orders.
2. Provide APIs to complement its customer-facing application, Shopping Cart.
Shopping Cart GitHub Repo Click Here for Shopping Cart GitHub Repo Page.
Shopping Cart WebApp Live Link Click Here for Shopping Cart WebApp Live Link.
You will be using the inventory app as an Employee of the organization, i.e., your user role with be that of an employee.
As an employee user, you will be able to perform the following actions:
-
Register as an
employee. -
Log in as an
employee. -
Perform CRUD operations related to a
Categoryfor products. -
Perform CRUD operations related to a
Productin a category. -
Perform CRUD operations related to
Orders. -
Perform CRUD operations related to
Promotionsthat are shown in theCarouselor other areas of the customer-facing Shopping Cart App.
To register as an employee, click on the Register link in the top navigation bar.
Password must contain at least one number and one uppercase and lowercase letter, and at least 5 or more characters
Using your actual email address is neither recommended nor required because no email registration link will be sent for account activation.
A success message will appear upon successful registration. In case of an error, take action according to the message.
You can use these demo credentials to log in instead of registering your own account:
email: `e@abc.com`
password: `Admin1`
To log in as an employee, use the credentials provided or the ones you used to register.
Upon successful login, you will be taken to the Employee Dashboard. It allows you to perform CRUD operations for the following:
Categories: Categories are required for segmenting products. Each product must belong to a particular category, e.g.,Monitors.Products: Products refer to any product to be sold by the organization. All products added through theInventory Appare then available for purchase via theShopping Cart App.Promos: Any promos shown on theShopping Cart App, likeCarousel Promosare also added and managed through theInventory App.Orders: Orders placed byCustomerson theShopping Cart Appare managed byEmployeesthrough theInventory App.
Click on the link according to the CRUD operation you want to perform.
Clicking on the Manage Categories link will open the Categories page. It will show:
- An
Add a New Categorylink to add a new category. - All existing categories with the links to
View,Edit, orDeleteeach of the categories.
- To create a new
Category, click on theAdd a New Categorylink. - Add the
Category NameandCategory Description. - Click on the
Create Categorybutton.
If category was create successfully, a success alert will show. If something goes wrong, the corresponding error may appear. If you click Back to All Categories link at the bottom, it will take you to the Categories page. The new category should now be visible here.
- To view a category, go to the
Categorypage. - Click on the corresponing
Viewbutton for the category. - The page for that particular category will open and show the details.
- Links to
EditandDeletethat category are also available on the page.
- Click on the
Editlink for aCategoryfrom theCategoriespage orView Categorypage. - Change the
Category NameandCategory Description. - Click on the
Update Categorybutton to update the details for the category. - Upon successful updation, you will be taken to the
Viewpage for the updated category.
- Click on the
Deletelink for aCategoryfrom theCategoriespage orView Categorypage. - You will be taken to the
Delete Categoryconfirmation page. Click on theDelete Categorybutton to delete the category. - After successful deletion, you will be taken back to the
Categoriespage.
Click on the Manage Products link from the employee Dashboard. It will open the All Products page. By default, it shows all Products with details in a list format.
To view Products belonging to a specific category, select the category from the dropdown list and click on the Get Products button. It will show products only from the specified category.
- Click on the
Productslink from the navigation menu to go to theManage Productspage. - To add a new product, click on the
Add a New Productbutton. It will lead you to theCreate Productpage. - Enter all product details, select a category, and upload an image.
- Click on the
Add Productbutton. A success message will show if the product is created successfully. - Click on the
Back to All Productslink on the bottom to return to theProductspage. The newly created product should be in the list. - This new product will also be added available on the Shopping Cart App. Click the link and visit the home page to confirm the same.
- Click on the
Productslink from the navigation menu to go to theManage Productspage. - Click on the respective
Viewbutton for the product whose details you want to view. - The
Product Detailspage for the product will open.
- Click on the
Productslink from the navigation menu to go to theManage Productspage. - Click on the respective
Editbutton for the product whose details you want to edit. - The
Edit Productpage will open for the respective product listing all the product details. - Change the product information as required.
- Click on the
Update Productbutton to update the product details.
- Click on the
Productslink from the navigation menu to go to theManage Productspage. - Click on the respective
Editbutton for the product whose image you want to edit. - Click on the
Change Image <Product Name>button on theEdit Productpage. - On the
Product Edit Imagepage, upload the new file and click on theUpdate Product Image. - The image will be updated.
- Click on the
Productslink from the navigation menu to go to theManage Productspage. - Click on the respective
Deletebutton for the product which to be deleted. - It will direct you to the
Delete Productpage. - To confirm product deletion, click on the
Delete <Product Name>button. - Upon successful product deletion, it will redirect to the
Manage Productspage.
This Inventory App allows Employees to manage the Promos visible in the carousel of the Shopping App. The following CRUD operations can be perfomed for the Promos.
- To add a new Promo, go to the
Promospage and click on theAdd a New Promopage. - Enter all the promo details, select a promo category, upload a file, and select promo status.
- Click on the
Add Promobutton. A success message will show if the promo is created successfully. In case of errors, take appropriate action. - Click on the
Back to All Promosbutton to return to thePromospage. The newly created Promo should be in the list. - If you go to the home page of the Shopping Cart App and the new Promo should be listed.
- To edit a Promo, go to the
Manage Promospage by clicking on thePromotab in the navigation. - From there, click on the respective
Editbutton for the promo you want to edit. It will open theEdit Detailspage for that promo. - Here, edit all the promo details as required.
- Finally, click on the
Update Promobutton to update the promo.
- To edit a Promo, go to the
Manage Promospage by clicking on thePromotab in the navigation. - From there, click on the respective
Editbutton for the promo you want to edit. It will open theEdit Detailspage for that promo. - On this page click on the
Change Image: <Promo Name>button. It will open theEdit Promo Imagepage. - Upload the new promo image and then click on
Update Promo Imagebutton. The promo image will be updated.
- To edit a Promo, go to the
Manage Promospage by clicking on thePromotab in the navigation. - From there, click on the respective
Deletebutton for the promo you want to delete. It will open theDelete Promopage for that promo. - Confirm deletion by click on the
Delete <Promo Name>button. - Upon successfully deletion, it will redirect to the
Manage Promospage.
This Inventory App allows Employees to manage the Orders placed by Customers on the Shopping App. They can change the Orders Status based on its fulfillment status(Processing, Ready for Shipping, Shipped, or Delivered).
- Click on the
Orderslink from the nav link to go to theManage Orderspage. - If required, filter the orders by selecting the Order Category from the dropdown list and click the
Get Ordersbutton to see the respective orders. - The page will show orders from the selected order category.
- Click on the
Orderslink from the nav link to go to theManage Orderspage. - If required, filter the orders by selecting the Order Category from the dropdown list and click the
Get Ordersbutton to see the respective orders. - Click on the
Manage Orderbutton for that order for the order to be updated. - From the
Select New Order Statusdropdown list, select the new order status and click on theUpdate Statusbutton. - The order status will be updated.
Inventory App also provides RESTful APIs for the customer-facing Shopping Cart App used by the same organization. In addition to being a standalone WebApp, it acts as a back-end for the Shopping Cart App.
The inventory app uses additional technologies and packages for its RESTful APIs.
The APIs provided by the app use JWT-based authentication for protected API routes. These routes are for the Shopping Inventory app.
The following routes are provided by the app:
The application provides the following public routes:
~/api/products GET route to fetch data of all products sold by the organization.
~/api/products/image/:productName GET route to fetch product image by product name.
~/api/products/image/thumbs/:productName GET route to fetch product image thumbnail by product name.
~/api/promos/carousel GET route to fetch all active carousel promos.
~/api/promos/image/:promoName GET route to get a promo image by promo name.
~/api/promos/image/thumbs/:promoName GET route to get a promo image thumbnail by promo name.
~/api/login POST route to login users of the Shopping App.
~/api/register POST route to register uses of the Shopping App.
The application provides the following protected routes:
~/api/orders: GET request to fetch all orders for the logged-in user.
~/api/orders/checkout: POST request to checkout the cart items for the logged-in user.
~/api/orders/cancel: POST request to cancel an order based on the order id provided in the request body.
~/api/subscribe: GET request to fetch the subscription status for the logged-in user.
~/api/subscribe: POST request to allow the logged-in user to subscribe for offers.
~/api/subscribe/cancel: POST request to allow the logged-in user to cancel subscription.
The following is the current test coverage report screenshot for the main branch.

