A multi-tenant inventory management system built for a medical supplies company managing stock across multiple warehouse locations.
The problem
Medical inventory has constraints that general IMS software does not handle well: batch traceability, strict expiry tracking, and regulatory requirements around stock disposal. Off-the-shelf solutions were either too expensive or required too much configuration for a mid-size supplier.
Multi-tenancy
Each tenant manages their own warehouse locations, product catalogue, and supplier relationships in complete isolation. Row-level security in PostgreSQL enforces the boundary at the database layer — a misconfigured query cannot leak data between tenants even if application logic fails.
Inventory tracking
Stock is tracked by batch number, not just SKU. Each batch carries its manufacture date, expiry date, and supplier lot reference. The system generates alerts when:
- Stock for a product drops below a configurable reorder threshold
- A batch is within 30 days of expiry
- A batch has expired and requires disposal logging

Reorder flow
Low-stock alerts link directly into a reorder flow — select a supplier, confirm quantities, and the system generates a purchase order record. Received stock is matched against the order and updates batch inventory automatically.

Stack notes
# Expiry alert query — runs nightly via Celery Beat
from datetime import date, timedelta
from django.db.models import Q
def get_expiry_alerts(tenant_id: int):
threshold = date.today() + timedelta(days=30)
return (
Batch.objects.filter(tenant_id=tenant_id)
.filter(
Q(expiry_date__lte=threshold) |
Q(expiry_date__lt=date.today())
)
.select_related("product", "supplier")
.order_by("expiry_date")
)