Stocklane is a small inventory and order-reservation app for a stockroom. It keeps the important calculation visible:
available stock = on-hand stock − reserved stock
This prevents two orders from promising the same item.
- The user sees current on-hand, reserved, and available quantities.
- They choose items and review the order before reserving stock.
- A SQLite transaction checks every quantity and reserves the whole order or none of it.
- Fulfilling an order removes the reserved units from on-hand stock.
- Cancelling an order releases the units so they become available again.
The app also supports adding and restocking products. It intentionally leaves out accounts, payments, shipping, suppliers, and other production features so the inventory logic stays easy to read and explain.
- Next.js, React, and TypeScript
- SQLite through Node's built-in
node:sqlite - Zod for form validation
- Vitest and Playwright for the core reservation flow
Requires Node.js 24.
npm ci
npm run db:reset
npm run devOpen http://localhost:3000.
npm run db:reset # restore the demo inventory
npm test # run the logic tests
npm run verify # lint, type-check, test, and build
npm run test:e2e # run the browser flowThe most important code is in lib/domain/service.ts: createOrder reserves stock in one transaction, while completeOrder and cancelOrder apply the two possible outcomes.