/emi-calculator

Build an EMI Calculator with Next.js, TypeScript, Tailwind CSS, Recoil and Recharts

Primary LanguageTypeScript

Getting Started

Code of Relevancy


youtube subscribers dev community medium blog twitter follow

This is a Next.js project bootstrapped with create-next-app.

Installation

Install Tailwind CSS with Next.js

Create your project

Start by creating a new Next.js project if you don’t have one set up already. The most common approach is to use Create Next App.

npx create-next-app@latest crypto-price-tracker-app --typescript --eslint
cd crypto-price-tracker-app

Install Tailwind CSS

Install tailwindcss and its peer dependencies via npm, and then run the init command to generate both tailwind.config.js and postcss.config.js.

npm install -D tailwindcss postcss autoprefixer
npx tailwindcss init -p

Configure your template paths

Add the paths to all of your template files in your tailwind.config.js file.

/** @type {import('tailwindcss').Config} \*/
module.exports = {
content: [
"./pages/**/_.{js,ts,jsx,tsx}",
"./components/\*\*/_.{js,ts,jsx,tsx}",
"./utils/**/\*.{js}",
"./configs/**/\*.{js}",
],
theme: {
extend: {},
},
plugins: [],
}

Add the Tailwind directives to your CSS

Add the @tailwind directives for each of Tailwind’s layers to your ./styles/globals.css file.

@tailwind base;
@tailwind components;
@tailwind utilities;

Dependencies

Classnames

A simple JavaScript utility for conditionally joining classNames together.

NPM:

https://www.npmjs.com/package/classnames

Install:

npm i classnames

Recharts

Recharts is a Redefined chart library built with React and D3.

The main purpose of this library is to help you to write charts in React applications without any pain. Main principles of Recharts are:

  • Simply deploy with React components.
  • Native SVG support, lightweight depending only on some D3 submodules.
  • Declarative components, components of charts are purely presentational.

NPM:

https://www.npmjs.com/package/recharts

Install:

npm i recharts

Tailwindcss Forms

A plugin that provides a basic reset for form styles that makes form elements easy to override with utilities.

NPM:

https://www.npmjs.com/package/@tailwindcss/forms

Install:

npm install -D @tailwindcss/forms

Recoil

Recoil is an experimental state management framework for React.

NPM:

https://www.npmjs.com/package/recoil

Install:

npm i recoil

Start your build process

npm run dev
# or
yarn dev

Open http://localhost:3000 with your browser to see the result.

You can start editing the page by modifying pages/index.tsx. The page auto-updates as you edit the file.

API routes can be accessed on http://localhost:3000/api/hello. This endpoint can be edited in pages/api/hello.ts.

The pages/api directory is mapped to /api/*. Files in this directory are treated as API routes instead of React pages.

This project uses next/font to automatically optimize and load Inter, a custom Google Font.

Hero Section

Home Loan
EMI Calculator
An EMI (Equated Monthly Installment) calculator for a home loan is
a financial tool that helps borrowers estimate the monthly
payments they will need to make towards their home loan. It takes
into account factors such as the loan amount, the interest rate
and the loan tenure to determine the EMI amount and much more..

Form Section

Home Loan Amount
Interest Rate
Loan Tenure

EMI Section

Total Interest Payable
Principal Amount
Total Payment (Principal + Interest)

Table Section

Loan Repayment Schedule (Monthly)
This is a table that outlines the monthly payments required to repay
a loan over a specified period of time. It is a detailed breakdown
of the loan repayment process and includes information such as the
Principal Payment, Interest Payment, Total Payment, Principal
Outstanding, Cumulative Interest and Cumulative Principal.
Month
Principal Payment
Interest Payment
Total Payment
Principal Outstanding
Cumulative Interest
Cumulative Principal
Prepayments (if any)

Learn More

To learn more about Next.js, take a look at the following resources:

You can check out the Next.js GitHub repository - your feedback and contributions are welcome!

Deploy on Vercel

The easiest way to deploy your Next.js app is to use the Vercel Platform from the creators of Next.js.

Check out our Next.js deployment documentation for more details.