A comprehensive web application for tracking food prices across multiple retailers, built with modern technologies and scalable architecture.
- Price Comparison: Compare prices across multiple retailers
- Price Alerts: Set alerts for price drops on favorite products
- User Authentication: Secure JWT-based authentication
- Favorites: Save favorite products for easy tracking
- Analytics: Track price trends and get insights
- Web Scraping: Automated price collection from major retailers
- Responsive Design: Modern, mobile-friendly interface
- Node.js with Express.js
- PostgreSQL database
- JWT authentication
- Puppeteer for web scraping
- Docker containerization
- React 18 with hooks
- Styled Components for styling
- React Query for data fetching
- React Router for navigation
- Axios for API calls
- Node.js 18+
- PostgreSQL 15+
- Docker (optional)
-
Clone the repository
git clone <repository-url> cd FoodPriceTracker
-
Install dependencies
# Install root dependencies npm install # Install backend dependencies cd backend && npm install # Install frontend dependencies cd ../frontend && npm install
-
Set up environment variables
# Copy environment files cp .env.example .env cp backend/.env.example backend/.env # Edit the .env files with your configuration
-
Set up the database
# Start PostgreSQL (using Docker) docker-compose up -d postgres # Run database migrations cd backend && npm run migrate
-
Start the development servers
# Start both frontend and backend npm run dev
-
Using Docker Compose
# Build and start all services docker-compose up -d -
Manual Deployment
# Build frontend cd frontend && npm run build # Start backend cd ../backend && npm start
The application uses PostgreSQL with the following main tables:
- users: User accounts and authentication
- products: Product information and metadata
- retailers: Store information
- product_prices: Current prices across retailers
- price_history: Historical price data
- price_alerts: User-defined price alerts
- user_favorites: User's favorite products
POST /api/auth/register- User registrationPOST /api/auth/login- User loginGET /api/auth/profile- Get user profilePUT /api/auth/profile- Update user profile
GET /api/products/search- Search productsGET /api/products/:id- Get product detailsPOST /api/products/:id/favorite- Add to favoritesGET /api/products/favorites/list- Get user favorites
GET /api/prices/compare- Compare pricesGET /api/prices/history- Price historyGET /api/prices/trending- Trending productsGET /api/prices/deals- Best deals
GET /api/alerts- Get user alertsPOST /api/alerts- Create price alertPUT /api/alerts/:id- Update alertDELETE /api/alerts/:id- Delete alert
The application includes a sophisticated web scraping system that:
- Supports multiple retailers (Walmart, Target, Kroger, etc.)
- Uses Puppeteer for dynamic content
- Implements rate limiting and anti-detection measures
- Stores scraped data in PostgreSQL
- Runs on scheduled intervals
- JWT-based authentication
- Password hashing with bcrypt
- Rate limiting on API endpoints
- CORS configuration
- Input validation with Joi
- SQL injection prevention
- XSS protection headers
- Database indexing for fast queries
- React Query for efficient data fetching
- Image optimization and lazy loading
- Compression middleware
- Connection pooling
- Caching strategies
# Run backend tests
cd backend && npm test
# Run frontend tests
cd frontend && npm test
# Run all tests
npm test- Health check endpoints
- Error logging and monitoring
- Database query performance tracking
- Scraping success/failure rates
# Database
DB_HOST=localhost
DB_PORT=5432
DB_NAME=food_tracker
DB_USER=postgres
DB_PASSWORD=your_password
# JWT
JWT_SECRET=your_secret_key
JWT_EXPIRES_IN=7d
# Server
PORT=5000
NODE_ENV=production# Build and deploy
docker-compose up -d
# View logs
docker-compose logs -f
# Scale services
docker-compose up -d --scale backend=3- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
For support and questions:
- Create an issue in the repository
- Check the documentation
- Review the API endpoints
- Mobile app development
- Machine learning price predictions
- Social features and sharing
- Advanced analytics dashboard
- Integration with more retailers
- Real-time notifications
- Price forecasting algorithms