Skip to content

Repository files navigation

Stocklane

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.

Main flow

  1. The user sees current on-hand, reserved, and available quantities.
  2. They choose items and review the order before reserving stock.
  3. A SQLite transaction checks every quantity and reserves the whole order or none of it.
  4. Fulfilling an order removes the reserved units from on-hand stock.
  5. 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.

Tech

  • 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

Run locally

Requires Node.js 24.

npm ci
npm run db:reset
npm run dev

Open http://localhost:3000.

Useful commands

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 flow

The most important code is in lib/domain/service.ts: createOrder reserves stock in one transaction, while completeOrder and cancelOrder apply the two possible outcomes.

About

Inventory and order reservation app with atomic SQLite stock handling.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages