A reusable EMI Calculator Widget that calculates loan EMI, visualizes principal vs interest, and generates a complete amortization schedule.
The widget can be embedded into any webpage using a simple script.
Frontend Demo
https://monis-iqbal-io.github.io/emi-calculator-widget/
Backend API
https://emi-calculator-api-kn60.onrender.com
API Documentation
https://emi-calculator-api-kn60.onrender.com/docs
- EMI calculation using standard financial formula
- Loan summary metrics
- Principal vs Interest chart visualization
- Dynamic amortization schedule generation
- Flat interest rate calculations
- Responsive UI for mobile and desktop
- Reusable embeddable JavaScript widget
- JavaScript
- HTML
- CSS
- Chart.js
- Python
- FastAPI
- Uvicorn
- Render (Backend)
- GitHub Pages (Frontend)
emi-calculator-widget
│
├── backend
│ ├── main.py
│ ├── models.py
│ └── emi_service.py
│
├── screenshots
│ ├── calculator.png
│ ├── chart.png
│ └── schedule.png
│
├── emi-calculator.js
├── index.html
│
├── requirements.txt
└── README.md
The EMI is calculated using the formula:
EMI = P × r × (1 + r)^n / ((1 + r)^n − 1)
Where:
- P = Loan Amount
- r = Monthly Interest Rate
- n = Loan Tenure in Months
POST /api/calculate-emi
{
"loan_amount": 500000,
"interest_rate": 12,
"tenure": 36
}{
"emi":16607,
"total_payment":597852,
"total_interest":97852,
"flat_rate_pa":6.52,
"flat_rate_pm":0.54,
"yearly_interest":32617,
"schedule":[...]
}git clone https://github.com/monis-iqbal-io/emi-calculator-widget.git
pip install -r requirements.txt
uvicorn backend.main:app --reload
Open index.html in your browser.
To embed the calculator on any webpage:
<div id="emi-calculator"></div>
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
<script src="emi-calculator.js"></script>This project includes:
- EMI Calculator frontend component
- JavaScript widget for embedding
- EMI calculation logic
- Chart implementation for principal vs interest
- Dynamic amortization schedule generation
- Example HTML page demonstrating embed usage
- Setup and run instructions
Monis Iqbal
Mathematics Major | Computer Science Minor
Cluster University Srinagar


