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 ↗

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.

Receive the order
Collect every product and requested quantity before stock changes.
Validate every line
Check the product, quantity, and current available stock.
Reserve together
Use one immediate transaction to reserve every valid line.
If any line fails, the transaction rolls back and no quantity changes.
Show reserved state
Display on-hand, reserved, and available quantities together.
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.
Atomic reservation service
I implemented the domain workflow that validates every line and reserves the complete order inside one SQLite transaction.
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.
Lifecycle rules
I encoded fulfilment, cancellation, restocking, and invalid repeat transitions so stock cannot be mutated twice by the same order action.
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.
