Inventory

Stock is never edited in place: a stock level is the sum of movements, each one a receipt, a sale, a transfer or an adjustment with a reason. Variants carry the SKU, the barcode and the price; the product holds what the variants share. Purchase orders bring stock in from a supplier and are received line by line.

Start a project from this schema
$ npx vela create my-app --schema inventory
users auth
  • id* text
  • password* password
  • tokenKey* text
  • email* email
  • emailVisibility bool
  • verified bool
  • name text
  • avatar file
  • created autodate
  • updated autodate
categories
  • id* text
  • name* text
  • parent categories
  • sort number
  • created autodate
  • updated autodate
suppliers
  • id* text
  • name* text
  • contact_name text
  • email email
  • phone text
  • address text
  • lead_time_days number
  • notes text
  • created autodate
  • updated autodate
products
  • id* text
  • name* text
  • description text
  • category categories
  • default_supplier suppliers
  • images file[]
  • active bool
  • created autodate
  • updated autodate
variants
  • id* text
  • product* products
  • sku* text
  • barcode text
  • name* text
  • attributes json
  • cost number
  • price* number
  • reorder_point number
  • active bool
  • created autodate
  • updated autodate
locations
  • id* text
  • name* text
  • address text
  • kind select
  • active bool
  • created autodate
  • updated autodate
stock_levels
  • id* text
  • variant* variants
  • location* locations
  • on_hand* number
  • reserved number
  • created autodate
  • updated autodate
stock_movements
  • id* text
  • variant* variants
  • location* locations
  • quantity* number
  • kind* select
  • reference text
  • reason text
  • recorded_by users
  • created autodate
  • updated autodate
purchase_orders
  • id* text
  • number* text
  • supplier* suppliers
  • location* locations
  • status* select
  • expected_on date
  • notes text
  • created autodate
  • updated autodate
purchase_order_lines
  • id* text
  • purchase_order* purchase_orders
  • variant* variants
  • quantity* number
  • received number
  • unit_cost number
  • created autodate
  • updated autodate

Every collection, field and relation above becomes a PocketBase migration in the new project. Change any of it afterwards with vela generate migration --ai, which opens this same diagram as an editor.