A full-stack web application for comparing restaurant menu items and prices from Swiggy. Browse restaurants, filter by category, compare menu prices, and find the best deals.
- Live Data Scraping: Fetch fresh restaurant data from Swiggy in real-time
- Smart Caching: 6-hour cache with force refresh option
- GPS Location Detection: Auto-detect your location or enter a pincode
- Distance Filtering: Filter restaurants by distance from your location
- Menu Price Comparison: Compare prices of similar items across restaurants
- Hierarchical Categories: Browse by main categories and subcategories
- Advanced Filtering: Filter by rating, price, vegetarian options
- Responsive UI: Modern interface with real-time updates
- React.js - UI framework
- Axios - HTTP client
- CSS3 - Modern styling
- Node.js - Runtime environment
- Express.js - Web framework
- Mongoose - MongoDB ODM
- Axios - Swiggy API integration
- MongoDB - Document database with TTL indexes
FoodFinder/
├── client/ # React frontend
│ ├── src/
│ │ ├── components/
│ │ │ ├── Header.js
│ │ │ ├── NewFilterPanel.js
│ │ │ ├── MenuComparison.js
│ │ │ └── RestaurantList.js
│ │ ├── App.js
│ │ └── index.js
│ └── package.json
│
├── server/ # Node.js backend
│ ├── config/
│ │ └── database.js # MongoDB connection
│ ├── models/
│ │ ├── Restaurant.js # Restaurant schema
│ │ └── ScrapeCache.js # Cache schema with TTL
│ ├── routes/
│ │ ├── restaurants.js # Query endpoints
│ │ └── scrape.js # Scraping endpoints
│ ├── services/
│ │ └── swiggyService.js # Swiggy API integration
│ ├── utils/
│ │ ├── cuisineHelper.js
│ │ └── clearCache.js # Cache management utility
│ ├── server.js # Main entry point
│ └── package.json
│
└── README.md
- Node.js (v14 or higher)
- MongoDB (v4.4 or higher)
- npm or yarn
-
Clone the repository
git clone <repository-url> cd FoodFinder
-
Install Backend Dependencies
cd server npm install -
Install Frontend Dependencies
cd ../client npm install -
Configure Environment Variables
Edit
server/.env:PORT=5000 MONGODB_URI=mongodb://localhost:27017/foodfinder NODE_ENV=development
-
Start MongoDB
# On Ubuntu/Linux: sudo systemctl start mongod # On macOS with Homebrew: brew services start mongodb-community # On Windows: # Start MongoDB service from Services panel
Terminal 1 - Backend:
cd server
npm run devBackend will run on http://localhost:5000
Terminal 2 - Frontend:
cd client
npm startFrontend will run on http://localhost:3000
POST /api/scrape
{
"pincode": "560001",
"includeNearby": true,
"forceRefresh": false
}GET /api/scrape/status Returns database statistics
GET /api/restaurants
Query Parameters:
mainCategory- Main food categorysubcategory- Subcategories (can be array)minRating- Minimum rating (0-5)maxPrice- Maximum price per personisVeg- Vegetarian only (true/false)search- Search queryuserLat/userLng- GPS coordinatesmaxDistance- Distance filter in kmsortBy- Sort field (rating/priceForTwo/distance)sortOrder- asc/desc
GET /api/restaurants/menu-comparison Returns menu items with prices for comparison
GET /api/restaurants/meta/categories-with-menu Returns categories that have menu data
GET /api/restaurants/meta/available-subcategories/:category Returns available subcategories for a category
- User enters pincode or uses GPS auto-detect
- Backend scrapes Swiggy's API for restaurant and menu data
- Data is cached for 6 hours (TTL index auto-expires old data)
- User filters by category, rating, price, distance, etc.
- Menu comparison shows price differences across restaurants
The app uses a 6-hour cache with MongoDB TTL indexes:
View cache status:
cd server
node utils/clearCache.js --statusClear all cache:
node utils/clearCache.js --allClear specific pincode:
node utils/clearCache.js --pincode=560087- Swiggy may block excessive requests
- Use force refresh sparingly
- 2-second delay between restaurant menu scrapes
- This tool is for educational purposes
- Review Swiggy's Terms of Service
- Use scraped data responsibly
- Corporate proxies may cause SSL errors
- SSL verification is disabled for axios requests
Port 5000 already in use:
lsof -ti:5000 | xargs kill -9MongoDB not running:
sudo systemctl start mongod
sudo systemctl status mongodCache not expiring:
- TTL index is automatically configured
- MongoDB checks every 60 seconds
- Use
clearCache.jsutility for manual cleanup
ISC
vtri950
Built with ❤️ using React, Node.js, and MongoDB
Happy Restaurant Hunting! 🍕🍔🍜