Skip to content

kirillvberkeley/Underwrite-Rules-Lite

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

underwrite-rules-lite

A minimal, production-readable TypeScript underwriting rules engine and React playground.


Install

pnpm i

Run Playground (dev)

pnpm -C apps/playground dev

Run Engine Tests

pnpm -C packages/engine test

Rule Format

Each rule is YAML with fields:

  • id: string
  • priority: 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"

Example Rules

- 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

Example Merchant

{
  "revenue": 30000,
  "months_active": 14,
  "nsf_count": 0,
  "owner_credit_score": 670,
  "chargeback_rate": 0.5
}

Example Output

{
  score: 30,
  decisions: ["approve"],
  reasons: [
    "revenue_min: Has minimum revenue",
    "credit_ok: Good credit"
  ]
}

License

MIT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors