Honey Barrel Comparator is a Chrome Extension that helps users compare prices of spirits on various retail websites with listings available on the BAXUS marketplace.
- Frontend Framework: React 18
- Build Tool: Vite
- Styling: Tailwind CSS
- Search Algorithm: Fuse.js for fuzzy matching
- API Integration: REST API with custom headers
- Backend: Express.js with Firecrawl integration
The application uses a sophisticated matching algorithm powered by Fuse.js with the following features:
-
Name Normalization:
- Removes punctuation
- Converts to lowercase
- Removes stop words (the, a, an)
- Standardizes number formats (e.g., "twelve" to "12")
- Normalizes whitespace
- Trims leading and trailing spaces
-
Weighted Multi-Field Search:
- Name (weight: 0.8)
- Size (weight: 0.1)
- Price (weight: 0.05)
- Spirit Type (weight: 0.05)
- ABV (weight: 0.1)
-
Match Configuration:
- Threshold: 0.5 (balance between precision and recall)
- Minimum match length: 3 characters
- Includes match scoring for result ranking
- Returns top 5 matches sorted by match score
-
Parallel API Calls:
const [scrapedData, baxusListings] = await Promise.all([ extractDataFromUrl(tab.url), fetchBaxusListings() ]);
-
Loading State Management:
- Rotating loading messages
- Error handling for failed requests
- Loading spinner for visual feedback
The backend server is built with Express.js and provides two main endpoints for spirit data extraction and BAXUS listings.
- Node.js (v14 or higher)
- npm or yarn
- Firecrawl API key
- BAXUS API access
{
"express": "^4.18.3",
"cors": "^2.8.5",
"dotenv": "^16.3.1",
"@mendable/firecrawl-js": "^1.24.0",
"express-rate-limit": "^7.1.5",
"compression": "^1.7.4"
}
-
Navigate to the server directory:
cd server
-
Install dependencies:
npm install
-
Create a
.env
file in the server directory:PORT=3001 # Replace with your own secure API key (32+ characters) # Example: # API_KEY=ef9fda3b87c6b7b9e13fc124e5b5c9d1a0b9b55c417445b1a0599a9ac23b5eb7 API_KEY=your_api_key_here FIRECRAWL_API_KEY=your_firecrawl_api_key
-
Start the server:
- For development (with auto-reload):
npm run dev
- For production:
npm start
- For development (with auto-reload):
-
API Endpoints:
GET /api/baxus-listings
: Fetch BAXUS marketplace listingsPOST /api/extract
: Extract spirit data from retail websitesGET /health
: Health check endpoint
-
Performance Optimizations:
- Response compression
- 10-minute caching for BAXUS listings
- Rate limiting (100 requests per 15 minutes)
-
Security Features:
- API key authentication
- CORS protection
- Rate limiting
- Input validation
-
Error Handling:
- Invalid API keys
- Rate limit exceeded
- Malformed requests
- Failed extractions
- Network errors
-
Navigate to the root directory:
cd .. # If you're in the server directory
-
Install dependencies:
npm install
-
Create a
.env
file in the root directory:VITE_API_KEY=your_security_api_key_here #Example # VITE_API_KEY=ef9fda3b87c6b7b9e13fc124e5b5c9d1a0b9b55c417445b1a0599a9ac23b5eb7
-
Start the development server:
npm run dev
Or build for production:
npm run build
-
Start the backend server:
cd server npm run dev
-
Build the Chrome extension:
cd .. # Return to root directory npm run build
After building the extension, follow these steps to load it in Chrome:
- Open Google Chrome
- Navigate to
chrome://extensions/
- Enable "Developer mode" (toggle switch in top right)
- Click "Load unpacked"
- Navigate to your project's
dist
directory and select itpath/to/project/dist
The extension should now appear in your Chrome toolbar. To use it:
- Make sure the backend server is running (
npm run dev
in server directory) - Visit any supported spirit retail website
- Click the extension icon in your Chrome toolbar
- Click "Find on Baxus" to compare prices
-
After making changes to the extension code:
- Run
npm run build
again - Go to
chrome://extensions/
- Click the refresh icon on your extension card
- Run
-
To view extension logs:
- Right-click the extension icon
- Click "Inspect popup"
- View the console for logs and debugging
-
If the extension isn't working:
- Check that the backend server is running on port 3001
- Verify your API keys in both frontend and backend
.env
files - Check the browser console for any error messages
- Ensure you're on a supported retail website
The extension currently works on all spirit retail websites. The Firecrawl extraction service automatically detects and extracts product information from supported sites.