A full-stack web application for calculating Equated Monthly Installments (EMI) with advanced features like amortization schedules, prepayment scenarios, and loan comparisons.
- Basic EMI Calculator: Calculate monthly EMI with detailed breakdown
- Dual Calculation Methods: Support for both Reducing Balance and Flat Rate interest calculations
- Amortization Schedule: View month-by-month payment details
- Visual Charts: Interactive charts showing payment distribution
- Prepayment Calculator: Analyze impact of prepayments on your loan
- Loan Comparison: Compare multiple loan scenarios side-by-side
- FastAPI
- Python 3.8+
- Pydantic for data validation
- React 18
- Vite
- React Router
- Recharts for visualizations
- Tailwind CSS for styling
- Axios for API calls
emi-calculator-1/
├── backend/
│ ├── main.py
│ ├── models.py
│ ├── calculations.py
│ └── requirements.txt
├── frontend/
│ ├── src/
│ │ ├── components/
│ │ ├── pages/
│ │ ├── services/
│ │ ├── utils/
│ │ └── App.jsx
│ ├── package.json
│ └── vite.config.js
└── README.md
- Python 3.8 or higher
- Node.js 16 or higher
- npm or yarn
We've provided convenient scripts to run the application with one command:
On macOS/Linux:
./start.shOn Windows:
start.batThis will automatically:
- Set up backend and frontend (first time only)
- Start both services in separate terminal windows
- Open the application in your browser
If the automatic script doesn't work, use the manual guide:
./start-manual.sh # Shows step-by-step instructionsOption 1: Using the setup script (Recommended)
On macOS/Linux:
cd backend
./setup.sh
./run.shOn Windows:
cd backend
setup.bat
run.batOption 2: Manual commands
- Navigate to the backend directory:
cd backend- Create a virtual environment:
python3 -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate- Install dependencies:
pip install -r requirements.txt- Run the FastAPI server:
uvicorn main:app --reloadThe backend will be available at http://localhost:8000
API documentation (Swagger UI) at http://localhost:8000/docs
Option 1: Using the setup script (Recommended)
On macOS/Linux:
cd frontend
./setup.sh
./run.shOn Windows:
cd frontend
setup.bat
run.batOption 2: Manual commands
- Open a new terminal and navigate to the frontend directory:
cd frontend- Install dependencies:
npm install- Run the development server:
npm run devThe frontend will be available at http://localhost:5173
start.sh/start.bat- Start both backend and frontend automaticallystart-manual.sh- Show manual startup instructions
setup.sh/setup.bat- Set up backend environmentrun.sh/run.bat- Run backend server
setup.sh/setup.bat- Set up frontend dependenciesrun.sh/run.bat- Run frontend development server
POST /api/calculate-emi- Calculate basic EMIPOST /api/amortization-schedule- Generate payment schedulePOST /api/calculate-with-prepayment- Calculate with prepaymentPOST /api/compare-loans- Compare multiple loans
- Start both backend and frontend servers
- Open your browser to
http://localhost:5173 - Enter the following details:
- Loan Amount: The total amount you want to borrow (e.g., ₹10,00,000)
- Annual Interest Rate: The yearly interest rate in percentage (e.g., 8.5%)
- Loan Tenure: Duration of the loan in months (e.g., 240 for 20 years)
- Calculation Method: Choose between:
- Reducing Balance: Interest calculated on remaining balance (recommended for most loans)
- Flat Rate: Interest calculated on original amount (results in higher interest)
- Click "Calculate EMI" to see:
- Monthly EMI amount
- Total interest payable
- Total payment amount
- Calculation method badge
- Detailed amortization schedule
- Interactive charts showing payment breakdown
- Export the amortization schedule to CSV for record-keeping
Note: For the same loan amount, rate, and tenure, Flat Rate will result in approximately double the interest compared to Reducing Balance. This is because flat rate interest is calculated on the full principal amount throughout the loan period, while reducing balance interest decreases as you pay down the principal.
- Navigate to the "Prepayment" page from the top menu
- Enter your loan details and prepayment information:
- Basic loan parameters (amount, rate, tenure)
- Calculation Method: Choose Reducing Balance or Flat Rate
- Prepayment Amount: How much extra you want to pay
- Prepayment Frequency: Choose monthly, yearly, or one-time
- Start Month: When to begin prepayments
- Click "Calculate Prepayment Impact" to see:
- Interest savings from prepayment
- Reduced loan tenure
- Side-by-side comparison with and without prepayment
- Visual charts comparing both scenarios
- Navigate to the "Comparison" page
- Add multiple loan scenarios (2-5 scenarios)
- For each scenario, enter:
- Custom name for the loan
- Principal amount
- Interest rate
- Tenure
- Calculation method (can mix Reducing Balance and Flat Rate)
- Click "Compare Loans" to see:
- Best option by monthly EMI
- Best option by total payment
- Detailed comparison table
- Visual charts comparing all scenarios
- Use this to compare offers from different banks or tenure options
- Accurate EMI Calculation: Uses the standard EMI formula for precise calculations
- Two Calculation Methods:
- Reducing Balance (Most Common): Interest is calculated on the outstanding principal balance each month. As you pay down the loan, the interest decreases. This is the standard method used by most banks for home loans, car loans, and personal loans.
- Flat Rate: Interest is calculated on the original principal amount for all months. The interest remains the same throughout the loan tenure, resulting in higher total interest paid. This method is sometimes used for consumer loans and durables financing.
- Amortization Schedule: Month-by-month breakdown of principal and interest
- Prepayment Scenarios: Analyze the impact of extra payments on loan tenure and interest (works with both calculation methods)
- Multi-Loan Comparison: Compare up to 5 different loan scenarios simultaneously with different calculation methods
- Responsive Design: Works seamlessly on desktop, tablet, and mobile devices
- Real-time Validation: Input validation with helpful error messages
- Interactive Charts: Visual representations using Recharts library
- CSV Export: Download amortization schedules for offline use
- Toast Notifications: User-friendly feedback for all actions
- Fast API: High-performance backend with automatic API documentation
- Modern Frontend: Built with React 18 and Vite for fast development
- Type Safety: Pydantic models ensure data validation on the backend
- Clean Architecture: Separation of concerns with organized file structure
Port 8000 already in use:
# Find and kill the process using port 8000
lsof -ti:8000 | xargs kill -9
# Or run on a different port
uvicorn main:app --reload --port 8001Module not found errors:
# Make sure virtual environment is activated
source venv/bin/activate
# Reinstall dependencies
pip install -r requirements.txtPort 5173 already in use:
- Vite will automatically try the next available port
- Or manually specify a port in
vite.config.js
npm install fails:
# Clear npm cache
npm cache clean --force
# Try with legacy peer deps
npm install --legacy-peer-depsCORS errors:
- Ensure backend is running on
http://localhost:8000 - Check that CORS is properly configured in
backend/main.py
Calculations seem incorrect:
- Verify input values are positive numbers
- Check that interest rate is annual (not monthly)
- Ensure tenure is in months (not years)
Charts not displaying:
- Check browser console for errors
- Ensure recharts library is properly installed
- Try refreshing the page
- Save and load loan scenarios
- User authentication and history
- Email reports
- More loan types (reducing balance, flat rate) - ✅ COMPLETED
- Tax benefits calculator
- Mobile app version
- Multi-currency support
Contributions are welcome! Please feel free to submit a Pull Request.
MIT