An open-source project by AjkerProgram.com
A responsive and interactive web application to calculate loan EMI (Equated Monthly Installment), total interest, and payment schedule. Built with Next.js and optimized for embedding in WordPress sites.
- ๐งฎ Calculate monthly EMI based on loan amount, interest rate, and loan tenure
- ๐ธ View total interest payable and total payment amount
- ๐๏ธ Interactive sliders for easy adjustment of input values
- ๐ Visual breakdown of principal vs. interest payments
- ๐ Detailed amortization schedule showing month-by-month payments
- ๐ฑ Fully responsive design across all devices
- ๐ Switch between BDT (เงณ) and USD ($) currencies
- ๐ฅ Download complete payment schedule as CSV file
- ๐ WordPress-ready embedding with auto-resizing iframe support
Check out the live demo: EMI Calculator Demo
- Next.js - React framework
- TypeScript - Type safety
- Tailwind CSS - Utility-first CSS
- Framer Motion - Animations
The calculator uses the standard EMI formula:
EMI = [P ร r ร (1 + r)^n] / [(1 + r)^n - 1]
Where:
- P = Principal (loan amount)
- r = Monthly interest rate (annual rate รท 12 รท 100)
- n = Loan tenure in months
The amortization schedule is calculated by tracking remaining balance with each payment:
- Interest for the month = Remaining balance ร monthly interest rate
- Principal for the month = EMI - Interest for the month
- New remaining balance = Previous remaining balance - Principal for the month
- Node.js 18.0.0 or higher
- npm or yarn
-
Clone the repository:
git clone https://github.com/asma019/EMI-Calculator-usign-NexJS.git cd EMI-Calculator-using-NextJS
-
Install dependencies:
npm install # or yarn install
-
Run the development server:
npm run dev # or yarn dev
-
Open http://localhost:3000 in your browser.
This application is optimized for deployment on Vercel.
- Make sure you have the Vercel CLI installed
- Run the deployment script:
./deploy.sh
- Follow the prompts to complete the deployment
-
Install Vercel CLI:
npm install -g vercel
-
Build the application:
npm run build
-
Deploy to Vercel:
vercel --prod
After deploying to Vercel, you can easily embed this calculator in your WordPress site:
- Go to your deployed application URL
- Click on "Get WordPress Embed Code" at the bottom of the page
- Choose between the basic or advanced embed code
- In WordPress, add a "Custom HTML" block and paste the code
- Replace
REPLACE_WITH_YOUR_DEPLOYMENT_URL
with your actual Vercel deployment URL
<div style="max-width: 100%; margin: 0 auto;">
<iframe
src="https://emi.ajkerprogram.com/"
width="100%"
height="900px"
style="border: none; border-radius: 8px; box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); max-width: 100%;"
title="Loan EMI Calculator"
allowfullscreen
loading="lazy">
</iframe>
</div>
emi-calculator/
โโโ app/ # Next.js app directory
โ โโโ components/ # React components
โ โ โโโ EMICalculator.tsx
โ โโโ utils/ # Utility functions
โ โ โโโ emiCalculator.ts
โ โโโ globals.css # Global styles
โ โโโ iframe.css # iframe-specific styles
โ โโโ layout.tsx # App layout
โ โโโ page.tsx # Main page
โโโ public/ # Static assets
โ โโโ iframe-embed-code.html
โโโ next.config.js # Next.js configuration
โโโ tailwind.config.ts # Tailwind CSS configuration
โโโ vercel.json # Vercel deployment configuration
โโโ deploy.sh # Deployment script
โโโ package.json # Dependencies
Edit the EMICalculator.tsx
component to modify default values:
// State for input values
const [loanAmount, setLoanAmount] = useState(100000); // Default loan amount
const [interestRate, setInterestRate] = useState(8); // Default interest rate
const [loanTenure, setLoanTenure] = useState(5); // Default loan tenure
To add more currencies, modify the CurrencyType
type and related functions in emiCalculator.ts
:
export type CurrencyType = 'BDT' | 'USD' | 'EUR'; // Add more currencies here
// Update currency config
const currencyConfig: Record<CurrencyType, { locale: string, currency: string }> = {
BDT: { locale: 'bn-BD', currency: 'BDT' },
USD: { locale: 'en-US', currency: 'USD' },
EUR: { locale: 'en-EU', currency: 'EUR' } // Add new currency config
};
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
This project is licensed under the Apache License 2.0. See the LICENSE file for details.
- Open-source project by AjkerProgram.com
- EMI calculation formulas based on standard financial calculations
- Built with Next.js, deployed on Vercel
Made with โค๏ธ by AjkerProgram.com