Modelling polymorphic sources
Orders can originate from the production house or an associate company. Mongoose dynamic refPath references let one Order schema point at either collection cleanly instead of duplicating models.
Case study · 2025 · Live in production
An inventory management system running a wooden-pallet manufacturer's ₹4 crore stock — my first freelance delivery, still live in production.
Role
Freelance fullstack engineer
Type
Client project · Inventory management
Year
2025

Inventory dashboard — stock, parties, and live balances
Overview
Shanvi Enterprise manufactures wooden pallets and industrial packing in Morbi. Their inventory — films, angle boards, caps, thermocol, seventeen distinct raw materials — was tracked on paper while roughly ₹4 crore of stock moved through factories and party accounts.
As my first freelance client, I handled the complete lifecycle: requirements, data modelling, the MERN build, PDF/Excel reporting, deployment to a self-managed Ubuntu VPS, and the handover docs their team still uses.
₹4Cr
Stock tracked in production
17
Raw material types
12K+
Lines of code
2
Apps — IMS + public site
Every order and bill changed the stock of multiple materials at once, across parties, factories, and pallet sizes. On paper, a single missed entry meant hours of reconciliation — and nobody could answer 'how much film do we actually have?' without walking the warehouse.
The client needed one source of truth their staff could operate daily: record an order, and the inventory, the party ledger, and the reports all update together — correctly, every time.
A production inventory platform plus a public marketing site, organised around the workflows the staff already knew:
Material-level stock per production house, auto-adjusted by every order and bill
Stock-out orders and stock-in bills with line items, soft-delete with inventory restore
Parties, their factories, associate companies, pallet sizes — full CRUD with detail pages
jsPDF invoices, SheetJS Excel exports, filtered order reports
Dashboard charts and pallet net-balance stats via MongoDB aggregation
Order writes and inventory adjustments run inside MongoDB multi-document transactions — the order and its stock changes commit or roll back together.
Staff reference orders by numbers like ORD-0042, generated atomically from a counter collection so two simultaneous orders can never collide.
Filter by party, factory, source, or date range; look an order up by its custom ID; paginate through years of history.
Theme toggle, framer-motion transitions, and a UI the client's non-technical staff picked up in a day.
Orders can originate from the production house or an associate company. Mongoose dynamic refPath references let one Order schema point at either collection cleanly instead of duplicating models.
Two staff members saving orders at the same moment must not corrupt counts. Atomic $inc updates inside sessions, plus an atomic counter for sequential IDs, made writes safe under concurrency.
No platform-as-a-service — I provisioned the Hostinger VPS, wrote the Dockerfile and compose config, set up Nginx and PM2, and documented the runbook for handover.
The system has run the client's daily operations since launch, tracking stock worth about ₹4 crore. Orders, bills, and reports that took hours on paper are now minutes of data entry.
As a first freelance project it set the template for everything after: scope honestly, model the client's real world, and own the delivery all the way to the server.
What's next