[3.3] Leaderboards, Loyalty System and Product Reviews - FEUP-MEIC-DS-2025-26/madeinportugal.store GitHub Wiki

Leaderboards, Loyalty System and Product Reviews

Three main services will be developed: A product Leaderboard page, a Loyalty System and a product Reviews System.

Vision

  • Recognize top products through a dynamic leaderboard and awards - A competitive, transparent leaderboard showcasing the highest-rated products based on user reviews. The top-ranked product is awarded, motivating brands to excel and helping users quickly identify the best options.
  • Engage customers through a gamified loyalty experience - A dynamic, gamified loyalty ecosystem that rewards users for reviewing, interacting, and engaging—turning participation into a fun, motivating, and rewarding journey.
  • Enable users to transparently review and share product experiences - A robust review system where users can easily evaluate products, share authentic feedback, and help build a trustworthy community-driven knowledge base.

Authors

Repository

See more in the dedicated repositories:

Key Features

  • Review products with rating and comments.
  • A Leaderboard for each product category.
  • Awards for the products on the top of the leaderboards.
  • Gain points when buying products.
  • Buy products with points.

Description

The customer can review a product, giving it a rating (0 to 5). In a review, the customer can optionally comment their experience with the product so that other potential buyers can make a more informed decision.

Each product category has a leaderboard where the products will be ranked. Only the products with a relevant number of orders can be placed in the leaderboard. This ranking is based on the product rating. This allows the buyers to easily know the best products.

At the end of the year, products will be awarded based on their performance in the leaderboard. There will be an award for the best ranked product, for the most sold product and for the revelation of the year (the product that grew the most in rank).

With each purchase, customers earn points based on the amount spent. These points are stored in their profile and can later be redeemed to purchase other products. When placing a new order, customers can convert their accumulated points into a monetary discount, allowing them to pay partially or entirely with points. This gamified reward system encourages repeat purchases and increases customer engagement.

Demonstration

Leaderboards

See the leaderboard page: https://frontend.madeinportugal.store/leaderboard

Leaderboard Demo

Loyalty System

See the Loyalty System Page: https://frontend.madeinportugal.store/loyalty

Loyalty Demo

Product Reviews

See the reviews section in the product page: https://frontend.madeinportugal.store/product/32863784

Or see the dedicated reviews page: https://frontend.madeinportugal.store/reviews

Product Reviews Demo

Technologies

  • PostGreSQL Database
  • Backend with Express.js
  • Frontend with React
  • Docker
  • Google Cloud Run
  • Google Cloud SQL
  • Terraform
  • GitHub Actions
  • Google Cloud Pub/Sub

Architectural Design

C4 Diagrams

Leaderboards

Leaderboard C4 Diagram

Loyalty System

Loyalty C4 Diagram

Product Reviews

Reviews C4 Diagram

Architecture Description

Each microservice mentioned here has the following components:

  • A PostGreSQL Database running in Google Cloud SQL.
  • A Backend Docker container running on a Google Cloud Run.
  • A Frontend Docker container running on a Google Cloud Run.

To ensure easy deployment, we rely on GitHub Actions to build and push the Docker images and Terraform run the containers in the respective cloud services.

Database

A Google Cloud SQL instace holds a PostGreSQL database for each service which is accessed my the backend with a username and a password.

Backend API

The backend listens to http API requests from the frontend and sends the responses in JSON format.

This API has the following endpoints:

  • /api/reviews to get all product reviews in the store and to create new reviews.
  • /api/reviews/:id to all reviews from a product by its product id.
  • /api/checkout to buy products using loyalty points.
  • /api/leaderboards to get product leaderboards.

The backend service fetches data directly with the Jumpseller API at https://api.jumpseller.com.

All the data needed by other Made In Portugal microservices is posted in dedicated Google Cloud Pub/Sub topics.

Frontend

The frontendserves React components that are exported with Module federation and imported in the MIPS host microfrontend. When it is needed to fetch data from the backend, a Gateway that proxies the requests is used (see https://github.com/FEUP-MEIC-DS-2025-26/MIPS-Gateway)

Design Decisions

The frontend, backend, and database are separated into distinct, managed services to ensure a scalable, cost-effective, and maintainable system. This modular approach allows each component to be developed, updated, and scaled independently.

The backend, built with Express.js, and the frontend, built with React, are deployed as separate containers on Google Cloud Run. This serverless platform provides easy and affordable deployment by automatically scaling our stateless services. The use of React' Module Federation allows this frontend to be easily integrated into the frontends of other services.

Since Cloud Run is stateless, the PostgreSQL database is hosted on Google Cloud SQL, a fully managed service that guarantees data persistence, security, and high availability.

To streamline this entire process, we use Terraform to automatically provision and configure all the necessary Google Cloud services. Furthermore, GitHub Actions automates the process of building and pushing the Docker images to the Google Artifact Registry, enabling fast deployments.

Sprint Retrospectives

In order to learn from every sprint and turn our constructive feedback into actionable steps for growth, we document and track our sprint retrospectives here.