(This is prompt from my upcoming book, here for you NOW!)
Build your own inventory without the need for expensive software. I made mine in Manus. Have the AI read this prompt and make sure it adds in the specifics for your business so it can grow.
THE CONTRACTOR INVENTORY & OPERATIONS HUB - UNIVERSAL AI PROMPT
What this builds: A full-stack inventory management, job scheduling, automated purchasing, and build-tracking web application purpose-built for home service contractors. It connects to your CRM (Jobber), scans your supplier invoices from email (Outlook), auto-creates equipment builds when deals close, tracks payments owed to vendors, and alerts your team when stock runs low. It is best suited for any trade that installs physical equipment or uses materials on job sites - HVAC, plumbing, electrical, water treatment, pool service, solar, landscaping, pest control, or any specialty contractor with a warehouse and field crews.
PROMPT BEGINS HERE - COPY EVERYTHING BELOW THIS LINE
Build me a full-stack inventory and operations management web application for my [YOUR TRADE/INDUSTRY] contracting business. The app should use React + Tailwind CSS on the frontend, Express + tRPC on the backend, and a MySQL database with Drizzle ORM. It needs user authentication with role-based access control. Below is the complete feature specification.
SECTION 1: BUSINESS CONTEXT
I run a [YOUR TRADE/INDUSTRY] company called [YOUR COMPANY NAME] in [YOUR CITY/STATE/REGION]. We install [YOUR PRIMARY EQUIPMENT TYPES - e.g., "water treatment systems," "HVAC units," "solar panels," "pool equipment"]. We have a warehouse where we stock equipment and materials, and field technicians who build/assemble units before installation at client homes.
Our team structure:
Owner/Admin (me): Full access to everything including financials
Install Manager(s): Full admin access, manages builds and inventory
Field Technicians: Can only see their build queue and log stock movements
Our primary CRM is Jobber (we use it for quoting, scheduling, and invoicing).
Our primary equipment supplier is [YOUR MAIN SUPPLIER NAME].
Supplier invoices arrive as PDF attachments to [YOUR EMAIL ADDRESS] via Outlook/Microsoft 365.
Payment terms with our supplier are [YOUR PAYMENT TERMS - e.g., "Net 30"].
SECTION 2: DATABASE SCHEMA
Create the following tables:
USERS TABLE
id, name, email, passwordHash, role (enum: admin, tech), isActive, createdAt, updatedAt, lastSignedIn
Purpose: Role-based access. Admins see everything. Techs see only their assigned work and stock updates.
INVENTORY ITEMS TABLE
id, name, sku, modelCode, category (enum: [LIST YOUR CATEGORIES - e.g., "whole_home_system, ro_system, uv_system, filter, media, parts_fittings, salt, testing, service, other"]), supplier (enum: [LIST YOUR SUPPLIERS - e.g., "supplier_a, supplier_b, in_house, other"]), isMainProduct (boolean - distinguishes major equipment from consumables), description, unitCost (COGS), isPhysicalItem, currentStock, reorderThreshold, reorderQty, unit, reorderStatus (enum: none, needs_order, order_placed), reorderRequestedBy, reorderRequestedAt, isActive, notes, createdAt, updatedAt
Purpose: Single source of truth for everything in your warehouse. The isMainProduct flag separates big-ticket items (systems, tanks, units) from small consumables (fittings, tape, screws) so alerts only fire for what matters.
STOCK MOVEMENTS TABLE
id, itemId (FK to inventory), movementType (enum: arrival, usage, adjustment, return, po_arrival), quantity, previousStock, newStock, notes, referenceId, userId, createdAt
Purpose: Full audit trail of every stock change. You always know who moved what and when.
PURCHASE ORDERS TABLE
id, poNumber, vendor (enum matching suppliers), status (enum: pending, ordered, in_transit, arrived, cancelled), emailId (for deduplication), emailSubject, totalAmount, orderDate, expectedArrival, arrivedAt, notes, invoiceNumber, trackingNumber, trackingCarrier, shippedAt, source (enum: manual, email_auto), invoiceUrl (S3 link to PDF), dueDate, amountPaid, paymentStatus (enum: unpaid, partial, paid), createdAt, updatedAt
Purpose: Tracks every order placed with suppliers. Auto-created from scanned invoice emails or manually entered. Payment tracking shows what you owe and what is overdue.
PO LINE ITEMS TABLE
id, poId (FK), itemName, sku, inventoryItemId (FK to inventory - nullable, matched by AI), quantity, unitPrice, lineTotal, receivedQty
Purpose: Individual items on each purchase order. Links back to inventory so receiving a PO auto-updates stock levels.
JOBS TABLE (synced from CRM)
id, crmId (unique external ID from Jobber/CRM), title, clientName, status (enum: draft, scheduled, in_progress, completed, cancelled), scheduledDate, completedDate, totalValue, address, notes, jobType (enum: installation, annual_service, service, other), syncedAt, createdAt, updatedAt
Purpose: Mirror of your CRM jobs. Used for demand forecasting and equipment allocation.
JOB EQUIPMENT TABLE
id, jobId (FK), inventoryItemId (FK), itemName, qtyRequired, qtyAllocated, allocationStatus (enum: needs_order, on_order, allocated, fulfilled), poLineItemId (FK - links to the PO that is fulfilling this need), isAllocated
Purpose: What equipment each job needs. Drives the "Equipment Needs" page and auto-reorder alerts.
BUILD RECIPES TABLE
id, systemType (unique key like "meridian_10" or "carrier_furnace_3ton"), systemName (display name), description, tankSize/unitSize, isActive, createdAt, updatedAt
Purpose: Templates that define what components go into each system you build. When a deal closes, the system looks up the recipe and knows exactly what to pull from inventory.
BUILD RECIPE COMPONENTS TABLE
id, recipeId (FK), inventoryItemId (FK), itemName, quantity, unit, componentType (enum: media, hardware, tank, valve, accessory - adapt to your trade), notes, sortOrder
Purpose: The bill of materials for each recipe. A [YOUR SYSTEM TYPE] might need 1x condenser, 2x line sets, 1x thermostat, etc.
SYSTEM BUILDS TABLE (the build queue)
id, crmJobId, crmQuoteId, clientName, systemType, systemName, matchedProductName, status (enum: pending, building, built, installed, cancelled), triggeredBy (enum: crm_webhook, manual), notes, scheduledDate, buildStartedAt, builtAt, installedAt, builtBy (FK to user), createdBy, createdAt, updatedAt
Purpose: The live build queue your techs work from. Each row is a unit that needs to be assembled in the warehouse before going to a job site.
BUILD ALLOCATIONS TABLE
id, buildId (FK), inventoryItemId (FK), itemName, quantityAllocated, quantityConsumed, unit, componentType, status (enum: allocated, consumed, returned, substituted), notes, consumedAt, createdAt, updatedAt
Purpose: Tracks which inventory items are reserved for which build. Prevents double-allocation and shows true available stock.
ITEM ORDERS TABLE (On Order tracking)
id, inventoryItemId (FK), quantityOrdered, estimatedArrival, orderedBy (FK to user), orderedAt, notes, supplierName, status (enum: pending, arrived, cancelled), arrivedAt, quantityReceived, resolvedBy, createdAt, updatedAt
Purpose: When you order more stock, this tracks it as "on the way" so your team knows replenishment is coming.
PAYMENT LOGS TABLE
id, poId (FK), vendor, paymentAmount, balanceBefore, balanceAfter, paymentDate, notes, recordedBy (FK to user), createdAt
Purpose: Records every payment you make against supplier invoices. Shows running balance per vendor.
SYNC LOGS TABLE
id, source (enum: crm_sync, outlook_po, manual), event, status (enum: success, error, warning), message, referenceId, createdAt
Purpose: Audit trail for all automated actions so you can troubleshoot when something does not sync correctly.
EMAIL SCAN LOGS TABLE
id, messageId (unique - for deduplication), subject, fromAddress, emailDate, matchedPoId, matchType, actionTaken, trackingNumber, carrier, notes, scannedAt
Purpose: Prevents the same email from being processed twice and shows what the scanner did with each message.
CRM OAUTH TOKENS TABLE
id, accessToken, refreshToken, expiresAt, scope, connectedBy, createdAt, updatedAt
Purpose: Stores the OAuth connection to your CRM so the app can pull jobs and quotes automatically.
APP SETTINGS TABLE
id, key (unique), value, updatedAt
Purpose: Key-value store for feature toggles like enabling/disabling the auto-build pipeline.
SECTION 3: FRONTEND PAGES
Use a dashboard layout with a collapsible sidebar. Dark theme preferred. The sidebar should show different navigation items based on user role.
ADMIN SEES ALL PAGES:
Dashboard (home)
Inventory Catalog
Stock Updates
Purchase Orders
Job Forecast
Equipment Needs
Tank/Unit Builds
Margins (per-job profitability)
Team Members (user management)
TECH ROLE SEES ONLY:
Tank/Unit Builds (their build queue)
Stock Updates (to log arrivals and usage)
Auto-redirect tech users to their build queue if they try to navigate elsewhere.
PAGE DETAILS:
DASHBOARD
KPI cards: Total inventory items, items below reorder threshold (main equipment only, not consumables), pending purchase orders, upcoming jobs this month
Needs Ordering Banner: Shows count of main equipment items flagged for reorder with a "View All" link and a "Bulk Reorder" button (admin only) that sends PO emails to all vendors in one click
Active Builds widget: Shows in-progress builds with status
Auto-Build Pipeline status panel: Shows Active/Paused badge, last scan time, builds created count, "Run Now" button for manual trigger, and enable/disable toggle
CRM Connection banner: If the CRM token is expired, show an amber warning banner with a one-click "Reconnect" button
Recent stock movements feed
INVENTORY CATALOG
Main equipment displayed as cards (large, prominent)
Consumables/parts in a condensed table
Search and filter by category, supplier, stock status
Stock level badges (In Stock / Low / Out of Stock)
"Mark as Ordered" button with a date picker so you can record when the order was placed
Inline stock editing
Add new product form
CSV import
Product detail drawer with preferred supplier dropdown
STOCK UPDATES
Log arrival, usage, adjustment, and return forms
Movement history table with filters
Mobile-optimized for warehouse use
PURCHASE ORDERS
PO list table with columns: PO#, Vendor, Status, Total, Payment Status badge (Paid/Partial/Unpaid), Due Date (with red overdue flag + warning icon if past due)
PO detail sheet showing line items, invoice PDF link, due date, payment status, and "Record Payment" button
Record Payment dialog: amount, date, notes - updates amountPaid and paymentStatus on the PO
Edit and Delete PO capabilities
Manual PO creation form
"Scan Inbox" button to trigger email scanning on demand
JOB FORECAST
Synced jobs from CRM with date range filter (This Week / Next Week / This Month / This Year)
Per-job equipment allocation view
Revenue pipeline value (dynamic based on filter)
"Sync from CRM" button
AI-powered equipment suggestion (LLM reads job title and suggests what equipment is needed)
Job type classification: installation vs service vs annual maintenance
EQUIPMENT NEEDS
Shows only installation jobs with unmet equipment needs
Grouped by job: client name, scheduled date, items short, allocation status
One-click "Create PO" from any flagged item
Annual Services tab showing upcoming maintenance visits with standard service kits
TANK/UNIT BUILDS (adapt name to your trade - "Unit Builds," "System Assembly," etc.)
Build queue showing all pending, building, and recently completed builds
Status workflow: Pending → Building → Built → Installed
Each build shows: client name, system type, scheduled date, all allocated components
Techs can advance status (start build, confirm built, mark installed)
Admins can create new builds manually and cancel builds
"New Build" floating action button
MARGINS (Per-Job Profitability)
Only shows completed builds (status = built or installed)
KPI cards: Total Revenue, Total Equipment COGS, Total Margin, Avg Margin %
Bar chart: Margin % by system/product type
Sortable table: Every completed build with client, system, date, revenue (from CRM job), COGS (from build recipe), margin $, margin %
Month filter (3/6/12/24 months)
Builds without linked CRM revenue show "No CRM data" badge
TEAM MEMBERS
User list with name, email, role, last active, status
Create new user (email + password, no external OAuth needed for team)
Edit role (admin/tech)
Deactivate/reactivate users
SECTION 4: AUTOMATION - CRM QUOTE-APPROVED AUTO-BUILD PIPELINE
This is the core automation. When a quote is approved in the CRM (meaning the client said yes to the deal), the system should automatically create a build in the queue and allocate all required components from inventory. No human intervention needed.
HOW IT WORKS:
Every hour, the server polls the CRM API for quotes in "Approved" status
For each approved quote, it reads the line items and matches product names to build recipes using keyword matching (e.g., line item contains "[YOUR PRODUCT NAME]" → maps to the "[YOUR PRODUCT TYPE]" recipe)
It skips optional line items that the client did NOT select (only processes items where optional=false OR optional=true AND client accepted it)
It creates a build record tagged with the quote ID for traceability
It pulls the recipe components and allocates them from inventory (deducting from available stock)
It deduplicates: if a build already exists for this quote ID, it skips
After allocation, it checks all affected inventory items against their reorder thresholds
If anything is at or below threshold, it emails ALL admin users with item name, current qty, and threshold
It also sends an email to all admins listing the new builds that were just created
KEYWORD MATCHING RULES (customize these for your products):
[LIST YOUR PRODUCTS AND THEIR KEYWORDS - e.g.:]
If line item contains "[PRODUCT KEYWORD 1]" → create [SYSTEM TYPE 1] build
If line item contains "[PRODUCT KEYWORD 2]" → create [SYSTEM TYPE 2] build
If line item contains "[PRODUCT KEYWORD 3]" + "[SIZE VARIANT]" → create [SYSTEM TYPE 3 VARIANT] build
(Add as many as you need for your full product catalog)
DASHBOARD CONTROLS:
Active/Paused toggle (stored in app_settings table)
"Run Now" button for manual trigger
Last scan timestamp and count of builds created
SECTION 5: AUTOMATION - SUPPLIER INVOICE EMAIL SCANNER
The system should scan your Outlook inbox for invoice emails from your supplier, download the PDF attachment, extract line items using an LLM, and auto-create purchase orders with payment tracking.
HOW IT WORKS:
Every 30 minutes, the server uses Microsoft Graph API to search your inbox for emails from [YOUR SUPPLIER EMAIL DOMAIN - e.g., "@preferredpump.com"] For each new invoice email (deduplicated by email message ID):
a. Downloads the PDF attachment
b. Uploads the PDF to S3 storage for permanent access
c. Sends the PDF content to an LLM with a structured extraction prompt asking for: invoice number, invoice date, line items (name, quantity, unit price, total), and grand total
d. Creates a Purchase Order record with status "ordered", the extracted invoice number, total amount, and due date (invoice date + [YOUR PAYMENT TERMS] days)
e. Creates PO line items and attempts to match each one to an existing inventory item using fuzzy name matching
f. For matched items, creates "On Order" records so they show as en route in the inventory
g. Sends a notification to all admin users that a new invoice was processed
MATCHING LOGIC:
The LLM extracts item names from the PDF. The system then tries to match each extracted name to your inventory catalog using case-insensitive substring matching and common abbreviation handling. Unmatched items are still recorded on the PO but flagged for manual review.
SECTION 6: AUTOMATION - LOW STOCK NOTIFICATIONS
After every auto-build allocation AND after every manual stock adjustment, check all inventory items against their reorder thresholds. For any item where currentStock <= reorderThreshold:
Send an email to ALL users with admin role
Email includes: item name, current quantity, threshold, and a direct link to the inventory page
Also fire an in-app notification to the business owner
Only alert on main equipment items (isMainProduct = true), not consumables/parts
SECTION 7: BULK REORDER
The Dashboard should have a "Bulk Reorder All" button (admin only, with a confirmation step) that:
Fetches all inventory items with reorderStatus = "needs_order"
Groups them by preferred supplier/vendor
Sends one consolidated PO email per vendor listing all items needed with quantities
Auto-marks all items as "order_placed"
Shows a summary toast: "X items sent to Y vendors"
SECTION 8: CRM INTEGRATION (JOBBER)
Connect to Jobber via OAuth2 and their GraphQL API:
OAuth flow with stored refresh tokens (auto-refresh before expiry)
Hourly job sync: pull all scheduled/in-progress jobs and upsert into the jobs table
Quote sync: pull approved quotes for the auto-build pipeline
Job type auto-classification based on title keywords (e.g., "install" → installation, "annual" or "maintenance" → annual_service, "repair" or "service call" → service)
Connection status indicator on the dashboard
If token expires: show amber banner with one-click reconnect button
SECTION 9: PAYMENT TRACKING
Every purchase order should track:
Due date (order date + payment terms)
Amount paid (running total from payment logs)
Payment status: Unpaid (nothing paid), Partial (some paid, balance remaining), Paid (fully settled)
Visual indicators: Overdue invoices (past due date + unpaid/partial) show red highlight and warning icon in the PO list
"Record Payment" button on every PO detail view:
Form: amount, payment date, notes
On submit: creates payment log entry, updates amountPaid on PO, recalculates paymentStatus
If amountPaid >= totalAmount → status = paid
If amountPaid > 0 but < totalAmount → status = partial
If amountPaid = 0 → status = unpaid
SECTION 10: PER-JOB MARGIN TRACKING
The Margins page calculates profitability per completed build:
Revenue: pulled from the linked CRM job's totalValue
COGS: sum of (unitCost × quantity) for all components in the build recipe
Margin: Revenue - COGS
Margin %: (Margin / Revenue) × 100
Only show builds with status "built" or "installed" (pending builds have not consumed inventory yet, so margin data would be misleading).
SECTION 11: ROLE-BASED ACCESS CONTROL
ADMIN ROLE:
Full access to all pages and all data
Can create/edit/delete inventory items, POs, builds, users
Can see financial data (margins, COGS, revenue, payment status)
Receives all automated notifications (low stock, new builds, new invoices)
TECH ROLE:
Can only see: Build Queue + Stock Updates
Can advance build status (start, confirm, mark installed) - this is their core job
Can log stock movements (arrivals, usage)
Cannot see: Dashboard financials, Margins, Purchase Orders, Payment History, Team Members
Auto-redirected to build queue if they navigate to a restricted page
Cannot create new builds or cancel builds (admin only)
SECTION 12: BUILD RECIPES (BILL OF MATERIALS)
Seed the database with your standard build recipes. Each recipe defines exactly what components are needed to assemble one unit of that system type.
[LIST YOUR RECIPES - example format:]
RECIPE: [SYSTEM NAME 1] (systemType: "[system_type_key]")
1x [Component A] (type: tank/unit)
1x [Component B] (type: hardware)
2x [Component C] (type: accessory)
lbs [Component D] (type: media/material)
RECIPE: [SYSTEM NAME 2] (systemType: "[system_type_key]")
1x [Component A] (type: tank/unit)
1x [Component B] (type: hardware)
1x [Component C] (type: valve)
(Repeat for every standard system/product you install. Include exact quantities and units.)
SECTION 13: TECHNICAL REQUIREMENTS
All timestamps stored as UTC. Frontend converts to user's local timezone for display.
All financial amounts stored as decimal(10,2) - never floating point.
File uploads (invoice PDFs) go to S3 storage, not the database.
Email sending via Resend (transactional email service) for notifications and PO emails.
Microsoft Graph API for Outlook inbox scanning (OAuth2 with tenant credentials).
LLM integration for PDF line item extraction (structured JSON output with invoice number, date, line items, totals).
All automated scans must be idempotent - running the same scan twice should never create duplicate records.
The app should work as a PWA (Progressive Web App) so techs can add it to their phone home screen.
Mobile-responsive design throughout - warehouse staff will use this on phones and tablets.
SECTION 14: NOTIFICATION BEHAVIOR
LOW STOCK ALERT:
Trigger: any inventory item drops to or below its reorderThreshold
Recipients: all users with admin role
Channel: email (via Resend)
Content: item name, current qty, threshold, link to inventory
Frequency: once per trigger event (not repeated until stock changes again)
NEW AUTO-BUILD CREATED:
Trigger: the quote auto-sync creates one or more new builds
Recipients: all users with admin role
Channel: email
Content: list of builds created (client name, system type, quote ID)
NEW INVOICE PROCESSED:
Trigger: email scanner processes a new supplier invoice
Recipients: all users with admin role
Channel: email
Content: invoice number, total amount, due date, number of line items matched to inventory
CRM DISCONNECTED:
Trigger: CRM API returns 401 (token expired)
Display: amber banner on Dashboard with "Reconnect [CRM]" button
No email - this is a visual-only alert since it requires manual OAuth re-auth
SECTION 15: SEED DATA
Seed the inventory catalog with my current products. Here is my product list:
[PASTE YOUR PRODUCT CATALOG HERE - include: name, category, supplier, unit cost (COGS), current stock level, reorder threshold, and whether it is a main product or consumable]
COMMON CUSTOMIZATIONS
After the initial build, here are common modifications you might want. Ask the AI for any of these:
Change your CRM - "Replace the Jobber integration with [ServiceTitan / Housecall Pro / FieldPulse / etc.]. Use their API to sync jobs and quotes instead."
Change your email provider - "Replace Outlook/Microsoft Graph with Gmail/Google Workspace for the invoice email scanner."
Add a second supplier - "Add [SUPPLIER NAME] as a vendor option. Their invoices come from [EMAIL DOMAIN] and have [PAYMENT TERMS] terms. Add them to the email scanner and bulk reorder routing."
Add barcode scanning - "Add a barcode/QR code scanner to the Stock Updates page so techs can scan items instead of searching by name."
Add a client-facing portal - "Add a page where clients can see their installation status (build in progress, ready for install, installed) without seeing any pricing or internal data."
Change notification channels - "Send low-stock alerts to a Discord channel webhook instead of (or in addition to) email."
Add photo documentation - "Let techs upload photos of completed builds from the Tank Builds page. Store in S3 and display in a gallery on the build detail view."
Add recurring service kit tracking - "For annual maintenance visits, auto-deduct a standard service kit (e.g., 2x filters + 4 bags salt) from inventory when the service job is marked complete in the CRM."
Add vendor price history - "Track unit cost changes over time for each inventory item. Show a price trend chart on the item detail page so I can see if my supplier is raising prices."
Add multi-location support - "I have two warehouses. Add a 'location' field to inventory items and let me track stock separately per location, with transfer capabilities between them."
END OF PROMPT