A comprehensive REST API built with Flask for managing inventory, tracking products, stock levels, customers, suppliers, and orders.
- Complete Inventory Tracking: Manage products, categories, stock levels, and pricing
- Order Management: Track both incoming (supplier) and outgoing (customer) orders
- User Authentication: Secure JWT-based authentication with role-based access control
- Automated Calculations: Background calculations for inventory, pricing, and discounts
- Email Integration: Automated notifications for orders and system events
- RESTful API Design: Well-structured endpoints following REST principles
- Framework: Flask
- Database: SQLAlchemy
- Authentication: Flask-JWT-Extended
- Email: Flask-Mail
- Validation: Flask-Marshmallow
- Package Management: Poetry
- Python 3.8+
- Poetry package manager
- Clone the repository:
git clone https://github.com/EmmyAnieDev/inventory-management-system.git
cd inventory-management-system- Install dependencies with Poetry:
poetry install- Create a
.envfile in the project root:
cp .env.sample .envThen edit the .env file with your specific configuration values.
- Install Poetry if you haven't already:
curl -sSL https://install.python-poetry.org | python3 - --version 1.8.2- Add Poetry to PATH:
export PATH="$HOME/.local/bin:$PATH"- Verify Poetry installation:
poetry --version- Create a virtual environment with Poetry:
poetry env use python3.10 # or your preferred Python version- Install dependencies:
poetry install- Activate the virtual environment:
poetry shellAlternatively, you can run commands within the virtual environment without activating it:
poetry run <command>- Create a virtual environment:
python3 -m venv .venv- Activate the virtual environment:
- On macOS/Linux:
source .venv/bin/activate- On Windows (PowerShell):
.venv\Scripts\Activate- Install Poetry (if not already installed):
pip install poetry- Install project dependencies using Poetry:
poetry installBuild and start the containers:
docker-compose up -d- Activate the Poetry virtual environment (if not already activated):
poetry shell- Create the database:
flask db upgrade- Run the application:
python main.pyThe API will be available at http://localhost:5000/.
The API documentation will be available at http://localhost:5000/apidocs.
InventoryManagement/
├── .venv/
├── app/
│ ├── __init__.py
│ ├── api/
│ │ ├── __init__.py
│ │ ├── core/
│ │ │ └── __init__.py
│ │ ├── db/
│ │ │ └── __init__.py # Contains db = SQLAlchemy()
│ │ ├── utils/
│ │ │ └── __init__.py
│ │ └── v1/
│ │ ├── __init__.py
│ │ ├── models/
│ │ │ ├── __init__.py
│ │ │ ├── base.py # BaseModel definition
│ │ │ └── user.py # User model
│ │ ├── routes/
│ │ │ └── __init__.py
│ │ ├── schemas/
│ │ │ └── __init__.py
│ │ └── services/
│ │ └── __init__.py
│ └── __init__.py
├── .env
├── .env.sample
├── .gitignore
├── app.py
├── config.py
├── poetry.lock
├── pyproject.toml
└── README.md
poetry add package-nameFor development dependencies:
poetry add --dev package-name poetry run pytestInitialize migrations (first time only):
flask db initCreate a new migration:
flask db migrate -m "Description of changes"Apply migrations:
flask db upgrade