A minimal, production-readable TypeScript underwriting rules engine and React playground.
pnpm ipnpm -C apps/playground devpnpm -C packages/engine testEach rule is YAML with fields:
id: stringpriority: number (higher = checked first)condition: string (expr-eval, uses merchant vars)points: number (how much this rule adds/subtracts from score)message: string (explanation)when: (optional) "approve" | "decline" | "review"
- id: revenue_min
priority: 2
condition: revenue >= 20000
points: 20
message: Has minimum revenue
when: approve
- id: new_business
priority: 1
condition: months_active < 12
points: -30
message: Too new
when: decline
- id: credit_ok
priority: 1
condition: owner_credit_score >= 660
points: 10
message: Good credit
when: approve
- id: many_nsfs
priority: 1
condition: nsf_count > 3
points: -20
message: Too many NSF
when: review{
"revenue": 30000,
"months_active": 14,
"nsf_count": 0,
"owner_credit_score": 670,
"chargeback_rate": 0.5
}{
score: 30,
decisions: ["approve"],
reasons: [
"revenue_min: Has minimum revenue",
"credit_ok: Good credit"
]
}
MIT