Skip to content

Dockerized Ecommerce App using Node.js, TypeScript, RabbitMQ & JWT for Authentication/Authorization.

Notifications You must be signed in to change notification settings

CSTech95/ecommapp

Repository files navigation

ecommapp

To run this app You'll need:

  • Docker
  • Docker-Compose

Navigate to ./ecommapp directory and run docker-compose up --build composeup00

After running this command an exchange "ORDER_EXCHANGE" & Queue "shipping_queue" will automatically be created. You can view this with RabbitMQ management UI in the browser at http://localhost:15672/ order_exchange shippingqueue

Currently we have no users in the database and we're not logged in. Let's try to make an order while in this state. Screenshot 2023-08-29 at 2 07 57 AM Screenshot 2023-08-29 at 2 09 46 AM

We're not logged in therefore we're not authorized to create an order Screen Recording 2023-08-29 at 2 11 00 AM

The code to determine the current user is abstracted away in a custom made npm library. This allows for consistency when working within a team. Screenshot 2023-08-29 at 2 17 09 AM

Here's creating a user. You must provide email in a correct format. Once a user has been created, the password is hashed in case the database gets compromised. Then a cookie will be returned from server indicating this user is logged in. Screen Recording 2023-08-29 at 2 19 46 AM (1)

Once signed up, we're logged in with a cookie. This cookie indicates the current user logged in for all microservices. We can sign out and sign in with a new user. Whoever is logged in will be the current user across our microservices. (Using regular integers for id value for demonstrational purposes) Screen Recording 2023-08-29 at 2 31 11 AM (1)

Currently the "Order" & "Shipment" database are empty. Screen Recording 2023-08-29 at 2 46 34 AM (1)

We're currently logged in as Sally Mae & her userId is 4. She wants to order a Playstation 5 and a Mountain Bike. All she needs to do is pass in the list of products and the total fee will be calculated. (Entered totalFee of $5.99 in request body from an earlier test but it isn't needed. Total fee is calculated and returned in the response) Screen Recording 2023-08-29 at 2 58 04 AM (1)

The order is sent to RabbitMQ's ORDER_EXCHANGE. The ORDER_ECHANGE sends this order to all queues connected to it. The shipping_queue is connected to this exchange and recieves the order. The shipping_service saves this information to its database automatically and prepares shipment. image Screenshot 2023-08-29 at 3 21 22 AM

Now John Doe, who has a userId of 3, is going to sign in & then purchase a Nintendo Wii and a BMX Bike. Screen Recording 2023-08-29 at 3 27 41 AM (1)

Final Order Table order_table_final

Final Shipment Table Screenshot 2023-08-29 at 3 59 06 AM

PDF needs to be updated. Specifically on the database design & RabbitMQ Integration. Omitting Foreign Keys and SQL Joins. EcommerceApp.drawio.pdf

high-level-ecommapp-design

Releases

No releases published

Packages

No packages published