A Flask-based Inventory Management System with RESTful APIs to manage products, orders, and stock. This project allows users to add, update, and delete products, as well as manage stock levels.
- User authentication (JWT-based)
- Product management (CRUD operations)
- Stock management (Increase/Decrease stock)
- Order management
- SQLite as the database
- Python
- Flask
- SQLAlchemy (ORM for database)
- Flask-JWT-Extended (JWT for authentication)
- SQLite (Database)
- Python 3.6+ installed
- Pip (Python package installer)
- Virtual environment (optional but recommended)
Follow these steps to get the project up and running on your local machine.
Clone this repository to your local machine using Git:
git clone https://github.com/muazzam741/inventory-flow-system.git
cd inventory-flow-systemIt's recommended to use a virtual environment to isolate project dependencies.
python3 -m venv venvActivate the virtual environment:
- For macOS/Linux:
source venv/bin/activate- For Windows:
venv\Scripts�ctivateInstall the required dependencies using pip:
pip install -r requirements.txtRun the following command to create the SQLite database and initialize the tables:
python app.pyThis will create the necessary tables in the inventory.db SQLite database.
Start the Flask development server:
python app.pyThe app will be running at http://127.0.0.1:5000.
You can test the following API routes using tools like Postman or curl:
-
User Authentication (JWT):
POST /auth/login– Login to get the JWT token.
-
Product Management:
POST /api/products– Add a new product.GET /api/products– Get all products.GET /api/products/<id>– Get a single product by ID.PUT /api/products/<id>– Update a product.DELETE /api/products/<id>– Delete a product.PATCH /api/products/<id>/increase_stock– Increase stock for a product.PATCH /api/products/<id>/decrease_stock– Decrease stock for a product.
- Login:
POST /auth/login-
Request Body:
{ "username": "yourusername", "password": "yourpassword" } -
Response:
{ "access_token": "your_jwt_token_here" }
- Add a Product:
POST /api/products-
Request Body:
{ "name": "Product Name", "price": 19.99, "quantity": 100, "description": "Product description" } -
Response:
{ "message": "Product added successfully" }
- You can find the project structure below:
inventory-flow-system/
├── app.py # Flask application entry point
├── models.py # SQLAlchemy models
├── routes/ # API routes
│ ├── auth_routes.py # Authentication routes
│ └── product_routes.py # Product management routes
├── db.py # Database setup
├── requirements.txt # Project dependencies
└── .gitignore # Git ignore file
This project is licensed under the MIT License - see the LICENSE file for details.
Happy coding! 🎉