๐ Inventory Management & Cart API Using Flask — Full REST API Project
๐ Author: Arooj Amina
๐ GitHub Repo: Inventory-Management-API
๐ง Tech Stack: Python, Flask, Flask-RESTful, SQLAlchemy, Marshmallow
๐ Project Overview
This project is a full-featured REST API for Inventory & Cart Management, built with Flask. It's ideal for managing products, stock, and a simple e-commerce cart system, all exposed via clean and organized API endpoints.
Whether you're managing a small warehouse or building a foundation for an e-commerce system, this API covers the essential features.
๐ง Features
๐ฆ Inventory Management API
-
✅ Add, update, and delete products and categories
-
๐ Track stock quantity per product
-
๐ Handle stock changes like:
-
Restocking
-
Selling
-
Returning items
-
-
๐ Endpoints to warn when stock is low
-
๐ Date-based filtering for analytics (e.g., view items sold in last 7 days)
๐️ E-Commerce Cart API
๐ Add or remove items from a user’s cart๐ฐ Checkout system that:
Calculates the totalDeducts inventory
Clears the cart
๐ Project Structure
Inventory-Management-API/
│
├── app/
│ ├── __init__.py
│ ├── models/ # SQLAlchemy models
│ ├── schemas/ # Marshmallow schemas
│ ├── api/
│ │ ├── inventory/ # Product, category, stock APIs
│ │ └── cart/ # Cart APIs
├── config.py
├── requirements.txt
├── run.py # Main entry point
๐ How to Run This Project Locally
๐น 1. Clone the repository
git clone https://github.com/AroojAmina/Inventory-Management-API.git
cd Inventory-Management-API
๐น 2. Create & activate virtual environment
python -m venv env
source env/bin/activate # On Windows: env\Scripts\activate
๐น 3. Install dependencies
pip install -r requirements.txt
๐น 4. Set environment variables (optional)
If required, configure config.py
or use .env
file.
๐น 5. Run the Flask app
python run.py
API will be available at http://localhost:5000/
๐งช Sample API Endpoints
๐ ️ Product Management
Method | Endpoint | Description |
---|---|---|
GET | /api/products/ |
List all products |
POST | /api/products/ |
Create new product |
GET | /api/products/<id> |
Get single product |
PUT | /api/products/<id> |
Update product |
DELETE | /api/products/<id> |
Delete product |
๐ Stock Movement
Endpoint | Description |
---|---|
/api/stock/restock |
Add stock to product |
/api/stock/sell |
Sell product |
/api/stock/return |
Return product to stock |
/api/stock/low-stock |
Get low-stock warnings |
๐ Cart System
Method | Endpoint | Description |
---|---|---|
POST | /api/cart/add |
Add product to cart |
POST | /api/cart/remove |
Remove product from cart |
GET | /api/cart/view |
View cart contents |
POST | /api/cart/checkout |
Checkout and finalize |
๐ What Makes This Project Stand Out?
-
๐ Stock Movement Logic: Sell/return flows affect stock intelligently.
-
๐ Low Stock Alerts: Helps keep stock levels in check.
-
⏱️ Date Filtering: Track performance with time-based filters.
-
๐งฑ Modular Code Structure: Easy to scale or convert to production.
๐ Conclusion
This project is a great foundation for anyone building an inventory system, POS backend, or basic e-commerce cart using Flask. It uses best practices like:
Class-based views (Flask-RESTful
)Schema validation (
Marshmallow
)Clean separation of logic and routing
๐ Resources
-
๐ GitHub Repo: AroojAmina/Inventory-Management-API
๐ Note: This API is currently not deployed, but you can easily deploy it to platforms like Render, Railway, or Fly.io using free tiers.
0 Comments