Skip to content

mosabami/simpleecom

Repository files navigation

Simple Ecom

A simple ecommerce application for a levelup training.

Loginpage

Loggedinpage

This application was developed for the LevelUp workshow that can be found in the AKS Landing Zone Accelerator's AKS & NoSQL CosmosDB Multiregion scenario.

Application Architecture

Below is a diagram of the application's architecture when testing it locally. Application architecture when testing locally.

Auth Service

This service is responsible for authenticating user and managing the Users collection, which also includes the cart in the database.

Carts Service

This service is responsible for adding and removing products from the cart and managing the cart within the Users collection

Products Service

This service is responsible for managing product catalog and inventory.

Frontend Service

This is responsible for rendering the front end of the application on a web browser.

Nginx

This is an nginx container that acts as a router and loadbalancer. It is able to perform path based routing. For more information about its configuration, check out its config file

Prerequisites

  1. Azure subscription
  2. Docker installation
  3. Basic knowledge of containers
  4. Basic knowledge of Microservices
  5. Basic knowledge of frontend and backend development

Getting Started

  1. Make sure you have docker engine running on your machine
  2. Create a Cosmos DB instance on your Azure subscription that allows public network access
  3. Head over to Settings -> Keys within your Cosmos DB instance Clone the repo
  4. Copy the connection string there
  5. Open the src\docker-compose.yml file
  6. For each of the following services, create a new environment variable called COSMOSDBOPTIONS__CONNECTION_STRING and paste that connection string as its value:
    • products
    • carts
    • orders
    • auth
  7. CD to the src folder and enter the command docker-compose up

This will create the requried containers including an nginx loadbalancer that route traffic to the different services based on the url path. Those 4 services mentioned above would connect to Cosmos DB.

Accessing the app on the Browser

  1. Go on your browser and nagivate to http://localhost:3050/prepdata/send_data. This endpoint will automatically populate your cosmosdb with the required products data. It might timeout but that doesnt mean the products were not uploaded.
  2. Access the frontend servie on your browser by nagivating to http://localhost:3050
  3. Click on registration page to create a new user. Then head back to login page to login (this is super insecure and only requires an email address to login. This was made simply for demo purposes only).
  4. Test out the app:
    • Open console on your browser to see messages (optional)
    • Add products to your cart
    • Remove products from your cart
    • Click on a product's brand name to navigate to list of products from that brand
    • Click on product name to see the product's detail
    • Delete the product from your catalog if you dont like it :)
    • Click on the Cart link on the nav bar to see your cart
    • Click on Place order to send the request to the orders service and create an order

API Doc

To access the back end services' API docs with swagger, hit the following endpoints on your browser with the containers running via docker-compose. You will see the various endpoints you can hit to get data from the database and examples to get said data.

Deploying your app on Azure Kubernetes Service

Follow the instructions at the AKS & NoSQL CosmosDB Multiregion scenario to deploy the application to AKS.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published