Skip to content

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.

License

Notifications You must be signed in to change notification settings

asma019/EMI-Calculator-usign-NexJS

Repository files navigation

๐Ÿ’ฐ Loan EMI Calculator

Next.js TypeScript Tailwind CSS License

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.

EMI Calculator Screenshot

โœจ Features

  • ๐Ÿงฎ 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

๐Ÿš€ Demo

Check out the live demo: EMI Calculator Demo

๐Ÿ› ๏ธ Built With

๐Ÿงฎ How the EMI Calculation Works

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:

  1. Interest for the month = Remaining balance ร— monthly interest rate
  2. Principal for the month = EMI - Interest for the month
  3. New remaining balance = Previous remaining balance - Principal for the month

๐Ÿ Getting Started

Prerequisites

  • Node.js 18.0.0 or higher
  • npm or yarn

Installation

  1. Clone the repository:

    git clone https://github.com/asma019/EMI-Calculator-usign-NexJS.git
    cd EMI-Calculator-using-NextJS
  2. Install dependencies:

    npm install
    # or
    yarn install
  3. Run the development server:

    npm run dev
    # or
    yarn dev
  4. Open http://localhost:3000 in your browser.

๐Ÿš€ Deployment

Deploying to Vercel

This application is optimized for deployment on Vercel.

Using the Deployment Script

  1. Make sure you have the Vercel CLI installed
  2. Run the deployment script:
    ./deploy.sh
  3. Follow the prompts to complete the deployment

Manual Deployment

  1. Install Vercel CLI:

    npm install -g vercel
  2. Build the application:

    npm run build
  3. Deploy to Vercel:

    vercel --prod

๐Ÿ”Œ WordPress Integration

Embedding the Calculator

After deploying to Vercel, you can easily embed this calculator in your WordPress site:

  1. Go to your deployed application URL
  2. Click on "Get WordPress Embed Code" at the bottom of the page
  3. Choose between the basic or advanced embed code
  4. In WordPress, add a "Custom HTML" block and paste the code
  5. Replace REPLACE_WITH_YOUR_DEPLOYMENT_URL with your actual Vercel deployment URL

Example Embed Code

<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>

๐Ÿ“ Project Structure

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

๐Ÿ”ง Customization

Changing Default Values

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

Adding More Currencies

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
};

๐Ÿค Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

๐Ÿ“„ License

This project is licensed under the Apache License 2.0. See the LICENSE file for details.

๐Ÿ™ Acknowledgements

  • 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

About

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.

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •