Designing a quoting and invoicing app for a solo tradesman
invoicingquotespricebookdata-modelsmall-businessplumbing
Lessons from building plumb, a self-built (no SaaS) quote, invoice and receipt tool for an owner-operator plumber, first as a PHP web app and then as a local-first Flutter Android app. The core idea: the plumber dictates what he did (on the drive home, or in the customer's driveway), and gets draft quotes and invoices, a materials list and follow-ups to review. The data model and safety rules below apply to any trade paperwork tool.
Rules that make drafted paperwork safe to send
- Prices come only from the owner's own pricebook. Neither AI nor fuzzy matching ever invents a selling price. Anything not in the pricebook is stored unpriced and flagged.
- Nothing flagged reaches a customer. A document with open flags cannot be marked sent, and drafts are not viewable through the customer link.
- Nothing flagged changes the owner's numbers. A receipt read with problems never updates "last price paid" costs until confirmed.
- Legal wording comes from fixed templates, never generated text (license numbers, required notices; see Where a solo plumber's time goes (software opportunity research)).
Data model
- Money is integer cents. Tax is stored as basis points (
tax_rate_bp), snapshotted onto each document so a later rate change does not rewrite old invoices; tax = sum of taxable line totals x basis points. docs: type (quote or invoice), human number (Q-0001,INV-0001, from per-type sequences in settings), status (draft,sent,accepted,paid,void), an unguessable public token, and the debrief it came from. Quote-to-invoice conversion copies lines.doc_lines:unit_price_centsNULL means unpriced; aflagtext column holds the reason.pricebook: name, aliases, price, pluscost_cents/cost_at(last price paid, fed from receipts). Aliases are what spoken or abbreviated names match against.receipts+receipt_lines: vendor, date, tax, total, photo file, flag, optional link to a job.todos: kindmaterial,followuporunclear, generated alongside drafts.debriefs: the raw transcript, saved before any processing.
Workflow features that mattered
- A "chase list" of unanswered quotes and unpaid invoices on the home screen.
- Offline capture: a debrief that cannot be sent is queued (localStorage in the web app) and flushed on reconnect; the Android app avoids the problem by being fully local.
- Documents leave as PDFs (Android share sheet) or as a tokenized web link with a print view.
- A pricebook wish heard from real plumbers: "adjust my entire price book by just changing my hourly rate", which argues for storing labor as hours x rate rather than flat prices.
Web app security basics used
Session cookie (30 days, HttpOnly, SameSite=Lax, Secure when X-Forwarded-Proto is https), a
custom X-Plumb: 1 header required on every POST as a cheap CSRF guard (cross-site forms cannot
set custom headers), login throttling after 5 wrong passwords for 15 minutes, and a one-time
setup code required to create the first password on a fresh deployment. A separate developer
sign-in (its own hash in server config, never becoming the owner password) allows debugging
before the owner has an account; remember it shares the live database.
Product lessons
- The person asked for "build, don't buy": recurring subscriptions were the thing to avoid, while usage-metered building blocks (API calls, card fees, SMS) were acceptable.
- Local-first native beat the web app for a phone-in-the-truck user: no login, works without signal, and the app does not depend on a server staying up.
- Unverified until a real user tries it: real speech accuracy with trade terms, camera capture, and whether the drive-home debrief habit sticks.
See also
- Offline voice dictation with fuzzy matching against a catalog
- Structured JSON output from Claude with the Anthropic PHP SDK
- Where a solo plumber's time goes (software opportunity research)