Case Study · 2026
Role-Based Inventory Management System
A FastAPI inventory system with strict role hierarchy — super admins create admins, admins own the catalog, staff run the floor.

Context
Inventory systems fail when everyone has the same level of access — mistakes made by one person ripple across the whole stock record. I built a FastAPI backend with a strict three-tier role hierarchy governing who can create accounts, manage the catalog, and process stock movements.
The Problem
Without clear access boundaries, staff could accidentally alter product data, or admins could create other admins without oversight. The system also needed a live, accurate view of stock on hand at any point, not just a log of transactions.
Process
Role hierarchy design
Defined three roles — Super Admin, Admin, and Staff — each with a distinct permission scope, with Super Admin as the only role authorized to create Admin accounts.
Catalog ownership
Restricted product and category creation/management to Admins only, keeping the master catalog controlled by a single trusted tier rather than open to all users.
Stock flow modules
Built out DC (Delivery Challan) and GRN (Goods Receipt Note) modules to track outgoing and incoming stock, tied to the same role-based permission checks.
Stock balance tracking
Built a stock balance module that computes real-time on-hand quantities per product by netting GRN inflows against DC outflows, giving a single source of truth for current stock levels.
Access enforcement
Implemented role-based route protection in FastAPI so permission checks happen at the API layer, not just conditionally in the frontend.
Design Decisions
Role checks at the API layer
Enforcing permissions in FastAPI middleware/dependencies rather than the frontend ensures the rules can't be bypassed by a direct API call.
Single-tier catalog ownership
Limiting product/category creation to Admins prevents catalog drift and keeps a clear audit trail of who added what.
Derived stock balance over manual entry
Calculating balance from GRN/DC records instead of letting users manually edit stock counts keeps the numbers consistent with the actual transaction history.
Outcome
✦ Enforced a clean three-tier access hierarchy across the system
✦ Centralized product and category control under Admin accountability
✦ Tracked stock movement end-to-end through DC and GRN workflows
✦ Provided real-time, accurate stock balance per product
Reflection
“Good inventory systems aren't just about tracking stock — they're about tracking who's allowed to touch what, and giving everyone a single trustworthy number for what's actually on hand. Getting the role hierarchy and stock balance logic right at the backend level made everything downstream more reliable.”