HIMANSHU.KUMAR

Inventory management application

Stocklane

An inventory app that prevents two orders from claiming the same stock.

Role
Software engineering · web application
Date
Jan 2026
Stack
Next.js · React · TypeScript · SQLite · Zod
Links
Repository ↗
Stocklane inventory screen showing on-hand, reserved, and available quantities with clear low-stock and unavailable states.
Working Stocklane screen showing on-hand, reserved, available, low-stock, and unavailable states.

Case in one minute

Problem
Competing orders can promise the same final units
Solution
Reserve the complete order inside one transaction
What I built
Interface, domain rules, SQLite workflow, and tests
Result
Every order reserves completely or changes nothing

01 / Problem

Problem

Two orders can race for the final units, creating an oversell or a half-reserved order.

Updating inventory row by row is unsafe: one line can succeed before another fails, leaving the system out of sync with what the order actually promised.

02 / Solution

Solution

Validate every line first, then reserve the complete order inside one immediate SQLite transaction.

The same domain service drives browser and JSON flows. Fulfilment consumes reserved stock; cancellation releases it back to available inventory.

03 / How it works

How it works

The complete path from input to a finished, inspectable result.

Stocklane workflow
Stocklane atomic inventory reservation workflow showing order receipt, line validation, one transaction, reserved inventory, fulfil or cancellation, and rollback when any line fails.
  1. Receive the order

    Collect every product and requested quantity before stock changes.

  2. Validate every line

    Check the product, quantity, and current available stock.

  3. Reserve together

    Use one immediate transaction to reserve every valid line.

    If any line fails, the transaction rolls back and no quantity changes.

  4. Show reserved state

    Display on-hand, reserved, and available quantities together.

  5. Fulfil or cancel

    Fulfilment consumes units; cancellation releases the reservation.

04 / What I built

What I built

The concrete parts I designed, implemented, and tested.

  1. Atomic reservation service

    I implemented the domain workflow that validates every line and reserves the complete order inside one SQLite transaction.

  2. Inventory and order interface

    I built the screens and forms that show on-hand, reserved, and available stock, then explain each order state before an action is taken.

  3. Lifecycle rules

    I encoded fulfilment, cancellation, restocking, and invalid repeat transitions so stock cannot be mutated twice by the same order action.

  4. Regression coverage

    I added integration and browser tests for rollback, final-unit competition, fulfilment, cancellation, and the visible reservation lifecycle.

05 / Results

Results

What the finished system demonstrates through working behavior, tests, and project artifacts.

  • Integration tests cover rollback when one line is short.
  • Last-unit tests protect against concurrent overselling.
  • Transition tests cover reservation, fulfilment, cancellation, and invalid repeats.
  • A Playwright flow verifies the visible reservation lifecycle in the browser.
Stocklane order result showing two units reserved and the available quantity updated before fulfilment.
The order view makes the reserved state and its next valid actions visible before stock is consumed or released.