E
Empower Platform · Architecture · Planning

Data Specification
& Plan

The data model and build plan for a multi-tenant, resellable HVAC platform: tenancy & roles, recovery, the entity model, QuickBooks & payment terms, device fleet, auth & privacy, notifications & consent, tax, compliance records, the lead pipeline, reporting, file storage, testing, and phasing.

Draft v0.3.2 · datastore locked: Supabase + Cloudflare R2 · for review

Contents

  1. Principles
  2. Tenancy & identity
  3. Roles & permissions
  4. Recovery & audit
  5. Entity model
  6. QuickBooks, terms & money
  7. Auth, privacy & retention
  8. Device fleet
  9. Notifications & consent
  10. Tax
  11. Compliance records
  12. Lead pipeline
  13. File & media storage
  14. Reporting
  15. Offline & sync
  16. Datastore: build vs. buy
  17. Testing & environments
  18. Phasing
  19. Open decisions

01Principles

Decisions already made (council + owner) that the whole model serves.

02Tenancy & identity

Four levels. Every record below the platform carries a corporation_id (and, where it applies, a site_id) — the isolation key the whole system enforces.

Super-Admin — the software provider platform / vendor · cross-tenant · NOT a customer role Corporation — the customer (Corp Admin) the customer's ceiling · all sites, seats, devices, billing, QBO Site (Site Admin) Site (Site Admin) Site (Site Admin) Users / seats — office/dispatch · bookkeeper · field tech

Isolation rule: a query for one corporation can never return another corporation's rows — enforced at the datastore layer (row-level security on corporation_id), not just in app code. The only actor crossing the corporation boundary is the Super-Admin (the provider), and every such access is audited. Isolation model (confirmed Jun 2026): all tenants share one Postgres database, isolated by RLS on corporation_id — startup and year-1 cost match every other model (~$300/yr) and stay flat as tenants are added; schema-per-tenant adds ops overhead for no saving, and physical project-per-tenant (the only model that costs more) is reserved for a future customer whose compliance contract demands and funds it.

Shared vs. isolated within a corporation: operations are isolated per site; reference data and reporting are shared at the corporation.

Seats: each User holds Membership rows (corporation/site + role). Active memberships = billable seats, metered per corporation.

03Roles & permissions

Six roles. Super-Admin is the provider (not a customer). Corp Admin is the customer's top role, corp-wide. Site Admin runs one site only.

CapabilitySuper-Admin
(provider)
Corp AdminSite AdminOfficeTechBookkeeper
Cross-corporation access / impersonate
Manage seats, billing, devices, QBO connection✓ all✓ own corp
Create / manage sitesown site
Manage users & roles✓ corpsite
Catalog & vendor pricingrequest
Inventory: receive / adjust / transferuse on job
Run jobs (Evaluator / Sidekick)
Schedule / dispatch · leadsown only
Invoices & QuickBookssitecreate
Restore / revert / audit✓ cross-tenantown corp
Reporting scopeplatformcorp roll-upown sitelimitedownfinancial
✓ = full · orange = scoped/limited · — = none. Empower launches with the owner as Corp Admin (also acting Site Admin); the rest switch on without schema changes.

04Recovery & audit

Recovery is split by who broke it and who fixes it.

Why it matters for resale: the recovery layer lets the provider rescue a customer who broke their own data — the most common support call — without a database restore or data loss.

05Entity model

Grouped by domain. Scope: Platform Corp Site Device/local. Every Corp/Site entity implicitly carries corporation_id, soft-delete and audit fields.

Identity, tenancy & devices

EntityScopeKey fields
CorporationPlatformname, legalName, status, plan, qboConnectionId, cardSurchargePolicy (absorb | surcharge%, state-capped), priceBookId, mfaPolicy
SiteCorpcorporationId, name, address, phone, license, timezone
UserPlatformemail, name, authId, status, mfaEnrolled
Membership (seat)CorpuserId, corporationId, siteId?, role, active (billable)
DeviceCorpcorporationId, assignedSiteId, assignedUserId, name/assetTag, corporationOwned (bool), status (active/lost/retired), trackingEligible, trustedForMfa, appPin
AuditEventCorpactorUserId, role, siteId?, action, entity, before, after, impersonated, at

Catalog & vendors Corp-shared

EntityKey fields
Item (part/material)sku, name, category, type, unit, defaultCost, defaultPrice, manufacturer, mpn
Service / price-book entryname, flatPrice?, laborHours?, linkedItems[], taxCategory
Vendor / VendorPricevendor: name, contact, terms · price: vendorId, itemId, cost, leadTimeDays

Inventory (Quartermaster) Site-scoped

EntityKey fields
StockLocationsiteId, kind (shop / warehouse / truck), name, assignedUserId? (truck)
StockLevellocationId, itemId, qtyOnHand, qtyReserved
StockTxntype (receive/use/transfer/adjust/return), itemId, from/toLocationId, qty, jobId?, userId, at
ReorderRule · PurchaseOrder/POLinemin/reorder levels · vendorId, siteId, status, lines, receivedAt

Customers & work

EntityScopeKey fields
CustomerCorpname, contacts[], billingAddress, parentCustomerId? (PM sub-customers), customerType, defaultTerms, taxStatus, poRequired, notToExceed, depositRule, qboCustomerId, deletable PII flag
PropertyCorpaddress, equipment[] — survives PII deletion; re-associates to next owner
JobSite / local firstsiteId, customerId, propertyId, type, techId, status, components[], readings, photos, safety
Proposal / Agreement (Evaluator)SitejobId, recommendation, pricing, signedAt
RepairRecord (Sidekick)SitejobId, diagnosis, partsUsed[→StockTxn], serviceCharge, repairTotal, signOff
ServiceAgreementCorpcustomerId, plan, cadence, includedVisits, price, autoRenew (default on), renewalNoticeAt, nextVisitDue
WarrantyRecordCorppropertyId, equipmentId, kind (equipment/labor), start, end, terms — retained
CallbackSiteoriginalJobId, returnJobId, reason — quality metric

Scheduling & time Site-scoped

EntityKey fields
AppointmentsiteId, customerId, propertyId, jobId?, window, type, status
AssignmentappointmentId, techUserId, status (offered/accepted/en-route/onsite/done)
TimeEntryjobId, userId, clockIn, clockOut, gpsStampIn/Out, geofenceArrival? — feeds payroll & job costing
LocationBreadcrumbuserId, deviceId, points[], shift — company-owned devices only, on-shift, short retention, opt-in

Money Corp (mirrors QuickBooks)

EntityKey fields
InvoicesiteId, customerId, jobId, lines[], terms, poNumber?, depositApplied?, taxAmount (from tax service), surchargeLine? (credit, disclosed), total, status (draft/sent/paid/overdue), qboInvoiceId
Deposit / retainercustomerId, amount, status (held/applied/refunded), qboDepositItemId — netted on final invoice
Payment (read-back)invoiceId, amount, method, paidAt, qboPaymentId — from QuickBooks confirmation, not in-app
QuickBooksConnection · SyncLogper corp: realmId, OAuth tokens, lastSyncAt · sync entity/direction/result
StateCardRule Platformstate, surchargeAllowed, maxSurchargePct, requiresDisclosure — platform-maintained reference

Consent, leads & media

EntityScopeKey fields
ConsentRecordCorpcustomerId, channel (sms/email), purpose (transactional/marketing), grantedAt, wordingShown, revokedAt?
NotificationLogCorpcustomerId, channel, template, sentAt, status, provider
LeadCorpsource (website/email-forward/facebook/instagram/ai/referral/manual), referrerId?, raw, contact, stage (new→contacted→quoted→won/lost), lostReason?, wonJobId?
Referrer · ReferralAgreementCorpreferrer: person/partner, contact · agreement: type (flat/%/credit), trigger (on close/on paid)
ReferralPayoutCorpreferrerId, leadId, amountOwed, status (accrued/paid), paidAt
MediaFileCorpownerEntity, storageKey, contentType, size, signedAccess — object storage, per-tenant
RefrigerantLog · LicenseInsuranceSitesee §11 Compliance records

06QuickBooks, terms & money

QuickBooks Online is the system of record for accounting (per-tenant OAuth). The suite is the system of record for the field work that feeds it — and for getting a complete, correctly-termed invoice out the door at the call.

Customer types & terms

defaultTerms map 1:1 to a QuickBooks Term. Same price book for everyone — the terms vary, not the number.

Customer typeTypical termsQBO termAt the call
ResidentialDue on completion, or deposit-to-reserve + balanceDue on receiptCollect now (link / card-on-file)
Property manager / multi-unitNet 10 / 15 / 30Net 10/15/30Finalize + capture PO
CommercialNet 30 / 45 / 60Net 30/45/60Finalize + capture PO / authorization

taxStatus, poRequired, notToExceed ride on the profile; a tech can't exceed an NTE without captured authorization.

Deposits & property managers

Residential deposit-to-reserve is taken at booking as a QBO deposit/retainer item; the final invoice nets the deposit and bills the balance, with refundability disclosed. A property manager is a parent customer with a sub-customer per property/unit (mirroring QBO), with optional consolidated monthly statements.

Invoice at the call

Finalizing the invoice is the gate to mark a job Done. Lines auto-assemble: parts from Quartermaster usage + flat-rate price book, terms preset by customer type, tax from the tax service (§10).

Syncs to QuickBooks & credit-card surcharge

Two-way customers & items (incl. PM sub-customers); invoices pushed with terms/PO/deposit/tax/surcharge; payments collected in QBO and confirmed back (webhook/poll) to flip the invoice paid. Each corporation chooses card cost handling: absorb (in the price book) or surcharge a disclosed % line on credit only — applied as the lower of corp %, state cap (StateCardRule), and processor cost-of-acceptance; never debit; disclosed up front; auto-suppressed where disallowed.

Not legal advice. Surcharge legality, caps, debit exclusions, and disclosure vary by state and change; StateCardRule is a platform-maintained reference to keep current and verify against law, card-network rules, and the processor's program.
Open: QBO Online vs. Desktop (Online preferred); item-cost master direction; per-site QBO class/location; surcharge alignment with the QBO Payments / processor program.

07Auth, privacy & retention

MFA — tiered by blast radius

Privacy, retention & deletion

08Device fleet

Company-owned devices are corp assets, managed at the corporation level.

09Notifications & consent

10Tax

Sales-tax rates vary by state/county/city/special district, and HVAC has labor-vs-parts and repair-vs-new-construction quirks. We integrate a tax service (Avalara / TaxJar) rather than hand-maintain tables:

Not legal advice. Tax rules live in the integrated service and must be kept current; the suite does not assert tax correctness independently.

11Compliance records

12Lead pipeline

Every lead lands in one pipeline tagged with its source, tracked to won/lost, with referral payouts owed when a tagged lead closes. (Merges the former "CRM" and "referral attribution" items.)

13File & media storage

14Reporting

The numbers that prove the suite pays for itself and run the business — DSO, close rate, revenue per tech, AR aging, callback rate, plan attach/renewal, and job costing (labor from TimeEntry + parts from inventory vs. revenue). Scope rolls up Site → Corp Admin (corp-wide) → Super-Admin (cross-tenant platform metrics). Lands late (needs money + time + inventory data flowing first).

15Offline & sync

16Datastore: build vs. buy

Why this is low-risk to lock: it's standard Postgres (open-source, self-hostable), so the database can move to Neon / RDS with a connection-string change if the cost profile ever shifts database-heavy / low-MAU. Neon + separate auth + R2 remains the documented fallback.

17Testing & environments

18Phasing

Smallest correct step first; each phase shippable. Testing/environments, notifications/consent, and file storage are cross-cutting from Phase 1.

PhaseWhat ships
0 — Interface layerShared core.css/core.js + app shell + auth/role gate; apps converted
1 — Tenancy spineCorp / Site / User / Membership / Audit; device fleet; auth, MFA, privacy/retention; object storage; Super-Admin console; soft-delete+restore
2 — QuartermasterCatalog, vendors, stock locations/levels/txns, reorder; Sidekick part-use decrement; compliance records (refrigerant, license/insurance)
3 — SchedulingAppointments, assignments, dispatch; time tracking + GPS clock/geofence; continuous breadcrumb (corp device); customer comms (reminders / on-the-way); recurring agreements (auto-renew)
4 — Money / QuickBooksPer-corp QBO; customers/items/invoices sync; terms, deposits, surcharge; tax service; payment read-back; customer portal (pay/approve/history); review-ask comms; warranty + callback
5 — Pipeline & reportingLead pipeline (email-forward + web first) + referral payouts; analytics/reporting (Site → Corp → platform)

Backlog: financing; named social-channel integrations beyond email/web form.

19Open decisions

Empower Service · Platform Data Specification & Plan · Draft v0.3.2 · Datastore locked: Supabase + Cloudflare R2 · Built from owner elicitation + council gap review (object storage, auth/privacy/retention, device fleet, notifications/consent, tax, compliance records, lead pipeline, reporting, testing/environments; corrected Super-Admin=provider hierarchy). For review and a follow-on resale/economics council. Not legal advice; not a commitment of vendor or pricing choices.