Small Business Inventory Management System

A RESTful API for managing inventory for small businesses built with FastAPI and SQLite.

Features

  • Inventory item management (create, read, update, delete)
  • Category management
  • Supplier management
  • Stock movement tracking (purchases, sales, returns, adjustments)
  • Low stock alerts
  • Detailed reporting capabilities

Tech Stack

  • Python 3.8+
  • FastAPI
  • SQLAlchemy ORM
  • SQLite Database
  • Alembic Migrations
  • Pydantic Data Validation

Setup Instructions

Prerequisites

  • Python 3.8 or higher
  • pip (Python package manager)

Installation

  1. Clone the repository:
git clone https://github.com/yourusername/small-business-inventory.git
cd small-business-inventory
  1. Create a virtual environment:
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
  1. Install dependencies:
pip install -r requirements.txt
  1. Set up the database:
# Run the database migrations
alembic upgrade head

Running the Application

  1. Start the FastAPI server:
uvicorn main:app --reload
  1. Access the API:

API Endpoints

Health Check

  • GET /health - Check system health

Categories

  • GET /categories - List all categories
  • GET /categories/{category_id} - Get a specific category
  • POST /categories - Create a new category
  • PUT /categories/{category_id} - Update a category
  • DELETE /categories/{category_id} - Delete a category

Suppliers

  • GET /suppliers - List all suppliers
  • GET /suppliers/{supplier_id} - Get a specific supplier
  • POST /suppliers - Create a new supplier
  • PUT /suppliers/{supplier_id} - Update a supplier
  • DELETE /suppliers/{supplier_id} - Delete a supplier

Inventory Items

  • GET /items - List all inventory items (with filtering options)
  • GET /items/{item_id} - Get a specific item
  • POST /items - Create a new item
  • PUT /items/{item_id} - Update an item
  • DELETE /items/{item_id} - Delete an item

Stock Management

  • GET /stock/movements - List all stock movements
  • GET /stock/movements/{movement_id} - Get a specific stock movement
  • POST /stock/movements - Create a new stock movement
  • GET /stock/low-stock - Get low stock items

Data Models

Category

{
  "id": 1,
  "name": "Electronics",
  "description": "Electronic components and devices",
  "is_active": true,
  "created_at": "2025-05-12T10:00:00",
  "updated_at": "2025-05-12T10:00:00"
}

Supplier

{
  "id": 1,
  "name": "ABC Supplies",
  "contact_name": "John Doe",
  "email": "john@abcsupplies.com",
  "phone": "555-1234",
  "address": "123 Main St, Anytown",
  "is_active": true,
  "created_at": "2025-05-12T10:00:00",
  "updated_at": "2025-05-12T10:00:00"
}

Item

{
  "id": 1,
  "name": "LED Monitor",
  "sku": "MON-LED-24",
  "description": "24-inch LED Monitor",
  "unit_price": 199.99,
  "quantity": 25,
  "reorder_level": 5,
  "category_id": 1,
  "supplier_id": 1,
  "is_active": true,
  "created_at": "2025-05-12T10:00:00",
  "updated_at": "2025-05-12T10:00:00"
}

StockMovement

{
  "id": 1,
  "item_id": 1,
  "quantity": 10,
  "movement_type": "purchase",
  "reference": "PO12345",
  "notes": "Initial stock order",
  "unit_price": 180.00,
  "created_at": "2025-05-12T10:00:00"
}

License

MIT

Description
Project: Small Business Inventory Management System
Readme 46 KiB
Languages
Python 98.5%
Mako 1.5%