SME Finance Assistant — chat-first finance manager for Rwandan SMEs (Next.js 14 + Postgres + Claude)
# SME Finance Assistant
Web-chat assistant for Rwandan small business owners — track income & expenses conversationally, generate monthly P&L narratives, monitor RRA tax deadlines, prepare loan-readiness packages, and create simple invoices. Responds in English (default), Kinyarwanda, or French.
**Status:** v0.1.0-mvp — six phases shipped end-to-end. Visual polish + the live VPS deploy are still on you.
## Stack
- **Framework:** Next.js 14 App Router (TypeScript strict) + React 18
- **Monorepo:** Turborepo + pnpm workspaces
- **Database:** PostgreSQL 16 + Prisma ORM
- **Cache / sessions / queue:** Redis 7
- **AI:** Anthropic Claude (Opus 4.8 with adaptive thinking)
- **Background jobs:** BullMQ (Redis-backed)
- **UI:** Tailwind CSS + shadcn-style primitives + Recharts
- **PDFs:** PDFKit
- **Auth / SMS:** JWT cookies + Africa's Talking OTP (gated wiring; dev OTP `123456`)
- **Payments:** MTN MoMo Collections (stubbed in dev — manual activation supported)
## Repo layout
```
sme/
├── apps/
│ └── api/ # Next.js app + worker
│ ├── app/ # routes (pages, /api endpoints)
│ ├── components/ # chat UI, cards, onboarding, nav, notifications
│ ├── lib/ # ai, sme (pl/tax/loan/invoice), notifications, payments
│ ├── scripts/ # worker.ts, run-job-once.ts
│ └── vitest.config.ts
├── packages/
│ ├── db/ # Prisma schema + client (@sme/db)
│ ├── types/ # shared TS types (@sme/types)
│ └── config/ # shared eslint base
├── scripts/load/chat.js # k6 load test
├── docker-compose.yml # Postgres :5433, Redis :6380
├── DEPLOY.md # VPS / Nginx / PM2 / certbot notes
├── IMPLEMENTATION_PLAN.md # the six-phase plan
└── SPECKIT.md # full product spec
```
## Local setup
```bash
pnpm install # 1. install deps
pnpm infra:up # 2. Postgres + Redis containers
cp .env.example .env.local # 3. fill in ANTHROPI …