Skip to main content
Creation of an online sales website

Creation of an online sales website

Project Overview
#

This project was completed at the end of the third semester of my computer science studies. The goal was to apply our knowledge of web development and databases. To do this, we had to create a nearly fully functional mock e-commerce website. Our main constraint was that the backend had to be written in PHP, using a framework of our choice. The theme we selected was luxury jewelry sales. The project lasted one month, alongside other projects, and we were a team of five developing the site.

Technical Challenges
#

The MVC Architecture
#

One of the key aspects of this project was the requirement to adhere to the MVC (Model, View, Controller) architecture. However, Laravel, unlike other frameworks such as Symfony, offers a very flexible approach to MVC architecture.

The first issue is that there are no proper entities; everything is managed by the ORM, which creates a dependency between how data is stored and business entities. The second issue is that with Laravel, business logic and SQL queries via the ORM tend to be implemented directly in the controllers. These two problems mean that the architecture no longer conforms to the MVC vision, and the code becomes less maintainable and scalable.

To address this issue, I enforced a strict implementation of the MVC architecture in our project. The first step was to create entities completely separate from the data storage logic. Then, I provided repositories that use the ORM to instantiate the entities. Finally, I created services that act as an interface between the repositories and the controllers; they also handle logic related to sessions or cookies. With this implementation, the business logic is completely decoupled from the database and controllers.

Unfortunately, the project was already too advanced when we decided to refactor it. In hindsight, we can question the choice of Laravel from the start. We had chosen it for its modernity and integration with frontend frameworks, but Symfony might have been a better solution.

Using Vue.js with Laravel
#

This project focused on using PHP and the Laravel framework. However, to simplify the frontend part, which was substantial, and to improve the user experience with a reactive interface, we chose to add a JavaScript framework: Vue.js.

The integration of Vue.js with Laravel is very straightforward thanks to the use of Inertia. With this tool, we don’t need to create an API for the frontend to fetch data. Instead of Laravel rendering the page on the server side with the data, it uses Inertia to trigger Vue.js rendering on the client side, providing it with the necessary data.

Using these two frameworks allows us to have a dynamic and reactive client-side site while maintaining Laravel’s efficiency for the backend.

Database Management
#

The project also required a significant amount of time for data management, which was extensive (products, comments, accounts, orders, etc.). This was an opportunity for us to discover migration and seeder systems, which proved very useful throughout the project.

We were also tasked with implementing more advanced features, such as triggers. These allowed us to handle complex cases and maintain consistent data at all times, particularly by managing numerous error cases. Finally, we also used stored procedures to simplify certain operations.

Results
#

In conclusion, we successfully completed this project and delivered a fairly polished version of the website. The site includes the following features:

  • Login and registration.
  • Management of personal information (addresses, favorites, orders).
  • Product catalog browsing.
  • Shopping cart management.
  • The entire order process.
Website Screenshot

The project’s source code is available on this GitLab repository: