Pallethaven: inventory and purchase orders for a small retailer

Pallethaven: inventory and purchase orders for a small retailer

00 Markdown

Stock levels with low-stock flags and movement history, purchase orders emailed to suppliers and received line by line, all live.

Agent specs

Agent
Claude Code, Opus 5.5 Medium
Time
19 min
Cost
$7.71*

Agents work faster and more accurately on Elements.

* Cost at API rates, September 2026.

Run it yourself

Paste this prompt into your AI agent. You get the finished app on your own machine, ready to change however you like.

Agent Chat
Install elements:
curl -fsSL 'https://install.elements.dev?os=darwin' | sh && export PATH=~/elements/bin:$PATH

Create an Elements app from the elementscode/demo-pallethaven scaffold:
cd ~/elements/projects
elements create pallethaven -scaffold=elementscode/demo-pallethaven
cd pallethaven

Start the app.

Need an AI agent?

In AI desktop apps, paste into the Code tab, not the general chat.

How it's built

Pallethaven needed stock counts that change as people work, a history behind every number, purchase orders sent to suppliers by email, receiving line by line and a morning list of what to reorder. Each of those is a part of Elements, so the agent spent its 19 minutes on the shop itself.

What Elements gave the app

  • Live stock and orders. Products, stock movements, purchase orders and their lines are LiveTables. When a delivery is received, the stock list, the product's history and the order's status update on every open screen.
  • A history behind every number. Every change to a count goes through one function that adjusts the stock and records why: a count, damage, a sale or a receipt against a purchase order.
  • Purchase orders by email. Sending an order marks it sent and queues a job in the same transaction, so the supplier's email goes out once the order is saved as sent. Staff then receive it line by line, and the order moves to partly or fully received.
  • A morning digest. A one-line cron schedule runs a job at 7am that emails each manager the products at or under their reorder point.
  • Server calls as function calls. Creating orders, adding lines, receiving stock and editing products call server functions straight from the page with @rpc.
  • Data and roles from SQL. Migrations define the shop and seed two logins, three suppliers, forty products and four orders, one in each status. Sessions and roles let staff count and receive stock and give managers the orders and product edits.

What the project server gave the agent

The project server runs alongside the agent and answers as soon as a file is saved: it type-checks the templates, TypeScript and SQL, applies migrations and reruns the tests, so every question came back right away and the agent kept building.

What shipped

The app type-checks with zero errors and all 33 tests pass. Every page works on desktop and phone.

The code

Build it from scratch

To watch your agent build this app from an empty project, use the prompt we used instead. It takes longer than starting from the finished app above.

Agent Chat
Install elements:
curl -fsSL 'https://install.elements.dev?os=darwin' | sh && export PATH=~/elements/bin:$PATH

Create an Elements app:
cd ~/elements/projects
elements create pallethaven
cd pallethaven

Start the app, then build this:

Build an inventory and purchasing app named pallethaven for a small retail
business with one warehouse.

Two kinds of accounts: manager and staff.

- Products: SKU, name, supplier, cost, on-hand quantity, reorder point.
- Stock list with search, and a "low stock" filter for anything at or under
  its reorder point.
- Adjust stock with a reason (count, damage, sale). Every change is kept in a
  movement history per product.
- Suppliers with contact email.
- Purchase orders: a manager builds a PO for one supplier from low-stock
  products, sends it (emails the supplier a summary), and staff receive it
  line by line, which adds to on-hand quantity. PO status: draft, sent,
  partially received, received.
- Every morning at 7am, email managers the list of low-stock products.

Seed one manager, one staff member, three suppliers, forty products (some
below reorder point), and four POs across statuses. Show the seeded logins on
the sign-in page.

Stock levels and PO status update in real time.

The weekly digest

New lessons, demos and posts from elements.dev, in one email a week.

Comments· 0