Setting up the Development Environment for JCart

For our JCart application development we will be using the following Softwares/Tools.

  1.  JDK 8
  2. SpringSource Tool Suite (STS) 
  3. MySQL
  4. Git 
  5. Maven 
  6. Jenkins 
  7. SonarQube 
  8. Apache/Nginx WebServer


I am not going to explain how to install JDK or MySQL because there are plenty of articles you can find on internet.

If you are using Ubuntu based Linux Operating System then you can refer my article My Development Environment Setup on Linux to setup Java development tool chain.

JCart Release Planning

In our previous article JCart Requirements Analysis  we have listed out all the requirements that we need to implement for JCart application.  Now we need to come up with an implementation and release plan. As we are following iteration model, we will plan for N iterations where in each iteration we will implement some usecases.

After listing out all the implementation tasks and based on the task dependencies, we came up with the following Iteration plan.


  • Initial code setup for Admin webapp
  • Domain Modelling and Database Designing
  • Creating JPA Entities
  • Email Service SetUp
  • Admin UI Layout SetUp
  • Admin Login
  • Admin Forgot Password
  • Admin Reset Password
  • Configuring HTTPS/SSL/TLS
  • Setting up Jenkins/SonarQube


  • Security
    • Manage Privileges – List all privileges
    • Manage Roles
      • List all Roles
      • Create new Role
      • Add/Remove Permission to/from Role
    • Manage Users
      • List all Users
      • Create new User
      • Add/Remove Roles to/from User


  • Site Settings – Locale & Currency
  • Manage Categories
    • Create new Category
    • Update category
  • Manage Products
    • Create new Product
    • Update Product


  • Initial code setup for ShoppingCart webapp
  • ShoppingCart UI Layout setup
  • Configuring HTTPS/SSL/TLS
  • Home Page
  • Category Page
  • Product Page
  • Product Search Results


  • Add To Cart in HomePage/CategoryPage/ProductPage
  • Cart Page
    • View Cart Items
    • Updates Quantity
    • Remove Items


  • Mock PaymentService
  • Billing & Delivery Page
  • Customer Login
  • Customer Registration
  • Order Confirmation Page
  • Send Order Confirmation Email


  • Manage Orders
    • List all Orders
    • View Order details
    • Update Order status
  • Manage Customers
    • List all customers
    • Search customers
    • View customer details


  • Customer MyAccount Page
    • Profile
    • Order History

So, for now these are all the usecases we have identified and added to our iterations. We may come to know few more usecases going forward.
Looks like we are good to start the implementation. But before jumping on to coding let us take a look at our development environment setup in next article.

Selecting The Technology Stack for JCart

Selecting the right technology stack is very crucial and plays an important role in project success. Many of the architects (unknowingly??!!) try to make complex designs by trying to use all kinds of latest and greatest stuff. On the other hand some architects try to be in their comfort zone by limiting their technology stack to the technologies with which they are comfortable. Both approaches are dangerous. One should understand the business needs and pick the technologies that are necessary for project.

Java Platform: We will be using Java 8 for JCart so that we can leverage the good features introduced in Java8 like Streams, DateTime API etc.

Frameworks: This is where people go religious about their favourite frameworks. We should consider various factors while choosing the tech stack for any project.

  • Needs of the project requirements
  • Maturity and stability of the technologies
  • Team skills
  • Community/Commercial support

For JCart project we need:

  • Request-Response oriented MVC web framework for ShoppingCart site. I prefer stateless architecture for public facing web apps.
  • Component oriented MVC web framework for Administration site. I prefer UI Component Oriented framework for internal applications like Administration web apps.
  • Security framework supporting Role Based Access Control (RBAC)
  • A high-level Data Persistence framework
  • Other miscellaneous features like Emailing, Scheduling etc

In Java land, JavaEE and Spring are the most popular tech stacks for building applications. Both are very mature and have wonderful community support.

Spring provides:

  • Request-Response oriented SpringMVC web framework
  • Spring doesn’t provide any Component Oriented MVC framework. But we can integrate Spring with JSF or Vaadin which are Component Oriented Web MVC Frameworks
  • SpringSecurity provides RBAC security
  • Spring Data projects provides a very nice abstraction over various Data Access Technologies
  • Spring provides support for Emailing and Quartz Scheduler integrations as well.

