Design a B2C E-commerce web application with API integration

October 29, 2017, updated October 31, 2017 | 900 – 1000 words | +/- 4 mn

Today I am going to describe how I designed and implemented an e-commerce web site. May I invite you to make yourself comfortable and grab your drink and/or food of choice? Ready? Let’s get working.

Table of contents

  1. Context
  2. Method of work
  3. The project
  4. Database design
  5. EAV model
  6. Detailed analysis of a use case
  7. The application’s architecture
  8. Deliverable
  9. Improvements
  10. Conclusion
  11. Some useful links

Context

I have designed an e-commerce B2C web site for a small company. I took on the role of an analyst – programmer to deliver the product.

The web application has two parts, a front-office and a back-office. In the front-office, customers can consult, search and buy items from a product catalog. The back-office is the e-commerce’s management area.

Method of work

To complete the project, I have employed the following method:

Overview of the Software development cycle

Figure 1: Overview of the Software development cycle

Project

The e-commerce web application provides two interfaces, a front-office and a back-office.

The front-office allow customers to consult the product catalog and to perform searches. They can place an order, check out using secured online payments and track their shipments. They can also print invoices and review items.

The back-office allow administrators to manage the product catalog and provide customer service. Each administrator has permissions such as the right to list, to create or to update a resource.

Database design

It was not easy to design a database schema supporting a flexible data structure. The data structure should scale as I added more products categories.

The problem I am trying to solve

Figure 2: The problem I am trying to solve

I found several alternatives to the chosen solution. If I didn’t have to stick with a relational database, I would have chosen a NoSQL database. It provides a more flexible data structure than a relational database. I also considered using a PostgreSQL database along with its JSONB functionality. Binary JSON (JSONB) allows you to save JSON as a record’s field. You can then query it as it was a regular relational database field.

EAV model

The chosen solution is the Entity – Attribute – Value model. It is a key – value pattern used in various fields such as scientific research and e-commerce platforms such as Magento and Drupal. That is because it provides the ability to work with disparate data structures.

The EAV model

Figure 3: The EAV model

In spite of that, I had to weight the advantages and the disadvantages of the model nonetheless.

Pros:

Cons:

Detailed analysis of a use case

I choose to describe the “Place an order” use case in this detailed analysis. It consists of a description, and of three UML diagrams: use case, activity and sequence.

The table 1 describes the use case. I only assumed the best case scenario and in doing so I left aside the handling of exceptions. An example of an exception would be an item out-of-stock.

Use case name : Place an order
Description : The customer order the basket's content.
Actors : A customer
Prerequisites :
  • The customer has an account
  • The customer signed in
Main process :
  • The customer displays the basket and begin the check out process
  • The customer reviews personal informations including the shipping address
  • The customer selects a shipping rate
  • The customer selects a payment method
  • The customer reviews and confirm the order
  • The customer makes the payment
Postconditions :
  • The basket is empty
  • The order saved and it is now accessible in the orders history
  • The customer can print the invoice
Table 1: "Place an order" Use case description

"Place an order" Use case diagram

Figure 4: "Place an order" Use case diagram

"Place an order" Activity diagram

Figure 5: "Place an order" Activity diagram

"Place an order" Sequence diagram

Figure 6: "Place an order" Sequence diagram

The application’s architecture

The B2C e-commerce web application has a client – server architecture. A user send requests to the web server, which implements the MVC model. The web server interact with the database and consumes web services.

Application's architecture

Figure 7: The application's architecture

I have used Shippo for the shipments and Stripe for the online payments. These web services help me bring an enriching experience to my customers.

I choose Stripe because it allows me to deliver an e-commerce web site that follow the PCI DSS standard. PCI DSS helps organizations meet the security standards for manipulating credit cards data.

Deliverable

A B2C e-commerce web application that offers a front and a back user interfaces. It provides the abilities to sale and manage a product catalog.

Improvements

Conclusion

To carry out this project has been a worthwhile experience. I enjoyed applying solutions to the problems encountered. The most interesting part has been to quit my comfort zone to find a solution, the EAV model, to an unknown problem.

Did you learn something new as I did? Tell me what you think in the comment section below.

Thank you for you time.