npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

mortgage-utils

v1.0.1

Published

Lightweight JavaScript utility library for mortgage calculations — DTI, amortization, affordability, LTV and more.

Readme

mortgage-utils

Lightweight JavaScript utility library for mortgage calculations. Built for developers building mortgage tools, fintech apps, and borrower readiness platforms.

npm version license

Built by OurNetHelps — borrower readiness and mortgage tools for independent mortgage brokers.


Features

  • ✅ DTI Calculator — Front-end and back-end debt-to-income ratio
  • ✅ Amortization — Monthly payment and full amortization schedule
  • ✅ Affordability — Maximum loan amount based on income and debts
  • ✅ LTV — Loan-to-value ratio with PMI threshold detection
  • ✅ Zero dependencies
  • ✅ Works in Node.js and modern browsers

Installation

npm install mortgage-utils

Usage

DTI (Debt-to-Income)

const { frontEndDTI, backEndDTI, dtiReport } = require('mortgage-utils');

// Front-End DTI (housing costs only)
const front = frontEndDTI(1400, 7000);
console.log(front);
// { ratio: 0.2, percentage: 20, status: 'good', label: 'Front-End DTI', guideline: 'Recommended: <= 28%' }

// Back-End DTI (all monthly debts)
const back = backEndDTI(1400, 500, 7000);
console.log(back);
// { ratio: 0.2714, percentage: 27.14, status: 'good', ... }

// Full DTI Report
const report = dtiReport({
  monthlyHousingCost: 1400,
  monthlyDebts: 500,
  grossMonthlyIncome: 7000,
});
console.log(report.qualified); // true
console.log(report.summary);   // "Front-End: 20% | Back-End: 27.14%"

Amortization

const { monthlyPayment, amortizationSchedule } = require('mortgage-utils');

// Monthly Payment
const payment = monthlyPayment(300000, 6.5, 30);
console.log(payment.monthlyPayment);  // 1896.20
console.log(payment.totalInterest);   // 382632.00

// Full Amortization Schedule
const schedule = amortizationSchedule(300000, 6.5, 30);
console.log(schedule[0]);
// { month: 1, payment: 1896.20, principal: 271.20, interest: 1625.00, balance: 299728.80 }

Affordability

const { maxAffordableLoan, loanToValue } = require('mortgage-utils');

// Max Affordable Loan
const afford = maxAffordableLoan(7000, 500, 6.5, 30);
console.log(afford.estimatedLoanAmount); // ~$411,000
console.log(afford.maxMonthlyPayment);   // 2510

// LTV Ratio
const ltv = loanToValue(160000, 200000);
console.log(ltv.percentage);   // 80
console.log(ltv.requiresPMI);  // false

API Reference

frontEndDTI(monthlyHousingCost, grossMonthlyIncome)

Returns front-end DTI ratio with status (good / caution / high).

backEndDTI(monthlyHousingCost, monthlyDebts, grossMonthlyIncome)

Returns back-end DTI including all monthly debts.

dtiReport({ monthlyHousingCost, monthlyDebts, grossMonthlyIncome })

Returns full DTI report with qualified boolean and summary string.

monthlyPayment(loanAmount, annualInterestRate, loanTermYears)

Returns monthly P&I payment, total payment, and total interest.

amortizationSchedule(loanAmount, annualInterestRate, loanTermYears)

Returns array of 360 (or n) monthly payment breakdowns.

maxAffordableLoan(grossMonthlyIncome, monthlyDebts, annualInterestRate, loanTermYears, maxDTI?)

Returns max affordable loan amount based on income and DTI threshold (default 43%).

loanToValue(loanAmount, propertyValue)

Returns LTV ratio, percentage, and PMI requirement flag.


DTI Status Thresholds

| Status | Front-End DTI | Back-End DTI | |--------|--------------|--------------| | good | <= 28% | <= 36% | | caution | 29–36% | 37–43% | | high | > 36% | > 43% |


Related

  • OurNetHelps — White-label borrower readiness tools for mortgage brokers
  • MDE Pro — Mortgage Decision Engine for independent brokers

License

MIT © Sanjeev Kumar