JavaEE provides:

  • As of JavaEE7 there is no Request-Response Oriented framework provided by JavaEE. But in upcoming JavaEE8 version a new MVC framework will be released as JSR 371 . The reference implementation for MVC 1.0 is Ozark. You can find more details on it at
  • Component Oriented Web MVC framework JSF
  • IMHO, Security features provided by JavaEE 7 are not sufficient for many of the applications. But the good news is in the upcoming JavaEE8, JSR 375: Java EE Security API will be released.
  • JPA ORM framework which you can use with any of the popular implementations like Hibernate, EclipseLink etc. In addition to that you can use Apache DeltaSpike  modules to make things more easier.
  • JavaEE also provides support for Emailing and Scheduling features.

Coming to the Team skills, we are more hands-on with Spring technologies than pure JavaEE stack. We can work with both JavaEE and Spring, but we are more productive with Spring. If our team members are more hands-on with JavaEE we would have chosen JavaEE.

So, we are going to use Spring and some of its portfolio projects like Spring Security, Spring Data, Spring Boot etc.

Note: As I mentioned, a Component Oriented framework would be more suitable for JCart Administration web app, we will be using SpringMVC with Thymeleaf only. This is a compromise we are making considering the team skills and scope of the project.

Secret: Let me tell you a little secret. Come close. The reason I mentioned above for not using any Component Oriented Frameworks is not true. The actual reason is, after completing this application using Spring stack, I am planning to build the same app using pure JavaEE stack (CDI, EJB, JPA, JSF etc). There I am planning to use JSF/PrimeFaces for Administration web app. So we will be hands-on with both Thymeleaf and JSF/PrimeFaces 🙂

What are the tools we will be using?

  • Version Control System: We will be using Git VCS and host our code on Github.
  • Build Tool: I know Gradle is so hot these days but I am happy with Maven. We will be using Maven for our application.
  • IDE: As we are using Maven which is IDE agnostic we can use any of our favourite IDE. But our application is heavily depends on Spring technologies we will be using STS. Those of you Intellij IDEA fan boys can happily use Intellij IDEA 🙂
  • Server: Tomcat as embedded server.
  • Database: MySQL. But ideally we should be able to use our application with other databases like Postgres.
  • Tools: Jenkins for CI, SonarQube for code quality checking.
  • Production: While deploying our application in production we may want to use Apache or Ngnix as our load balancer and use monitoring tools like Zabbix. As I am not an expert in this area we will come back and spend some time to take a deep look at the options and pick the tools.

What about MicroServices, Docker and Cloud stuff?

As I said earlier, we are choosing the technologies based on our project needs. We are not Netflix, we are not LinkedIn and we are not building the NextAwesomeTechProductOnEarch. Our project needs are simple, our team size is small and we are not going to deploy our application on 128 containers on Cloud, so we are not going to use any fancy container technologies like Docker/Kubertness. If at all we got scalability problems where we may need to deploy our application on hundreds of servers, that’s a good to have problem.

Remember: Adding new software/framework/library to a project is easy..Removing is lot harder than you thing. So be careful while adding another software/framework/library.

JCart Requirements Analysis

For building our JCart e-commerce application we will develop two web applications, one for ShoppingCart and another one for Administration. Let us explore the requirements of both ShoppingCart and Administration websites in detail.

ShoppingCart Site Requirements

Home Page: This page shows list of categories and few products in each category. From this screen customers can click on any Category name to see all the products in that particular category or can add a product to cart.

Category Page: This page displays all the products in the selected category with pagination. Each product will be displayed along with a Add To Cart button.

Product Page: This page displays detailed information of the product along with one or more images of the product and shows Add To Cart button.

Search Results Page: In the header section we will provide a search box where customers can search for products. The search results will be displayed with pagination. Each product will be displayed along with a Add To Cart button.

Login/Registration Pages: Customers should be able to login/register with our system so that they can view their profile and order history.

Cart: In header section there will be Cart Icon showing the no. of items currently added to cart. When Cart icon is clicked we need to show the cart page with all the Items details. Customers should be able to update product quantities or remove products and the cart totals should be updated automatically.

Billing & Delivery Page: This page will be displayed once the customer clicked Checkout button in Cart page. If the customer is already registered with our system he should login otherwise a registration form will be displayed. Customer should register by providing Email and Password. After successfully login, customer should provide Delivery Address, Payment details like CreditCard number, CVV, Expiry Date etc.

