WhatsInvoice — African fintech SaaS for WhatsApp-based invoicing
# WhatsInvoice
African fintech SaaS: create, brand, and send invoices from WhatsApp, then collect Mobile Money payments.
## Architecture
```text
apps/
web/ Next.js App Router (admin dashboard + public pay page + API)
worker/ Background jobs (PDF, WhatsApp send, retries)
packages/
db/ Drizzle schema, migrations, seed
auth/ Password hashing, sessions, RBAC helpers
whatsapp/ WhatsAppProvider + ConversationStateMachine + mocks
payments/ PaymentProvider + MockPaymentProvider + SimplyPaye stub
storage/ S3-compatible StorageProvider + LocalStorageProvider
invoices/ Numbering, totals, branding, PDF service
templates/ MODERN / CLASSIC / PREMIUM / MINIMAL React templates
logger/ Structured JSON logging + sanitizer
shared/ Errors, phone E.164, money, ids, constants
config/ Zod-validated environment
```
**External providers are swappable.** Domain code depends on interfaces, not GOWA or SimplyPaye.
| Provider | Status |
|----------|--------|
| MockWhatsAppProvider | Ready (default) |
| GowaWhatsAppProvider | Adapter stub — needs official endpoints |
| MockPaymentProvider | Ready (default) |
| SimplyPayeProvider | Adapter stub — needs official endpoints |
| LocalStorageProvider | Ready (default) |
| S3CompatibleStorageProvider | Stub until AWS SDK wired |
## Prerequisites
- Node.js >= 20
- pnpm 9.15+
- PostgreSQL 16 (Docker Compose **or** Homebrew)
## Quick start
```bash
# 1. Install
pnpm install
# 2. Environment
cp .env.example .env
cp .env.local.example apps/web/.env.local
# 3. Database — option A: Docker
docker compose -f docker-compose.dev.yml up -d postgres
# 3. Database — option B: Homebrew
# brew install postgresql@16 && brew services start postgresql@16
# createuser -s whatsinvoice && createdb -O whatsinvoice whatsinvoice
# psql -d postgres -c "ALTER USER whatsinvoice WITH PASSWORD 'whatsinvoice';"
# 4. Schema + seed
export DATABASE_URL=postgresql://whatsinvoice:whatsinvoice@127.0.0.1:5432/whatsinvoice …