A flight price tracking system that crawls flight prices for VietJet Air routes, logs them to a database thrice daily, and provides a premium local analytics dashboard showing recommendations and historical trends.
Key files:
scraper.js: Puppeteer script that scrapes VietJet prices from Google Flights. Upgraded with 42 popular domestic routes and a concurrent worker pool (2 workers) that scrapes pages in parallel.flights_db.json: Local database containing captured price history (over 11,000 runs spanning the last 30 days for all routes).run-scraper.bat: Batch file to run the scraper and log console outputs.setup-schedule.ps1: PowerShell script that registers the background task in Windows Task Scheduler.server.js: Zero-dependency local web server to host the dashboard.run-dashboard.bat: Batch file that launches the server and opens the dashboard in your default browser.index.html,style.css,app.js: The premium dark-mode visual dashboard layout and interactive analytics charting. Supports Vietnamese translation, light/dark mode toggling, dynamic stats card rendering based on the selected route, and separated Departure/Arrival selectors..github/workflows/scrape.yml: GitHub Actions workflow that runs the scraper 3x/day automatically in the cloud.
- Visual Excellence: Deep purple radial gradient background with glassmorphism card overlays, custom HSL styling, and Outfit typography.
- Dynamic Stats Cards: Updates average prices, historic minimums, latest price, and buying recommendations dynamically based on the selected route.
- Separated Route Selectors: Split dropdown menu for Departure and Arrival destinations. The Arrival dropdown dynamically shortlists based on the selected Departure airport to prevent invalid route selections.
- Interactive Analytics: Interactive line charts using Chart.js to track price changes over the past 30 days.
- Diagnostics FAQs: Drop-down accordion menus containing raw flight log data and helpful configuration information.
To execute a manual scrape run and append data to the database:
node scraper.jsTo start the dashboard HTTP server and view the charts:
- Double-click the
run-dashboard.batbatch script. - It will open
http://localhost:3000in your default web browser automatically.
To ensure the scraper runs automatically three times a day (at 8:00 AM, 2:00 PM, and 8:00 PM local time):
- Open PowerShell as Administrator.
- Navigate to the folder and run:
powershell -ExecutionPolicy Bypass -File setup-schedule.ps1
The repository is configured to scrape flight data completely in the cloud using GitHub Actions. To deploy:
- Push your code to your GitHub repository.
- On GitHub, navigate to Settings → Actions → General and verify Workflow permissions is set to Read and write permissions.
- Enable GitHub Pages pointing to the
mainbranch root folder/in Settings → Pages. - The workflow will run thrice daily, updating your database, and rebuilding the site automatically!