Order Confirmation: Once the customer provided all the valid details and clicked on Submit button an Order should be placed and should display the Order Confirmation page with details including the Products, Delivery Address etc. An order confirmation email should be sent to customer with estimated delivery time.

My Account Page: Customer should be able to login into the system and see his profile details, order history, outstanding order details.

Administration Site Requirements

Security: We should provide Roles and Permission based security for our Administration website.
Privilege Management: Ability to configure and manage all the privileges within the system. Each privilege represent the ability to perform an action.
For ex: MANAGE_CATEGORIES represents the ability to create new Categories, update existing categories.

Role Management: Ability to create various roles with one or more assigned privileges.
For ex:
     ROLE_SUPER_ADMIN – Users with this role can do anything within the system.
     ROLE_ADMIN – Users with this role can create other users (except other SUPER_ADMIN or ADMIN), and can do Category Management, Product Management etc.
     ROLE_CMS_ADMIN: Users with this role can manage Categories, Products etc.

Category Management: A category represent a logical grouping of related products.
Category management includes:

  • Create new categories
  • Update existing categories
  • Disable/enable categories

Product Management: In our system product is a quilling toy.
Product management includes

  • Create new products
  • Update existing products
  • Delete products

Order Management: Authorised users can see the list of order, update status or cancel orders.
If an order is cancelled then refund should be triggered and a cancellation email should be sent to customer.

Customer Management: Admin users should be able to view the customer details like their addresses, email ids etc for contacting them.

  • List all the customers
  • Search customers by email or name
  • View customer profile
  • Customer order history

Site Settings: We need to have some site level configurations like Currency and Locale.
Locale & Currency: We should be able to use different locale and currencies for our e-commerce system. So the implementation should consider the I18N and dynamic currency change using live currency converter or using some conversion ratio.

By looking at the above mentioned features you might be thinking these are all very basic features of any e-commerce system and lot of features like Promotions/Offers Management, Fulfilment Systems, Inventory management etc are not being considered. YES, you are right. We are not considering many aspects of a typical e-commerce system because WE DON’T NEED THEM FOR OUR APPLICATION.

As I mentioned in the project requirement, we are enabling customers to place orders through online and the items will be delivered manually by the person who makes those quilling toys and the administrator will mark that order as fulfilled. If our application become famous and we are being flooded with orders then we can think of automating these manual tasks as well. As simple as that :-).

Introducing the application JCart

As I promised in my article Developing a simple e-commerce application from scratch to production using SpringBoot, I am starting first post by introducing the application JCart that we are going to build.

One of my friend makes quilling toys and she sell them by advertising on Facebook or through word of mouth. Now she is getting more and more customers and she wants to expand her business by going online. So, she asked me to help in setting up a simple e-commerce website. After having some conversations on whether to leverage any existing e-commerce platforms or building a new application, we decided to build a new one with the features we just needed for our need.

ATTENTION: There are so many well established open source e-commerce platforms such as BroadleafCommerce, OpenCart, Drupal Commerce etc. But these systems provide so many features that you may probably don’t need and hence looks a bit overwhelming. But think twice before building your own. Don’t Repeat Yourself.

For those of you who are not familiar with what Quilling Art is, have a loot at the following pictures. These toys are made of some kind of colour paper and other stuff.

quilling (6)quilling (14)quilling (4)

quilling (5)quilling (2)quilling (1)

Note: These sample images are downloaded from internet and all rights belongs to their respective owners.

High Level Requirements

After having a brief discussion with our client, following are the high level requirements:

  1. A public facing Shopping Cart website with features:
    • Customers can browse through products by category or by searching
    • Customers can place orders using CreditCard or Cash On Delivery
    • Customers can login and view order history
    • Customers will receive confirmation emails when order is placed or order status changed
  2. An Administration website which has the following features:
    • Ability to manage Categories and Products
    • Ability to create one or more users for Administration website
    • Ability to restrict access to certain features based on roles
    • Ability to view customer orders and update the status
  3. A mobile (Android/iOS) application for ShoppinngCart
    • Not an immediate requirement, but in future we may need it.


Overview of System Architecture


These are very high-level requirements and design only. In our next post we will go through all these requirement in detail.