A lightweight web application for managing grocery store inventory, tracking orders, and performing CRUD operations. Built using Flask for the backend, MySQL for the database, and supporting APIs for integration.
- Manage Products: Add, view, and delete grocery items.
- Orders Management: Create and view customer orders.
- Units of Measure (UOM): Retrieve and manage units of measure.
- RESTful APIs: Provides APIs for integration with frontend or other systems.
- CORS Enabled: Allows cross-origin requests for flexibility in integration.
- Flask: For routing and REST API handling.
- MySQL: For database management.
- MySQL Connector: For connecting Flask with MySQL.
- Postman: For testing APIs (optional).
git clone https://github.com/Muazzam741/Grocery-Manager.gitpython -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activatepip install -r requirements.txt- Create a MySQL database:
CREATE DATABASE grocery_store;
- Import the schema:
mysql -u your_username -p grocery_store < schema.sql
Update the sql_connection.py file to include your MySQL credentials:
def get_sql_connection():
return mysql.connector.connect(
host='localhost',
user='your_username',
password='your_password',
database='grocery_store'
)python app.pyAccess the app at http://127.0.0.1:5000.
| Endpoint | Method | Description | Request Data |
|---|---|---|---|
/getUOM |
GET | Retrieve all units of measure | - |
/getProducts |
GET | Retrieve all products | - |
/insertProduct |
POST | Add a new product | data: JSON |
/getAllOrders |
GET | Retrieve all orders | - |
/insertOrder |
POST | Insert a new order | data: JSON |
/deleteProduct |
POST | Delete a product by ID | product_id: string |
- Endpoint:
/insertProduct - Method: POST
- Request Data:
{ "name": "Apple", "price_per_unit": 50, "uom_id": 1 } - Response:
{ "product_id": 101 }
- Endpoint:
/getProducts - Method: GET
- Response:
[ { "id": 1, "name": "Apple", "price_per_unit": 50, "uom_id": 1 }, ... ]
- Endpoint:
/deleteProduct - Method: POST
- Request Data:
{ "product_id": 101 } - Response:
{ "product_id": 101 }
grocery-management/
├── static/ # CSS, JavaScript, and images
├── templates/ # HTML files
├── app.py # Main Flask application
├── sql_connection.py # MySQL connection setup
├── products_dao.py # Product data access object
├── orders_dao.py # Order data access object
├── uom_dao.py # Unit of measure data access object
├── schema.sql # SQL schema for database
├── requirements.txt # Python dependencies
├── README.md # Project documentation
- Integrate a user interface for easy interaction with APIs.
- Implement role-based user authentication.
- Add reporting and analytics dashboards.
- Include error handling for robust API interactions.
This project is licensed under the MIT License. See the LICENSE file for details.
For questions or support, please contact muazzamali741@gmail.com.