lego

🧱 Bricked Up: Predictability of a LEGO Set Deal

πŸš€ Project Overview

Bricked Up is a full-stack web app that aggregates and analyzes LEGO deals 🧩 scraped from public sources. Users can browse deals, filter and sort listings, save favorites, and gain insights with interactive price indicators.

🌐 Live Demo: Visit Bricked Up


πŸ’‘ Why This Project?

Bricked Up solves the challenge of finding the best LEGO deals in a user-friendly, responsive, and automated way. By leveraging scraping, APIs, and automation, it ensures LEGO enthusiasts never miss out on a great deal. 🧱✨


✨ Features

  • πŸ›’ View Deals: Browse through aggregated LEGO offers.
  • πŸ“Š Relevance Score:
    • Each deal is scored based on its popularity, discount, freshness, and resalability metrics.
    • Relevance helps users prioritize the best deals.
  • πŸ” Interactive Filters:
    • πŸ† Best Discount
    • πŸ”₯ Hot Deals
    • πŸ“ˆ Popular Deals
    • Relevance-based sorting
  • πŸ“Š Deal Insights:
    • Average and percentile price indicators.
    • Expiration countdown for time-sensitive offers.
  • ❀️ Save Favorites: Mark and revisit your favorite deals.
  • πŸŒ— Dark Mode: Toggle between light and dark themes.
  • πŸ”„ Automated Refresh: Deals update daily at 5 AM and 6 PM UTC+2.
  • πŸ“± Responsive Design: Works seamlessly on all devices, with optimized modals and layouts.
  • πŸ› οΈ How It Works Accordion: Guides users on searching, sorting, and understanding the scores.

πŸ› οΈ Technologies Used

  • Frontend: HTML, CSS (Bootstrap 5) 🎨, JavaScript ⚑
  • Backend: Node.js with Express.js πŸš€
  • Database: MongoDB Atlas πŸ—„οΈ
  • Web Scraping: Puppeteer πŸ•·οΈ, Cheerio 🌿
  • Deployment: Vercel πŸ› οΈ
  • Automation: GitHub Actions πŸ•’

πŸ“Έ Screenshots

Home Page
A clean, interactive homepage for LEGO enthusiasts.

Dark Mode
Dark Mode
Seamless switch to dark mode.

Deal Insights
Deal Insights
Key price insights with visual indicators.


πŸ“– Understanding the Relevance Score

The Relevance Score is a calculated metric that helps users identify the best deals. It evaluates:

  • Discount: The percentage off the original price.
  • Popularity: Based on the number of comments and likes.
  • Freshness: How recently the deal was published.
  • Resalability: Resale potential based on average resale prices and listing activity.
  • Temperature: A deal’s popularity among community users.
  • Expiry: Whether the deal is expiring soon. The score ranges from 0% (low relevance) to 100% (high relevance).

πŸ“Š Relevance Score Explained

The Relevance Score is a metric (ranging from 0 to 1) used to rank LEGO deals based on their value and appeal. It evaluates multiple factors with assigned weights to provide a comprehensive score.

Relevance Score Formula

$$ \text{Relevance Score} = W_d \cdot S_d + W_p \cdot S_p + W_f \cdot S_f + W_e \cdot S_e + W_h \cdot S_h + W_r \cdot S_r $$

Where:

  • $W$: Weight assigned to each factor
  • $S$: Scaled score of each factor
  • Subscripts:
    • $d$: Discount
    • $p$: Popularity
    • $f$: Freshness
    • $e$: Expiry
    • $h$: Heat
    • $r$: Resalability

