A modern, responsive Flask web application for online grocery shopping with a playful yet professional design.
- Dynamic hero banner with promotional sliders
- Featured products showcase
- Hot deals section with discount badges
- Category grid with colorful icons
- Newsletter subscription
- 9 main categories: Vegetables, Fruits, Legumes, Dairy Products, Bakery, Beverages, Household Items, Snacks, Frozen Foods
- Advanced filtering by price, brand, and discount status
- Real-time search within categories
- Sorting options (name, price, deals)
- Mobile-responsive product grid
- Detailed product information with descriptions
- Nutritional information for food items
- Stock availability indicators
- Quantity selector with validation
- Related product recommendations
- Add to cart functionality
- Session-based persistent cart
- Real-time quantity updates
- Price calculations with discounts
- Free shipping threshold indicator
- Remove/update item functionality
- Order summary with tax calculations
- Step-by-step checkout flow
- Contact and delivery information forms
- Multiple delivery options (standard, express, same-day)
- Payment method selection
- Form validation with real-time feedback
- Order confirmation page
- Global search across all products
- Category-based navigation
- Breadcrumb navigation
- Mobile-friendly hamburger menu
- Responsive design for all devices
- Backend: Flask (Python)
- Templates: Jinja2
- Frontend: HTML5, CSS3, Vanilla JavaScript
- Design: Mobile-first responsive design
- Fonts: Google Fonts (Poppins)
- Icons: Unicode emojis for playful design
freshmart/
βββ app.py # Main Flask application
βββ requirements.txt # Python dependencies
βββ README.md # This file
βββ templates/ # Jinja2 templates
β βββ base.html # Base template with navigation
β βββ index.html # Homepage
β βββ category.html # Category listing page
β βββ product.html # Product detail page
β βββ cart.html # Shopping cart
β βββ checkout.html # Checkout process
β βββ order_confirmation.html # Order confirmation
β βββ search_results.html # Search results
βββ static/ # Static assets
βββ css/
β βββ style.css # Main stylesheet
βββ js/
β βββ main.js # JavaScript functionality
βββ img/ # Image directories
βββ icons/ # Category icons (placeholder)
βββ products/ # Product images (placeholder)
- Python 3.7 or higher
- pip (Python package installer)
-
Clone or download the project files
# If using git git clone <repository-url> cd freshmart # Or download and extract the ZIP file
-
Install dependencies
pip install -r requirements.txt
-
Run the application
python app.py
-
Open your browser Navigate to
http://127.0.0.1:5000orhttp://localhost:5000
# Set environment variables (optional)
set FLASK_APP=app.py
set FLASK_ENV=development
# Run with flask command
flask run- Primary Green: #4CAF50 (buttons, accents)
- Secondary Orange: #FF9800 (deals, highlights)
- Error Red: #F44336 (validation, alerts)
- Warning Orange: #FF9800 (low stock)
- Background: Clean whites and light grays
- Font Family: Poppins (rounded, modern)
- Weights: 300, 400, 500, 600, 700
- Responsive sizing: Scales appropriately on mobile
- Smooth hover effects on cards and buttons
- Cart icon bounce animation on item addition
- Scroll-triggered animations for product cards
- Loading states and micro-interactions
- Collapsible navigation menu
- Single-column layout for hero section
- 2-column product grid
- Touch-friendly buttons and inputs
- Optimized forms for mobile input
- Adapted grid layouts
- Optimized spacing and typography
- Full multi-column layouts
- Hover effects and tooltips
- Large hero sections with graphics
The application includes 32 sample products across all categories:
- Vegetables: Carrots, Bell Peppers, Spinach, Cherry Tomatoes, Broccoli
- Fruits: Apples, Bananas, Strawberries, Oranges, Blueberries
- Dairy: Milk, Greek Yogurt, Cheese, Butter
- Bakery: Bread, Croissants, Bagels
- Beverages: Orange Juice, Coffee, Tea
- Legumes: Black Beans, Chickpeas, Lentils
- Household: Dish Soap, Paper Towels, Detergent
- Snacks: Potato Chips, Mixed Nuts, Granola Bars
- Frozen: Pizza, Ice Cream, Vegetables
Each product includes:
- Name, brand, and description
- Price and discount information
- Stock levels
- Nutritional information (for food items)
- Category classification
- Add your own products: Edit the
PRODUCTSlist inapp.py - Modify categories: Update the
CATEGORIESdictionary - Change styling: Edit
static/css/style.css - Add functionality: Extend
static/js/main.js
Replace emoji placeholders with actual images:
- Add product images to
static/img/products/ - Update image references in the template files
- Recommended image size: 400x400px for product cards
Replace emoji icons with custom icons:
- Add icon files to
static/img/icons/ - Update icon references in templates and
app.py - Recommended formats: SVG or PNG (64x64px)
- Cart data is stored in Flask sessions
- Sessions are permanent for better user experience
- Cart persists across browser sessions
- Form validation on both client and server side
- CSRF protection recommended for production
- Input sanitization for search queries
- Lazy loading for product images
- Debounced search functionality
- Optimized CSS and JavaScript delivery
# Set production environment
export FLASK_ENV=production
# Use a proper secret key
export SECRET_KEY="your-super-secret-key-here"- Database Integration: Replace in-memory data with SQLite/PostgreSQL
- User Authentication: Add login/registration system
- Payment Processing: Integrate Stripe, PayPal, or similar
- Image Handling: Add proper image upload and optimization
- Email Notifications: Send order confirmations and updates
- Inventory Management: Real-time stock tracking
- Admin Panel: Product and order management interface
-
Port Already in Use
# Change port in app.py or use: flask run --port 5001 -
Missing Dependencies
pip install --upgrade -r requirements.txt
-
Template Not Found
- Ensure templates are in the
templates/directory - Check file names match exactly (case-sensitive)
- Ensure templates are in the
-
Static Files Not Loading
- Verify files are in the
static/directory - Clear browser cache
- Check file paths in templates
- Verify files are in the
For issues or questions:
- Check the troubleshooting section above
- Review Flask documentation: https://flask.palletsprojects.com/
- Validate HTML/CSS using browser developer tools
This project is provided as-is for educational and development purposes.
Built with β€οΈ using Flask, HTML5, CSS3, and JavaScript
Ready to shop fresh! π₯ππ₯