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
- Clone the repository:
git clone https://github.com/yourusername/small-business-inventory.git
cd small-business-inventory
- Create a virtual environment:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
- Install dependencies:
pip install -r requirements.txt
- Set up the database:
# Run the database migrations
alembic upgrade head
Running the Application
- Start the FastAPI server:
uvicorn main:app --reload
- Access the API:
- API Documentation: http://localhost:8000/docs
- API Endpoints: http://localhost:8000/redoc
API Endpoints
Health Check
GET /health
- Check system health
Categories
GET /categories
- List all categoriesGET /categories/{category_id}
- Get a specific categoryPOST /categories
- Create a new categoryPUT /categories/{category_id}
- Update a categoryDELETE /categories/{category_id}
- Delete a category
Suppliers
GET /suppliers
- List all suppliersGET /suppliers/{supplier_id}
- Get a specific supplierPOST /suppliers
- Create a new supplierPUT /suppliers/{supplier_id}
- Update a supplierDELETE /suppliers/{supplier_id}
- Delete a supplier
Inventory Items
GET /items
- List all inventory items (with filtering options)GET /items/{item_id}
- Get a specific itemPOST /items
- Create a new itemPUT /items/{item_id}
- Update an itemDELETE /items/{item_id}
- Delete an item
Stock Management
GET /stock/movements
- List all stock movementsGET /stock/movements/{movement_id}
- Get a specific stock movementPOST /stock/movements
- Create a new stock movementGET /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
Languages
Python
98.5%
Mako
1.5%