Factors Breakdown

  • Discount Score ($S_d$): Percentage discount ( $S_d = \min(\frac{\text{Discount}}{100}, 1)$ ).
  • Popularity Score ($S_p$): Community engagement ( $S_p = \min(\frac{\text{Comments}}{\text{MAX COMMENTS}}, 1)$ ).
  • Freshness Score ($S_f$): Time since publication ( $S_f = \max(1 – \frac{\text{Days}}{\text{MAX AGE DAYS}}, 0)$ ).
  • Expiry Score ($S_e$): Penalizes deals expiring soon ( $S_e = 0.5$ if expiring soon, $S_e = 1$ otherwise).
  • Heat Score ($S_h$): Based on temperature ( $S_h = \min(\frac{\text{Temperature}}{\text{MAX TEMPERATURE}}, 1)$ ).
  • Resalability Score ($S_r$): Combines:
    • Profitability: ( $\max(\frac{\text{Resale Price} – \text{Price}}{\text{Price}}, 0)$ ),
    • Demand: ( $\min(\frac{\text{Resale Listings}}{\text{MAX LISTINGS}}, 1)$ ),
    • Velocity: ( $\min(\frac{\text{Weekly Resales}}{\text{MAX WEEKLY SALES}}, 1)$ ).

Weight Distribution

  • Discount: 20%
  • Popularity: 20%
  • Freshness: 15%
  • Expiry: 5%
  • Heat: 10%
  • Resalability: 30%
    • Profitability: 50%
    • Demand: 30%
    • Velocity: 20%

The Relevance Score provides a quick, data-driven insight into the best LEGO deals available.


βš™οΈ How It Works

  1. Data Collection: πŸ•·οΈ Deals are scraped from public sources like Dealabs and Vinted.
  2. Backend API: πŸ“‘ Data is stored in MongoDB Atlas and served through an Express.js API.
  3. Scheduled Updates: ⏰ GitHub Actions refresh the data automatically twice a day.
  4. Client Rendering: 🌟 The deals are displayed interactively with filtering, sorting, and responsive design.

🌐 Live Updates: Automation

The data refreshes automatically:
⏰ Daily at 5 AM and 6 PM UTC+2
Using GitHub Actions to ensure users always get the latest deals.


πŸ—‚οΈ Project Structure

bricked-up/
β”œβ”€β”€ client/
β”‚   └── v2/
β”‚       β”œβ”€β”€ index.html       # Main client HTML file
β”‚       β”œβ”€β”€ styles.css       # Custom CSS styles
β”‚       β”œβ”€β”€ portfolio.js     # Client-side logic
β”‚       β”œβ”€β”€ assets/          # Images and other assets
β”‚       └── utils.js         # Utility functions
β”‚
β”œβ”€β”€ server/
β”‚   β”œβ”€β”€ api.js               # Main server file (Express routes)
β”‚   β”œβ”€β”€ refresh_database.js  # Script to refresh MongoDB
β”‚   β”œβ”€β”€ dealabs.js           # Scraping script for Dealabs
β”‚   β”œβ”€β”€ vinted.js            # Scraping script for Vinted
β”‚   └── node_modules/        # Installed dependencies
β”‚
β”œβ”€β”€ .github/
β”‚   └── workflows/
β”‚       └── database-refresh.yml  # GitHub Actions for scheduled scraping
β”‚
β”œβ”€β”€ vercel.json              # Vercel deployment configuration
β”œβ”€β”€ package.json             # Dependencies for server and client
└── README.md                # Project documentation

πŸ‘‘ Acknowledgments

  • Public data sources: Dealabs and Vinted
  • Frameworks & Tools: Bootstrap, Puppeteer, Node.js, MongoDB
  • Icons: Flaticon

πŸ“¬ Contact

Developed by: Joyce Lapilus
Project Repository: GitHub

For inquiries, feel free to contact via joyce.lapilus@gmail.com.


⚠️ Disclaimer

This website aggregates publicly available data for educational and informational purposes only.
πŸ”’ No malicious intent is associated with data scraping. For any concerns, feel free to contact me.


πŸŽ‰ Thank you for visiting Bricked Up! 🧱✨

Visit original content creator repository

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *