YardTrade — technical spec
Binding law: `../../JAMAICA_TRUST.md`
Stack. Next.js PWA, TypeScript, Postgres, object storage for photos/audio, WhatsApp Cloud API, SMS/WhatsApp OTP. No consumer wallet.
Shared with the other flagship. YardTrade and LoadYard are two skins. Same listings, bids, provider_wallets, OTP, ratings. This skin filters kind = services. See `../../ENGINE.md`.
Architecture
[PWA] → [BFF] → listings / matching / ratings / OTP → WhatsApp Cloud (receipts, disputes) → object storage (photos, short audio) → provider ledger (prepaid lead balance — provider money only) [OCR / whisper] optional, never blocking
- Browse is public. Auth is phone OTP.
- Matching is automated. No dispatch office.
- Get three named prices for this photographed skill job.
Core APIs
| Method | Path | Job |
|---|---|---|
| GET | /api/yardtrade/browse | Public inventory or board — no login |
| POST | /api/yardtrade/otp/start | Phone OTP |
| POST | /api/yardtrade/otp/verify | Session cookie |
| POST | /api/yardtrade/lead/accept | Deduct provider lead fee |
| POST | /api/yardtrade/complete | Two-way rating unlock |
| POST | /api/yardtrade/wa-export | Image/PDF for WhatsApp |
| GET | /api/yardtrade/export | DPA zip |
| DELETE | /api/yardtrade/account | Delete |
Data model (sketch)
users— phone, role (seeker / provider), OTP verified_atyardtrade_listings— public fields onlyyardtrade_leads— provider_id, seeker_id, fee_jmd, statusratings— two-way, job_idprovider_wallets— prepaid provider balance for lead fees (not household escrow)id_checks— licence/TRN photo, reviewer, statusaudit_events— append-only
Security
- OTP rate limits. No password store.
- ID photos encrypted at rest; 90-day review then delete unless dispute hold.
- PII scoped. No sale. No JPS/NWC/bank credential fields exist.
- Provider wallet is a simple debit ledger. Top-up is Lynk/card to our company account with a receipt — same as buying airtime for ads.
- Payee on every card is the trade, mechanic, or kit owner on the quote.
Scalability
Parish shards on listing tables. Media on object storage. WhatsApp send queue. Read replicas for browse.
Offline / PWA
Photo or pin first. Category filter. Quotes cache. OTP after the first price. WhatsApp share of the strip. Same shell as LoadYard.
Service worker caches last browse payload. Writes queue when FLOW/Digicel drops. Shell under 150 KB gzipped.
What we will not build
Custodial household wallets. Escrow. “Pay the job here.” Blockchain settlement. Call-centre IVR.