Arsitektur
Struktur repo
Section titled “Struktur repo”apps/api NestJS + Prisma (modul per domain)apps/web React + Vite (PWA)packages/contracts skema zod bersama (web + api)Modul API
Section titled “Modul API”Setiap modul punya presentation/ (controller), application/ (service), dan dipakai lewat shared/:
| Modul | Controller | Tanggung jawab |
|---|---|---|
| identity | auth | login, profil, password |
| tenancy | tenancy | pairing, unlink |
| accounts | accounts | rekening & default |
| categories | categories | kategori |
| transactions | transactions | pemasukan, pengeluaran, transfer |
| bills | bills | tagihan & pembayaran |
| goals | goals | tujuan, setor, tarik |
| debts | debts | utang & piutang |
| bots | bots | webhook Telegram & WhatsApp, parse AI |
| lynk | lynk | webhook pembayaran Lynk |
| health | health | health check |
Aturan inti
Section titled “Aturan inti”apps/api/src/shared/ledger/ledger.service.tssatu-satunya tempat yang mengubahBankAccount.balance. Modul lain memanggil ledger.- Setiap perintah jalan dalam satu Prisma
$transaction. - Data selalu di-scope
coupleIddari JWT. Tidak ada query lintas couple. - Nominal pakai
Money(bigint) di server dan integer di kontrak.
Yang belum ada
Section titled “Yang belum ada”- Tidak ada event sourcing. Riwayat saldo hanya lewat baris
Transaction. - Tidak ada tabel subscription atau plan; hanya field
role. - Tidak ada signature check untuk webhook WAHA dan WhatsApp.