This is a loan calculator application built with Next.js and bootstrapped with create-next-app.
-
Loan Amount Input
- Allows users to input the loan amount in VND.
-
Loan Term Input
- Allows users to input the loan term in years (can be fractional).
-
Calculation Method Selection
- Users can choose between two calculation methods:
- Annuity (Equal Principal and Interest)
- Fixed Principal, Reducing Interest
- Users can choose between two calculation methods:
-
Interest Rate Generation
- Generate interest rates for each year or a common interest rate for all years.
-
Interest Rate Input
- Allows users to input interest rates for each period.
-
Repayment Schedule Calculation
- Calculates the repayment schedule based on the input values and selected calculation method.
-
Repayment Schedule Display
- Displays the repayment schedule in a table format with the following columns:
- Month
- Beginning Balance (VND)
- Interest (VND)
- Principal (VND)
- Total Payment (VND)
- Ending Balance (VND)
- Displays the repayment schedule in a table format with the following columns:
-
Statistics Display
- Displays total interest payable and total principal and interest payable.
-
Repayment Chart
- Displays a line chart showing the beginning and ending balance over the loan term.
-
Interest and Principal Chart
- Displays a bar chart showing the interest and principal amounts over the loan term.
-
CSV Download
- Allows users to download the repayment schedule as a CSV file.
-
Share Plan
- Allows users to share the repayment plan via a unique link.
-
Multi-language Support
- Supports English and Vietnamese languages.
-
Error Handling
- Displays modal messages for invalid inputs such as invalid loan term, loan amount, or interest rates.
-
Compare Methods Side-by-Side
- Toggle to compare Annuity vs Fixed Principal methods simultaneously.
- Shows interest difference and which method saves more.
-
Payment Breakdown Chart
- Doughnut chart showing Principal vs Interest ratio in total payment.
-
Early Repayment Calculator
- Calculate interest savings from extra payments (one-time or monthly).
- Shows months reduced from early repayment.
-
Affordability Calculator
- Input monthly income to calculate maximum loan amount.
- Based on DTI (Debt-to-Income) ratio: 43% max, 36% comfortable.
- DTI Threshold Guide:
- Below 36%: Ideal - Strong financial health
- 37-42%: Acceptable - Be cautious with new debt
- 43-49%: Warning - High debt risk, may face loan rejection
- Above 50%: Critical - Need debt reduction plan urgently
-
Save/Load Plans
- Save multiple loan plans to localStorage.
- Load and compare different scenarios.
-
Export to PDF
- Professional PDF export of repayment schedule.
- Supports Vietnamese (ASCII-safe) and English.
Detailed calculation documentation available in docs/:
| Document | Description |
|---|---|
| Affordability Calculator | How max loan is calculated based on DTI ratio |
| Early Repayment | How interest savings are calculated |
Vietnamese versions: *_vi.md
This application includes the following SEO optimizations:
- Meta tags for description, keywords, and author.
- Sitemap XML for better indexing by search engines.
- SEO-friendly URLs.
Make sure you have the following installed:
First, clone the repository:
git clone https://github.com/lamngockhuong/loan-calculator.git
cd loan-calculatorThen, install the dependencies:
pnpm installFirst, run the development server:
pnpm devOpen http://localhost:3000 with your browser to see the result.
You can start editing the page by modifying app/page.tsx. The page auto-updates as you edit the file.
To run tests, use the following command:
pnpm testTo create an optimized production build, run:
pnpm buildTo learn more about Next.js, take a look at the following resources:
- Next.js Documentation - learn about Next.js features and API.
- Learn Next.js - an interactive Next.js tutorial.
You can check out the Next.js GitHub repository - your feedback and contributions are welcome!