How parthpatel2000/expedia_price_tracker_extension works
Project Type and Purpose
• This is a full-stack Chrome extension (“Expedia Price Tracker”) that automates hotel price scraping on Expedia, persists history in Firebase, provides both an in-extension popup UI and a web-based React dashboard, and sends daily email notifications via Firebase Cloud Functions.
File Structure Analysis
• Top-Level
• .env.*, firebase.json, .firebaserc, manifest.json, webpack.config.js, tailwind.config.js
• functions/ (Node.js Cloud Functions)
• src/
– background/ (service-worker logic: scraping, scheduling, messaging)
– popup/ (React-based popup UI)
– dashboard/ (React dashboard & analytics)
– lib/ (shared Firebase helper modules)
• Build Config
• webpack.config.js / Babel / PostCSS / TailwindCSS
• CI/CD
• .github/workflows/webpack.yml
Architectural Insights from README
• Chrome Extension (Manifest v3)
• Background service worker orchestrates alarms, scrapers, message passing
• React UIs in popup & dashboard (built with Webpack & Tailwind)
• Firebase: Auth + Firestore + Cloud Functions for email notifications
• External dependencies: Expedia website (scraped), SMTP/email provider
Main Components & Their Relationships
A. Browser-Side Extension
1. Manifest v3 → registers background service worker
2. Background Service Worker
• alarmScheduling.js triggers daily/frequent scrape
• scraper.js fetches Expedia pages → DOM parse → extract prices
• firebase_utils.js writes to Firestore via chrome.identity token
• priceStorage.js/ monthlyHistory.js handle data modeling
• emailNotification.js enqueues Cloud Function triggers
3. Popup UI (React)
• App.jsx + Views (DailyScrapeView, PricesView, SettingsView)
• Communicates with background via chrome.runtime.sendMessage
• Reads/Writes user settings to chrome.storage and Firestore
4. Dashboard UI (React + Recharts)
• dashboard.html + Dashboard.jsx
• Queries Firestore directly to render price history, logs, analytics
B. Cloud-Side Services
1. Firebase Authentication (Google OAuth, anonymous)
2. Firestore Database (collections: users, properties, dailyPrices, monthlyHistory)
3. Cloud Functions (functions/index.js)
• Trigger: Firestore writes or scheduled via Pub/Sub
• Uses Nodemailer to send email summaries
C. External Systems
• Expedia website (HTML pages to scrape)
• SMTP/email provider (via Nodemailer)
Architectural Patterns & Principles
• Separation of concerns:
• Background worker for all scraping & scheduling logic
• React UIs strictly for presentation and user interaction
• Firebase helper modules in src/lib shared across UIs & background
• Event-driven:
• Chrome alarms & messages drive the scrape pipeline
• Firestore triggers drive email notifications
• Modular bundling:
• Webpack organizes code into entry points (background, popup, dashboard)
Final Checklist
• Component labels (e.g., “Background Service Worker”, “Popup React App”)
• Arrowheads and annotations (e.g., “Firestore.write()”, “chrome.alarms API”)
• Data flow loops (scrape → store → dashboard → notify)