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 App
to 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 Session
andConnect Mongo
packages.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 Upload
package.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 usesAppSpec
andLinux Shell Scripts
to deploy theInventory App
to the EC2 instance.AWS Parameter Store
:AWS Parameter Store
is 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 App
is a full-fledged app that assists an organization in inventory management. The employees canRegister
andLogin
, createCategories
describing products, addProducts
to categories, and manage customerOrders
. -
RESTful APIs:
Inventory App
provides RESTful APIs required by another app,Shopping Cart App
, to function. TheCustomers
of the business interact with Shopping Cart App, to place and manage orders.
ThePromos
shown in theCarousel
of theShopping Cart App
are uploaded and managed in theInventory App
.
Similarly, theOrders
placed by theCustomers
in theShopping Cart App
are managed by theEmployees
in 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
Category
for products. -
Perform CRUD operations related to a
Product
in a category. -
Perform CRUD operations related to
Orders
. -
Perform CRUD operations related to
Promotions
that are shown in theCarousel
or 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: `[email protected]`
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 App
are then available for purchase via theShopping Cart App
.Promos
: Any promos shown on theShopping Cart App
, likeCarousel Promos
are also added and managed through theInventory App
.Orders
: Orders placed byCustomers
on theShopping Cart App
are managed byEmployees
through 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 Category
link to add a new category. - All existing categories with the links to
View
,Edit
, orDelete
each of the categories.
- To create a new
Category
, click on theAdd a New Category
link. - Add the
Category Name
andCategory Description
. - Click on the
Create Category
button.
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
Category
page. - Click on the corresponing
View
button for the category. - The page for that particular category will open and show the details.
- Links to
Edit
andDelete
that category are also available on the page.
- Click on the
Edit
link for aCategory
from theCategories
page orView Category
page. - Change the
Category Name
andCategory Description
. - Click on the
Update Category
button to update the details for the category. - Upon successful updation, you will be taken to the
View
page for the updated category.
- Click on the
Delete
link for aCategory
from theCategories
page orView Category
page. - You will be taken to the
Delete Category
confirmation page. Click on theDelete Category
button to delete the category. - After successful deletion, you will be taken back to the
Categories
page.
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
Products
link from the navigation menu to go to theManage Products
page. - To add a new product, click on the
Add a New Product
button. It will lead you to theCreate Product
page. - Enter all product details, select a category, and upload an image.
- Click on the
Add Product
button. A success message will show if the product is created successfully. - Click on the
Back to All Products
link on the bottom to return to theProducts
page. 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
Products
link from the navigation menu to go to theManage Products
page. - Click on the respective
View
button for the product whose details you want to view. - The
Product Details
page for the product will open.
- Click on the
Products
link from the navigation menu to go to theManage Products
page. - Click on the respective
Edit
button for the product whose details you want to edit. - The
Edit Product
page will open for the respective product listing all the product details. - Change the product information as required.
- Click on the
Update Product
button to update the product details.
- Click on the
Products
link from the navigation menu to go to theManage Products
page. - Click on the respective
Edit
button for the product whose image you want to edit. - Click on the
Change Image <Product Name>
button on theEdit Product
page. - On the
Product Edit Image
page, upload the new file and click on theUpdate Product Image
. - The image will be updated.
- Click on the
Products
link from the navigation menu to go to theManage Products
page. - Click on the respective
Delete
button for the product which to be deleted. - It will direct you to the
Delete Product
page. - To confirm product deletion, click on the
Delete <Product Name>
button. - Upon successful product deletion, it will redirect to the
Manage Products
page.
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
Promos
page and click on theAdd a New Promo
page. - Enter all the promo details, select a promo category, upload a file, and select promo status.
- Click on the
Add Promo
button. A success message will show if the promo is created successfully. In case of errors, take appropriate action. - Click on the
Back to All Promos
button to return to thePromos
page. 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 Promos
page by clicking on thePromo
tab in the navigation. - From there, click on the respective
Edit
button for the promo you want to edit. It will open theEdit Details
page for that promo. - Here, edit all the promo details as required.
- Finally, click on the
Update Promo
button to update the promo.
- To edit a Promo, go to the
Manage Promos
page by clicking on thePromo
tab in the navigation. - From there, click on the respective
Edit
button for the promo you want to edit. It will open theEdit Details
page for that promo. - On this page click on the
Change Image: <Promo Name>
button. It will open theEdit Promo Image
page. - Upload the new promo image and then click on
Update Promo Image
button. The promo image will be updated.
- To edit a Promo, go to the
Manage Promos
page by clicking on thePromo
tab in the navigation. - From there, click on the respective
Delete
button for the promo you want to delete. It will open theDelete Promo
page for that promo. - Confirm deletion by click on the
Delete <Promo Name>
button. - Upon successfully deletion, it will redirect to the
Manage Promos
page.
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
Orders
link from the nav link to go to theManage Orders
page. - If required, filter the orders by selecting the Order Category from the dropdown list and click the
Get Orders
button to see the respective orders. - The page will show orders from the selected order category.
- Click on the
Orders
link from the nav link to go to theManage Orders
page. - If required, filter the orders by selecting the Order Category from the dropdown list and click the
Get Orders
button to see the respective orders. - Click on the
Manage Order
button for that order for the order to be updated. - From the
Select New Order Status
dropdown list, select the new order status and click on theUpdate Status
button. - 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.