Skip to content

A robust REST API for managing inventory. This supports user authentication, RBAC, and comprehensive inventory operations, including customer/supplier management, product categorization, stock tracking, and order processing. Features include email notifications, background calculations (e.g., stock prices, order totals), and low stock alerts.

License

Notifications You must be signed in to change notification settings

EmmyAnieDev/inventory-management-system

Repository files navigation

Inventory Management System API

A comprehensive REST API built with Flask for managing inventory, tracking products, stock levels, customers, suppliers, and orders.

Features

  • 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

Tech Stack

  • Framework: Flask
  • Database: SQLAlchemy
  • Authentication: Flask-JWT-Extended
  • Email: Flask-Mail
  • Validation: Flask-Marshmallow
  • Package Management: Poetry

Getting Started

Prerequisites

  • Python 3.8+
  • Poetry package manager

Installation

  1. Clone the repository:
  git clone https://github.com/EmmyAnieDev/inventory-management-system.git
  cd inventory-management-system
  1. Install dependencies with Poetry:
  poetry install
  1. Create a .env file in the project root:
  cp .env.sample .env

Then edit the .env file with your specific configuration values.

Environment Setup

Using Poetry (Recommended)

  1. Install Poetry if you haven't already:
  curl -sSL https://install.python-poetry.org | python3 - --version 1.8.2
  1. Add Poetry to PATH:
  export PATH="$HOME/.local/bin:$PATH"
  1. Verify Poetry installation:
  poetry --version
  1. Create a virtual environment with Poetry:
  poetry env use python3.10  # or your preferred Python version
  1. Install dependencies:
  poetry install
  1. Activate the virtual environment:
  poetry shell

Alternatively, you can run commands within the virtual environment without activating it:

  poetry run <command>

Using Standard Python venv

  1. Create a virtual environment:
  python3 -m venv .venv
  1. Activate the virtual environment:
  • On macOS/Linux:
  source .venv/bin/activate
  • On Windows (PowerShell):
  .venv\Scripts\Activate
  1. Install Poetry (if not already installed):
  pip install poetry
  1. Install project dependencies using Poetry:
  poetry install

Running the Application

Option 1: Using Docker (Recommended)

Build and start the containers:

  docker-compose up -d

Option 2: (Using Poetry)

  1. Activate the Poetry virtual environment (if not already activated):
  poetry shell
  1. Create the database:
  flask db upgrade
  1. Run the application:
  python main.py

The API will be available at http://localhost:5000/.

The API documentation will be available at http://localhost:5000/apidocs.

Project Structure

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

Development Tasks

Adding Dependencies

  poetry add package-name

For development dependencies:

  poetry add --dev package-name

Running Tests

  poetry run pytest

Database Migrations

Initialize migrations (first time only):

  flask db init

Create a new migration:

  flask db migrate -m "Description of changes"

Apply migrations:

  flask db upgrade

License

License

About

A robust REST API for managing inventory. This supports user authentication, RBAC, and comprehensive inventory operations, including customer/supplier management, product categorization, stock tracking, and order processing. Features include email notifications, background calculations (e.g., stock prices, order totals), and low stock alerts.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages