An intelligent fridge inventory management system that helps you effectively manage food items in your refrigerator, reduce waste, and improve your quality of life!
- Features
- Tech Stack
- Project Structure
- Installation & Setup
- Usage Guide
- API Documentation
- Screenshots
- Testing
- Contributing
- License
- 📦 Item Management: Add, edit, and delete fridge items
- 🔍 Smart Search: Real-time search by item name
- 📅 Expiry Tracking: Automatically identify expired and soon-to-expire items
- 🏷️ Category Management: 12 food categories (vegetables, fruits, seafood, meat, etc.)
- 📍 Location Management: Three storage locations (refrigerator, freezer, room temperature)
- 📊 Data Overview: View all items at a glance
- Responsive Design: Adapts to various screen sizes
- Intuitive Interface: Clean and beautiful user interface
- Real-time Feedback: AJAX-powered seamless operations
- Icon Support: Font Awesome icon library
- Python 3.9+: Primary programming language
- Flask 2.2.2: Web framework
- PyMongo 4.3.2: MongoDB driver
- MongoDB: NoSQL database
- HTML5: Page structure
- CSS3: Styling
- JavaScript (ES6): Frontend logic
- jQuery 3.6.0: DOM manipulation
- Bootstrap 5.0.0: UI framework
- Font Awesome: Icon library
- Moment.js: Date handling
- Virtual Environment: Python venv
- Version Control: Git
fridgeManager/
├── app.py # Flask main application
├── README.MD # Project documentation
├── web.png # Website screenshot
├── requirements.txt # Python dependencies
├── pytest.ini # Pytest configuration
├── run_tests.py # Test runner script
├── test_basic.py # Basic test validation
├── templates/
│ └── template.html # Main page template
├── static/
│ ├── index.js # Frontend JavaScript
│ └── style/
│ └── index.css # Stylesheet
├── tests/ # Test suite
│ ├── __init__.py
│ ├── conftest.py # Pytest fixtures
│ ├── test_app.py # Unit tests
│ ├── test_database.py # Integration tests
│ └── test_pytest.py # Pytest tests
└── venv/ # Python virtual environment
- Python 3.9 or higher
- MongoDB 4.0 or higher
- Git
-
Clone the Repository
git clone <repository-url> cd fridgeManager
-
Create Virtual Environment
python -m venv venv source venv/bin/activate # Windows: venv\Scripts\activate
-
Install Dependencies
pip install -r requirements.txt
-
Start MongoDB
# Ensure MongoDB service is running mongod -
Run the Application
python app.py
-
Access the Application Open your browser and visit
http://127.0.0.1:8080
- Click the "Add Item" button
- Fill in the item information:
- Name: Item name
- Expiry Date: Select expiration date
- Quantity: Number of items
- Location: Refrigerator/Freezer/Room temperature
- Category: Select appropriate food category
- Click "Add" to complete
- All Items: View all items
- Not Expired: View items within expiry date
- Expired: View expired items
- Filter by Location: Refrigerator/Freezer/Room temperature
- Filter by Category: 12 food categories
- Search Function: Real-time search by keyword
- Click the edit button next to an item to modify
- Click the delete button to remove items
| Method | Endpoint | Description | Parameters |
|---|---|---|---|
| GET | / |
Main page | - |
| POST | /insert |
Add item | itemName, itemDate, itemPlace, itemNum, itemType |
| POST | /search |
Search items | text |
| POST | /stateok/<time> |
Get non-expired items | time (timestamp) |
| POST | /statebad/<time> |
Get expired items | time (timestamp) |
| POST | /cold |
Get refrigerated items | - |
| POST | /frozer |
Get frozen items | - |
| POST | /tag/<tagName> |
Get items by category | tagName |
| POST | /total |
Get all items | - |
| POST | /delete/<_id> |
Delete item | _id |
| POST | /getone/<_id> |
Get single item | _id |
| POST | /edit/<_id> |
Edit item | _id, itemName, itemDate, itemPlace, itemNum, itemType |
{
"_id": "unique_id",
"Name": "Item Name",
"ExpireDate": "2024-12-31T00:00:00.000Z",
"Place": "cold|frozer|room",
"Num": 1,
"Type": "vegetable|fruit|seafood|meat|beverage|diary|egg|bread|frozen|sauce|snack|other"
}Fridge Manager Main Interface - Clean and intuitive design that makes food management easy and enjoyable
This project includes a comprehensive testing framework:
- Unit Tests: Flask routes and individual functions
- Integration Tests: Database operations and API endpoints
- Pytest Tests: Modern testing with fixtures and mocking
- Basic Tests: Core functionality validation
# Run all tests
python run_tests.py
# Run specific test types
python run_tests.py --type unittest
python run_tests.py --type pytest
python run_tests.py --type coverage
# Run basic validation
python test_basic.py- ✅ Flask application startup and routing
- ✅ Database connection and CRUD operations
- ✅ JSON encoding with ObjectId support
- ✅ All API endpoints (insert, search, filter, delete, edit)
- ✅ Error handling and edge cases
This project is licensed under the MIT License - see the LICENSE file for details.
Educational Use: This project was created as part of a National Central University Database Systems midterm project and is intended for educational and research purposes.
⭐ If this project helps you, please give it a Star!
Made with ❤️ by hill0106
