Skip to content
case study · personal project

StockFlow — Inventory & Order Management

A Django and React inventory and order system. Stock changes only through a ledger of movements, and orders placed at the same moment cannot oversell.

  • 65
    automated back-end tests, run by GitHub Actions on every pull request
project
Personal project
my role
Design and development
when
Jun – Jul 2026
Screenshot of the StockFlow dashboard: active products, low-stock items, inventory value and a chart of the top products by quantity (sample data).
The dashboard, with sample data.

## the problem

Keeping stock right when orders arrive at the same time. Two orders for the last items must not both go through, an order with several items has to succeed completely or not at all, and someone has to hear about an item before it runs out. StockFlow is a personal project built around those three requirements.

## what I did

  • Built the back end with Django and Django REST Framework on PostgreSQL: products, categories, suppliers, warehouses, stock, stock movements and customer orders.
  • Made stock a ledger: it changes only through stock movements, and a movement can be recorded but not edited or deleted.
  • Made orders atomic: an order deducts stock for all its items in one database transaction, and if any item is short the whole order rolls back.
  • Made it safe for parallel requests: each movement locks its stock row with select_for_update() and checks the quantity again under the lock; rows are locked in a fixed order to avoid deadlocks.
  • Added low-stock alerts and a daily stock report with Celery; an alert is sent only after its transaction has committed.
  • Added JWT sign-in with roles: managers edit the catalogue, staff record stock movements and orders.
  • Built the front end with React and TypeScript: a dashboard with a stock chart, and pages for products, stock and new orders.
  • Documented the API with OpenAPI (Swagger UI and ReDoc) and packaged the app as one Docker image that serves the React build and the API from the same origin.

## apps and tools

DjangoDjango REST FrameworkPostgreSQLCeleryRedisReactTypeScriptpytestGitHub ActionsDocker

## the result

The 65 back-end tests pass in CI on Python 3.12 and 3.13 against PostgreSQL 16. One of them makes eight withdrawals at the same moment from stock that covers two, and checks that exactly two go through. The source code is public.