Business & shops

Build an inventory app with AI

A native inventory build brief covering screens, data, access rules and a practical acceptance journey.

Apirex TeamUpdated AndroidiOS
On this page
  1. Screens
  2. Data model
  3. Native features
  4. Android notes (Kotlin and Jetpack Compose)
  5. iPhone notes (Swift and SwiftUI)
  6. Copy-paste prompt
  7. Acceptance test
  8. Frequently asked questions
5screens
6data tables
147word prompt
2platforms: Android, iOS

A storeroom cannot rely on a quantity that changes only on one phone. This inventory brief makes an auditable movement ledger the source of every balance and requires a real camera scan before selecting a labeled product. The first release should demonstrate one received or issued movement updating stock exactly once, even after a retry, while a second operator sees the same committed result.

Screens

  • Stock overview: Read server-confirmed balances for the authorized stock location.
  • Product detail: Inspect a product, movement history and adjustment reason.
  • Scan: Decode an actual barcode using the phone camera and resolve its product.
  • Low-stock alerts: Inspect threshold breaches derived from committed balances.
  • Sign in: Identify each operator and permitted stock location.

Data model

Inventory records and relationships
TableKey fieldsPurpose
productsid (uuid), sku (text), name (text), unit (text), active (bool)Define stock identity and its agreed counting unit.
barcodescode (text), product_id (uuid), format (text)Map decoded labels to products without confusing a barcode with a quantity.
locationsid (uuid), name (text), active (bool)Bound stock ownership to explicit storage locations.
operator_accessuser_id (uuid), location_id (uuid), role (text)Authorize receivers, issuers and supervisors per location.
stock_movementsid (uuid), request_key (uuid), product_id (uuid), location_id (uuid), delta (numeric), actor_id (uuid), reason (text), created_at (timestamptz)Keep immutable attributable receipts, issues and corrective entries with retry deduplication.
stock_balancesproduct_id (uuid), location_id (uuid), quantity (numeric), threshold (numeric), version (bigint)Maintain a transactionally consistent projection and threshold for each stock position.

Use a backend with row-level security for location-scoped reads and server-authorized movement creation. Execute ledger insertion and balance update in one server transaction with row locking or another deliberate concurrency strategy; reject unauthorized actors, duplicate request keys and disallowed negative results. Do not let clients edit balance rows directly or erase posted ledger entries. Corrections create reversing or compensating movements linked to the original audit history. Ask which roles may adjust stock, whether fractional units are allowed and how long movement evidence must be retained.

Native features

Inventory work benefits from barcode scanning, offline stock-count drafts and a visible record of synchronized adjustments. CameraX on Android or an AVFoundation scanner on iPhone can read a product label after a camera permission request. Always offer manual SKU entry for damaged labels and inaccessible cameras. Room or SwiftData should preserve a count draft separately from the authoritative quantity on hand. A scan identifies a product; it must not automatically add stock unless the operator has explicitly selected a receiving action. Receiving, recounting and transferring are different business events with different audit requirements.

Android notes (Kotlin and Jetpack Compose)

Build the stock view as a LazyColumn keyed by SKU or inventory-record ID, and show warehouse selection in Material 3 controls above the list. Open a ModalBottomSheet after scanning to choose receive, remove or recount, retaining the scanned code while the operator supplies a reason. Use rememberLauncherForActivityResult for camera permission and keep Room count drafts scoped to location and operator. WorkManager may submit idempotent pending adjustments, never repeatedly increment a quantity on retry. On an Android warehouse phone, scan one carton twice, rotate before confirmation, and submit once. Inspect the stock ledger to ensure the intended quantity and one adjustment reference were recorded.

iPhone notes (Swift and SwiftUI)

Use NavigationStack for location, stock List and adjustment detail, with a scanner sheet that also offers typed SKU lookup. SwiftData can store an unfinished stocktake, while .refreshable fetches server quantities and flags drafts based on an older version. Keep adjustment reasons readable with Dynamic Type; a red quantity alone cannot explain why stock changed. Present conflicting recounts for explicit reconciliation rather than averaging them. On an iPhone, begin a count offline while another operator receives new stock at the same location. Reconnect and verify the recount does not silently erase the receipt, then confirm a user without adjustment authority cannot post the draft.

Copy-paste prompt

Build this yourself 145 words · Android
Build an inventory app for Android with Stock overview, Product detail, Scan, Low-stock alerts and Sign in. Ask for locations, operator roles, stock units, negative-stock policy, adjustment reasons and alert thresholds. Model products, barcodes, locations, operator access, immutable stock movements and server-confirmed balances. Scan real printed barcodes through the camera; never substitute generated scan results. Provide manual lookup for denied permission or unsupported scanning. Post each movement through an authorized server transaction that writes the audit entry and balance together, using a unique request key and safe concurrency control. Do not allow direct client balance edits. Include loading, no products, unknown code, offline pending, rejected movement and permission denied. Acceptance must scan a labeled item, record a receipt, reopen to verify the same ledger entry and balance, retry without duplication and reject an unauthorized location change. Demonstrate concurrent issues cannot violate the chosen stock rule.

Opens Apirex with this prompt in the box. Pick the Android · Kotlin tab before you send.

Acceptance test

Also test a corrected issue: post a compensating receipt with its own request key and a reference to the mistaken movement. The original issue must remain visible with its actor, time and reason. An unknown barcode should open a no-match state, never silently create a product or increment stock. Change an operator’s location permission while a movement draft is open and confirm the server rejects submission under the old authority. For low-stock checks, move below the threshold twice through retries and verify any configured alert is based on a distinct committed transition, not on repeated client refreshes.

  1. Create a real product label mapping and assign two operators to one test location, leaving a third account unauthorized.
  2. Scan the printed barcode with a phone camera, enter a receipt of ten units and verify the returned movement ID and balance of ten.
  3. Close and reopen the app, then retry that receipt using the same request key; confirm one ledger entry and an unchanged quantity.
  4. Submit concurrent issues from two devices that would together exceed ten units; verify server serialization enforces the declared negative-stock policy.
  5. Attempt a direct balance edit and an unauthorized location movement, expecting denial; revoke camera permission and verify manual lookup still works without simulated scan success.

Frequently asked questions

Can I fix a mistaken receipt by deleting it?

Preserve the posted audit entry and record an authorized correction with a reason and reference to the original movement. Deleting history destroys the explanation for the current balance.

What if the same barcode appears in many camera frames?

Treat recognition as product selection, not repeated stock movement creation. Require an explicit confirmed movement and deduplicate its request on the server independently of scanner frame handling.

May stock update while the phone is offline?

An offline draft can wait for submission, but it is not confirmed stock. Display pending status and reconcile through the same server transaction when connectivity returns, including rejection if available quantity changed.

Build this blueprint

The blueprint prompt, ready for your platform. Edit anything before you send it.

AndroidKotlin · Jetpack ComposeReal source on your computer

Opens Apirex with this prompt. Pick the Android · Kotlin tab before you send. The Free plan includes 5 Rex Credits a day.