Skip to content

Sagargupta16/Financial-Dashboard

Repository files navigation

Financial Dashboard

GitHub stars GitHub forks License Last Commit Demo

View Live Demo

Looking for a fully working, production-ready financial dashboard with Sankey diagrams and anomaly detection? Check out Ledger Sync -- Transform messy Excel bank statements into beautiful financial dashboards.

A comprehensive, modern financial dashboard built with React that provides powerful analytics, AI-style insights, and visualizations for personal finance management. Upload your financial data and gain deep insights into your spending patterns, income sources, financial health, investments, tax planning, and lifestyle optimization.

Financial Dashboard TypeScript TailwindCSS Chart.js License Version

Demo

Live Demo

Quick Start: Just export your Money Manager backup to Excel and upload it on this link UI - you'll get comprehensive financial insights instantly!

πŸ“Έ Screenshots

Upload your financial data and watch your dashboard come to life with interactive charts, smart insights, and comprehensive analytics.

✨ Features

πŸ†• NEW: TypeScript Migration v0.5.0

  • Full TypeScript Support: Enhanced type safety and developer experience
  • Strict Mode: Robust error checking and improved code quality
  • Modern Architecture: Updated codebase using latest React patterns
  • Zero Runtime Errors: Significantly improved stability and reliability

πŸ—οΈ Refactored Architecture v0.4.0

  • Clean Folder Structure: Modular organization by feature and concern
  • Single Source of Truth: All financial calculations centralized in lib/calculations
  • No Duplicates: Clean, maintainable codebase with zero duplicate calculation logic
  • SonarQube Compliant: All code quality warnings resolved
  • Optimized Performance: Efficient calculations reused across all components
  • Easy to Extend: Add new features in isolated, focused modules

πŸ“Š Advanced Financial Management

  • πŸ“ˆ Investment Performance Tracker: Stock market P&L, brokerage fees, returns, and actionable insights
  • πŸ“‹ Tax Planning Dashboard: Income tax calculations, deductions (80C, HRA), tax slab breakdown, saving recommendations
  • πŸ‘¨β€πŸ‘©β€πŸ‘§ Family & Housing Manager: Family expenses, rent payments, utilities, HRA benefits
  • πŸ’³ Lifestyle Optimizer: Credit card analytics, cashback tracking, food spending, commute cost analysis

πŸ“Š Comprehensive Analytics

  • KPI Overview: Total income, expenses, net balance, transaction counts, and advanced financial health metrics
  • Account Balances: Real-time view of all account balances
  • Transfer Tracking: Monitor internal money movements between accounts
  • Advanced Metrics: Savings rate, spending velocity, burn rate, and category concentration

πŸ“ˆ Rich Visualizations

  • Income vs Expense Breakdown (Doughnut Chart)
  • Top Expense Categories (Bar Chart) - with time filtering
  • Income Sources Analysis (Bar Chart) - with time filtering
  • Spending by Account (Doughnut Chart)
  • Monthly Trends (Line Chart) - with time filtering
  • Daily Spending Patterns (Bar Chart)
  • Subcategory Analysis with drill-down capabilities
  • Investment P&L Charts: Cumulative profit/loss tracking over time
  • Tax Breakdown: Visual representation of tax slabs and deductions
  • Food & Transport Trends: Monthly spending patterns and optimization opportunities

πŸ•’ Time-Based Analysis

  • Enhanced Top Categories: Monthly, yearly, and all-time views for expenses and income
  • Enhanced Monthly Trends: Yearly, last 12 months, and all-time views
  • Enhanced Subcategory Breakdown: Monthly, yearly, and decade views
  • Multi-Category Time Analysis: Compare spending across categories over time
  • Interactive Navigation: Navigate through different time periods
  • Trend Identification: Spot patterns and seasonal variations

πŸ” Data Management

  • CSV & Excel Upload: Easy data import functionality for both CSV and Excel files (.xlsx, .xls)
  • Smart Parsing: Handles quoted fields and various file formats
  • Data Filtering: Search and filter transactions
  • Sorting & Pagination: Organized transaction table with sorting capabilities
  • Export Charts: Download visualizations as PNG images

πŸ’Ό Transaction Types Support

  • Income: Track all income sources
  • Expenses: Monitor spending across categories
  • Transfers: Handle internal account transfers
  • Categorization: Organize transactions with categories and subcategories

πŸ—οΈ Architecture

Clean Modular Structure

src/
β”œβ”€β”€ app/
β”‚   └── App.js                        # Main application component
β”œβ”€β”€ pages/                            # Page-level components
β”‚   β”œβ”€β”€ OverviewPage/
β”‚   β”œβ”€β”€ AdvancedAnalyticsPage/
β”‚   β”œβ”€β”€ CategoryAnalysisPage/
β”‚   β”œβ”€β”€ IncomeExpensePage/
β”‚   β”œβ”€β”€ PatternsPage/
β”‚   β”œβ”€β”€ TransactionsPage/
β”‚   └── TrendsForecastsPage/
β”œβ”€β”€ features/                         # Feature modules
β”‚   β”œβ”€β”€ analytics/                    # Advanced analytics components
β”‚   β”‚   β”œβ”€β”€ components/
β”‚   β”‚   └── hooks/
β”‚   β”œβ”€β”€ budget/                       # Budget & goals features
β”‚   β”‚   β”œβ”€β”€ components/
β”‚   β”‚   └── utils/
β”‚   β”œβ”€β”€ charts/                       # Chart components & logic
β”‚   β”‚   β”œβ”€β”€ components/
β”‚   β”‚   └── hooks/
β”‚   β”œβ”€β”€ kpi/                          # KPI cards & metrics
β”‚   β”‚   β”œβ”€β”€ components/
β”‚   β”‚   └── hooks/
β”‚   └── transactions/                 # Transaction management
β”‚       └── components/
β”œβ”€β”€ components/                       # Shared UI components
β”‚   β”œβ”€β”€ data-display/                 # Charts, health scores, calendars
β”‚   β”œβ”€β”€ errors/                       # Error boundaries
β”‚   β”œβ”€β”€ import-export/                # CSV/Excel import
β”‚   β”œβ”€β”€ layout/                       # Header, footer
β”‚   └── ui/                          # Reusable UI elements
β”œβ”€β”€ lib/                             # Core libraries
β”‚   β”œβ”€β”€ calculations/                # Financial calculation engine
β”‚   β”‚   β”œβ”€β”€ aggregations/            # Averages, totals, categories
β”‚   β”‚   β”œβ”€β”€ financial/               # Financial calculations
β”‚   β”‚   β”œβ”€β”€ time/                    # Date range calculations
β”‚   β”‚   β”œβ”€β”€ index.js                 # Main calculation exports
β”‚   β”‚   └── legacy.js                # Backward compatibility
β”‚   β”œβ”€β”€ analytics/                   # Analytics utilities
β”‚   β”‚   β”œβ”€β”€ forecasts.js
β”‚   β”‚   β”œβ”€β”€ insights.js
β”‚   β”‚   β”œβ”€β”€ trends.js
β”‚   β”‚   └── healthScore.js
β”‚   β”œβ”€β”€ charts/                      # Chart utilities
β”‚   └── data/                        # Data processing & validation
β”œβ”€β”€ contexts/                        # React contexts
β”‚   └── DataContext.js
β”œβ”€β”€ hooks/                           # Custom React hooks
β”‚   β”œβ”€β”€ useDataProcessor.js
β”‚   └── useDebouncedValue.js
β”œβ”€β”€ utils/                           # General utilities
β”‚   β”œβ”€β”€ accessibility.js
β”‚   β”œβ”€β”€ localStorage.js
β”‚   β”œβ”€β”€ logger.js
β”‚   └── performance.js
β”œβ”€β”€ config/                          # Configuration files
β”‚   β”œβ”€β”€ overview.js
β”‚   └── tabs.js
β”œβ”€β”€ constants/                       # App constants
β”‚   └── index.js
└── styles/                          # Global styles
    └── index.css

Key Principles

  • βœ… Feature-Based Structure: Organize code by feature, not by file type
  • βœ… Separation of Concerns: Pages, features, components, and libraries are clearly separated
  • βœ… Single Responsibility: Each module and function does one thing well
  • βœ… No Duplicates: Same calculation or component never written twice
  • βœ… Easy to Test: Pure functions with predictable outputs
  • βœ… Easy to Extend: Add new features without breaking existing ones
  • βœ… Code Quality: SonarQube compliant with proper error handling and logging

🎯 Key Features in Detail

Investment Performance Tracker πŸ“ˆ

Comprehensive stock market analysis:

  1. P&L Tracking

    • Total deposits and withdrawals
    • Realized profits and losses
    • Net profit/loss with return percentage
    • Cumulative P&L chart over time
  2. Brokerage Analysis

    • Total fees paid
    • Fee percentage of invested amount
    • Optimization recommendations
  3. Investment Insights

    • Win/loss ratio calculation
    • Tax loss harvesting opportunities
    • Strategy recommendations based on performance
    • Recent transaction history

Tax Planning Dashboard πŸ“‹

Complete income tax planning (FY 2025-26):

  1. Income Analysis

    • Salary, bonus, and other income breakdown
    • Gross vs taxable income comparison
    • Visual income distribution
  2. Deductions Tracking

    • 80C investments (β‚Ή1.5L limit) with progress bar
    • HRA exemption calculation
    • Standard deduction (β‚Ή50,000)
    • Professional tax
  3. Tax Calculation

    • New tax regime slab-wise breakdown
    • Effective tax rate calculation
    • Post-tax income projection
    • Year-end tax estimate
  4. Recommendations

    • Tax-saving investment suggestions
    • Unutilized deduction alerts
    • Optimization opportunities

Family & Housing Manager πŸ‘¨β€πŸ‘©β€πŸ‘§β€πŸ‘¦

Track family and housing expenses:

  1. Family Expenses

    • Total family support tracking
    • Monthly average calculations
    • Subcategory breakdown
    • Top expense identification
  2. Housing Costs

    • Rent payment history
    • Utility bills tracking
    • Monthly housing trends
    • HRA tax benefit calculation
  3. Insights

    • Spending patterns over time
    • Budget recommendations
    • Tax benefit alerts

Lifestyle Optimizer πŸ’³

Optimize daily spending:

  1. Credit Card Analytics

    • Card-wise spending breakdown
    • Total Cashback Earned: Sum of all cashback income
    • Cashback Shared: Expenses and transfers from "Cashback Shared" account
    • Actual Cashback: Total Earned - Shared (what you actually kept)
    • Cashback rate calculation
    • Category-wise card usage
    • Card optimization tips
  2. Food Spending

    • Delivery apps vs groceries
    • Office cafeteria spending
    • Dining out costs
    • Daily food average
    • Monthly trends and savings opportunities
  3. Transportation

    • Daily commute costs
    • Intercity travel expenses
    • Per-trip averages
    • Alternative suggestions (bike, monthly pass)
  4. Reimbursements

    • Total Reimbursements: Sum of all expense reimbursement income
    • Average reimbursement amount
    • Monthly reimbursement trends
    • Recent reimbursement activity

Financial Health Metrics

6 Advanced KPI Cards that give you instant insights:

  1. Savings Rate 🐷

    • Shows: (Income - Expense) / Income Γ— 100
    • Color-coded: Green (β‰₯20%), Yellow (β‰₯10%), Red (<10%)
    • Example: "23.5% - Excellent! πŸŽ‰"
  2. Daily Spending Rate πŸ”₯

    • Shows: Average money spent per day
    • Helps understand your daily burn rate
    • Example: "β‚Ή485.50/day"
  3. Monthly Burn Rate πŸ“…

    • Shows: Projected monthly expenses
    • Useful for monthly budgeting
    • Example: "β‚Ή14,750/month"
  4. Net Worth Change πŸ“ˆ

    • Shows: Total wealth change over period
    • Color-coded: Green (positive), Red (negative)
    • Example: "+β‚Ή15,250 (+β‚Ή5,000/month) ↑"
  5. Spending Velocity (30-day) ⚑

    • Shows: If you're spending more/less than usual
    • Early warning system for budget overruns
    • Color-coded: Red (>120%), Yellow (80-120%), Green (<80%)
    • Example: "115% ↑ Above average"
  6. Top Category Concentration 🎯

    • Shows: Which category dominates your spending
    • Warns if >50% (over-concentration risk)
    • Example: "Food - 45% of spending ⚠️"

Smart Insights & Recommendations

AI-style personalized financial advice that includes:

  • πŸ’° Savings Opportunities: Identifies potential savings from delivery apps, cafeteria spending, and recurring expenses
  • πŸ“Š Pattern Detection: Analyzes weekend vs weekday spending, high-frequency categories, and unusual transactions
  • πŸŽ‰ Achievements: Celebrates your good financial behaviors
  • ⚠️ Warnings: Alerts you to concerning patterns or low savings rates
  • πŸ• Time Filtering: Filter insights by year and month to analyze specific periods
  • 🎯 Priority System: High-priority insights shown first for immediate action

Example Insights:

  • "You order food 4.2x/week (avg β‚Ή350/order). Reducing by 30% could save β‚Ή52,416/year"
  • "You spend 68% more on weekends vs weekdays - consider planning weekend activities better"
  • "You're saving 28.5% of your income - that's excellent! Keep it up!"

Running Balance Tracking

See exactly how your balance changes over time:

  • Chronological View: Transactions sorted by date with cumulative balance
  • All Transaction Types: Handles income (+), expenses (-), and transfers
  • Color Coding: Green for positive, Red for negative balances
  • Historical Analysis: Track exactly when you went positive or negative
  • Visual Impact: See the immediate effect of large expenses

Example:

Date    | Amount     | Type    | Running Balance
--------|------------|---------|------------------
Jan 1   | β‚Ή50,000    | Income  | β‚Ή50,000 (Positive)
Jan 5   | -β‚Ή12,000   | Expense | β‚Ή38,000 (Positive)
Jan 10  | β‚Ή60,000    | Income  | β‚Ή98,000 (Positive)

πŸš€ Quick Start

Prerequisites

  • Node.js 20.x or higher
  • pnpm 9.x or higher (recommended) or npm

Note: This project uses pnpm for faster installs and better disk space usage. Install pnpm: npm install -g pnpm

Installation

  1. Clone the repository

    git clone https://github.com/Sagargupta16/Financial-Dashboard.git
    cd Financial-Dashboard
  2. Install dependencies

    pnpm install
  3. Start the development server

    pnpm start
  4. Open your browser

    Navigate to http://localhost:3000

πŸͺ Git Hooks with Husky

This project uses Husky for Git hooks to maintain code quality automatically:

What is Husky? Husky is a tool that makes Git hooks easy. It runs scripts before certain Git actions (like commit or push) to ensure code quality.

Pre-commit Hook (.husky/pre-commit):

  • βœ… Automatically runs ESLint on staged files
  • βœ… Automatically formats code with Prettier
  • βœ… Prevents commits if there are linting errors
  • βœ… Ensures consistent code style across the team

Benefits:

  • No more "fix lint errors" commits
  • Consistent formatting across all developers
  • Faster CI/CD pipelines (fewer failed builds)
  • Higher code quality in the repository

The hook configuration uses lint-staged to only check files you're actually committing.

πŸ“‹ Data Format (CSV & Excel)

Your CSV or Excel file should follow this format:

Date,Time,Accounts,Category,Subcategory,Note,INR,Income/Expense
01/01/2024,10:30:00,Bank Account,Food,Groceries,Weekly shopping,2500,Expense
01/01/2024,14:15:00,Savings Account,Salary,Basic Salary,Monthly salary,50000,Income

Supported File Types:

  • .csv - Comma-separated values
  • .xlsx - Excel workbook format
  • .xls - Legacy Excel format

Required Columns

  • Date: DD/MM/YYYY format
  • Time: HH:MM:SS format
  • Accounts: Account name (e.g., "Bank Account", "Credit Card")
  • Category: Transaction category (e.g., "Food", "Transport", "Salary")
  • Subcategory: Optional subcategory for detailed tracking
  • Note: Transaction description or notes
  • INR: Amount in Indian Rupees (can include β‚Ή symbol and commas)
  • Income/Expense: Transaction type ("Income", "Expense", "Transfer-In", "Transfer-Out")

πŸ› οΈ Technology Stack

Core Technologies

  • React 19.1.1: Modern UI framework
  • Chart.js 4.5.0: Powerful charting library
  • react-chartjs-2: React wrapper for Chart.js
  • TailwindCSS 3.4: Utility-first CSS framework
  • Lucide React: Icon library
  • xlsx: Excel file parsing

Build & Development

  • Create React App: Zero-configuration setup
  • ESLint: Code quality and linting
  • PropTypes: Runtime type checking
  • pnpm: Fast, disk space efficient package manager
  • Husky: Git hooks for code quality

Browser Support

Modern browsers (Chrome, Firefox, Safari, Edge)

πŸ“ Project Structure

src/
β”œβ”€β”€ app/                   # Main application entry
β”œβ”€β”€ pages/                 # Page-level components for routing
β”œβ”€β”€ features/              # Feature modules (analytics, budget, charts, kpi, transactions)
β”œβ”€β”€ components/            # Shared UI components (data-display, errors, import-export, layout, ui)
β”œβ”€β”€ lib/                   # Core libraries (calculations, analytics, charts, data)
β”œβ”€β”€ contexts/              # React contexts (DataContext)
β”œβ”€β”€ hooks/                 # Custom React hooks
β”œβ”€β”€ utils/                 # General utilities (logger, localStorage, performance)
β”œβ”€β”€ config/                # Configuration files
β”œβ”€β”€ constants/             # Application constants
└── styles/                # Global styles

🎯 Available Scripts

pnpm start          # Start development server
pnpm build          # Build for production
pnpm test           # Run test suite
pnpm lint           # Run ESLint
pnpm lint:fix       # Fix ESLint issues
pnpm format         # Format code with Prettier

πŸ”§ Configuration

Currency Format

Update the formatCurrency function in src/shared/utils/dataUtils.js to change currency:

export const formatCurrency = (value) => {
  return new Intl.NumberFormat("en-IN", {
    style: "currency",
    currency: "INR", // Change as needed
    minimumFractionDigits: 2,
    maximumFractionDigits: 2,
  }).format(value);
};

Custom Themes

Modify the color scheme in tailwind.config.js or update the CSS classes in components.

πŸ“ Formulas & Calculations Reference

This dashboard uses a comprehensive set of financial calculations. All formulas are centralized in src/lib/calculations/ for consistency and maintainability.

Core Financial Metrics

1. Total Income

Total Income = Sum of all transactions where type = "Income"

Location: src/lib/calculations/aggregations/totals.js

2. Total Expense

Total Expense = Sum of all transactions where type = "Expense"

Location: src/lib/calculations/aggregations/totals.js

3. Net Balance (Savings)

Net Balance = Total Income - Total Expense

Location: src/lib/calculations/financial/savings.js

4. Savings Rate

Savings Rate = ((Total Income - Total Expense) / Total Income) Γ— 100

Interpretation:

  • β‰₯20%: Excellent πŸŽ‰ (Green)
  • β‰₯10%: Good πŸ‘ (Yellow)
  • <10%: Needs Improvement ⚠️ (Red)

Location: src/lib/calculations/financial/savings.js

Spending Analysis

5. Daily Average Spending

Daily Average = Total Expense / Number of Days in Period

Location: src/lib/calculations/aggregations/averages.js

6. Monthly Average Spending

Monthly Average = (Total Expense / Number of Days) Γ— 30.44

Note: 30.44 is the average number of days per month (365.25 / 12)

Location: src/lib/calculations/aggregations/averages.js

7. Average Transaction Value

Average Transaction = Total Transaction Amount / Number of Transactions

Location: src/lib/calculations/aggregations/averages.js

8. Spending Velocity (30-day)

Spending Velocity = (Last 30 Days Daily Average / All-Time Daily Average) Γ— 100

Interpretation:

  • <80%: Spending less than usual (Green)
  • 80-120%: Normal spending range (Yellow)
  • 120%: Spending more than usual (Red)

Location: src/features/kpi/hooks/useCalculations.js

Cashback Calculations

9. Total Cashback Earned

Total Cashback Earned = Sum of all transactions where:
  - Category = "Refund & Cashbacks"
  - Type = "Income"

Location: src/lib/calculations/financial/cashback.js

10. Cashback Shared

Cashback Shared = Sum of all transactions where:
  - Account = "Cashback Shared"
  - Type = "Expense" OR "Transfer-Out"

Location: src/lib/calculations/financial/cashback.js

11. Actual Cashback

Actual Cashback = Total Cashback Earned - Cashback Shared

This represents the cashback you actually kept for yourself after sharing with others

Location: src/lib/calculations/financial/cashback.js

12. Cashback Rate

Cashback Rate = (Total Cashback Earned / Total Credit Card Spending) Γ— 100

Location: src/lib/calculations/financial/cashback.js

13. Per-Card Cashback

For each credit card:
  Card Cashback = Sum of cashback transactions for that card
  Card Cashback Rate = (Card Cashback / Card Spending) Γ— 100

Location: src/lib/calculations/financial/cashback.js

Reimbursement Calculations

14. Total Reimbursements

Total Reimbursements = Sum of all transactions where:
  - Subcategory = "Expense Reimbursement"
  - Type = "Income"

Location: src/lib/calculations/financial/reimbursement.js

15. Average Reimbursement

Average Reimbursement = Total Reimbursements / Number of Reimbursement Transactions

Location: src/lib/calculations/financial/reimbursement.js

Investment Metrics

16. Total Capital Deployed

Total Capital Deployed = Sum of all Transfer-Out to investment accounts

17. Investment Returns

Net Return = (Current Holdings + Withdrawals - Capital Deployed + Realized Profits - Realized Losses - Brokerage Fees)
Return Percentage = (Net Return / Capital Deployed) Γ— 100

Location: src/lib/calculations/financial/index.js

Tax Calculations

18. Taxable Income

Taxable Income = Total Income - Standard Deduction - Section 80C Deductions - HRA Exemption

19. Income Tax (New Regime)

Tax = Sum of (Slab Amount Γ— Slab Rate) for all applicable slabs
Total Tax = Income Tax + 4% Cess on Income Tax

Tax Slabs (New Regime FY 2025-26):

  • β‚Ή0 - β‚Ή4L: 0%
  • β‚Ή4L - β‚Ή8L: 5%
  • β‚Ή8L - β‚Ή12L: 10%
  • β‚Ή12L - β‚Ή16L: 15%
  • β‚Ή16L - β‚Ή20L: 20%
  • β‚Ή20L - β‚Ή24L: 25%
  • Above β‚Ή24L: 30%

Location: src/lib/calculations/financial/index.js

20. HRA Exemption

HRA Exemption = Minimum of:
  1. Actual HRA Received
  2. 50% of Basic Salary (Metro) or 40% (Non-Metro)
  3. Rent Paid - 10% of Basic Salary

Location: src/lib/calculations/financial/index.js

Food & Lifestyle Metrics

21. Food Spending Breakdown

Total Food = Sum of all "Food & Dining" expenses
Delivery Apps = Swiggy + Zomato + Other delivery services
Groceries = Supermarket + Grocery store purchases
Dining Out = Restaurant + CafΓ© expenses
Office Cafeteria = Office food expenses

Daily Average = Total Food / Number of Days
Monthly Average = (Total Food / Number of Days) Γ— 30.44

Location: src/lib/calculations/financial/index.js

22. Transportation Metrics

Total Transportation = Sum of all "Transportation" expenses
Daily Commute = Local transport (metro, bus, auto, bike)
Intercity Travel = Long-distance travel expenses

Daily Average = Total Transportation / Number of Days
Per Trip Average = Total Transportation / Number of Transport Transactions

Location: src/lib/calculations/financial/index.js

Advanced Metrics

23. Net Worth Change

Net Worth = Total Income - Total Expense
Net Worth Per Month = (Net Worth / Number of Days) Γ— 30.44

24. Category Concentration

For each expense category:
  Category Total = Sum of expenses in that category
  Category Percentage = (Category Total / Total Expense) Γ— 100

Top Category Concentration = Highest category percentage

Warning threshold: >50% indicates over-concentration

Location: src/features/kpi/hooks/useCalculations.js

25. Account Balance Tracking

For each account:
  Balance = Sum of:
    + Income to account
    + Transfers In
    - Expenses from account
    - Transfers Out

Location: src/features/kpi/hooks/useCalculations.js

Time Period Calculations

26. Date Range Analysis

Total Days = (End Date - Start Date) in days
Total Months = Total Days / 30.44
Total Years = Total Days / 365.25

Location: src/lib/calculations/time/dateRange.js

Data Aggregation

27. Category Grouping

For each category:
  Total = Sum of all transaction amounts in category
  Count = Number of transactions in category
  Average = Total / Count

Location: src/lib/calculations/aggregations/category.js

28. Monthly Trends

For each month:
  Income = Sum of income transactions in month
  Expense = Sum of expense transactions in month
  Net = Income - Expense
  Growth Rate = ((Current Month - Previous Month) / Previous Month) Γ— 100

Running Balance

29. Cumulative Balance

For each transaction (chronologically):
  Running Balance = Previous Balance + Transaction Amount
  (where Income/Transfer-In adds, Expense/Transfer-Out subtracts)

πŸ“Š Calculation Module Structure

All calculations are organized in a clean, modular structure:

src/lib/calculations/
β”œβ”€β”€ index.js                    # Main exports
β”œβ”€β”€ aggregations/
β”‚   β”œβ”€β”€ averages.js            # Daily, monthly, per-transaction averages
β”‚   β”œβ”€β”€ category.js            # Category grouping and top categories
β”‚   └── totals.js              # Total income and expense
β”œβ”€β”€ financial/
β”‚   β”œβ”€β”€ cashback.js            # All cashback calculations
β”‚   β”œβ”€β”€ reimbursement.js       # Reimbursement calculations
β”‚   β”œβ”€β”€ savings.js             # Savings and savings rate
β”‚   └── index.js               # Investment, tax, food, transport
β”œβ”€β”€ time/
β”‚   └── dateRange.js           # Date range and period calculations
└── legacy.js                  # Legacy calculations (for compatibility)

Using Calculations in Your Code

// Import what you need
import {
  calculateTotalIncome,
  calculateTotalExpense,
  calculateSavingsRate,
  calculateTotalCashbackEarned,
  calculateCashbackShared,
  calculateActualCashback,
  calculateTotalReimbursements,
} from "src/lib/calculations";

// Use in components
const totalIncome = calculateTotalIncome(transactions);
const totalExpense = calculateTotalExpense(transactions);
const savingsRate = calculateSavingsRate(totalIncome, totalExpense);

// Cashback metrics
const cashbackEarned = calculateTotalCashbackEarned(transactions);
const cashbackShared = calculateCashbackShared(transactions);
const actualCashback = calculateActualCashback(transactions);

// Reimbursements
const reimbursements = calculateTotalReimbursements(transactions);

Benefits:

  • βœ… Single source of truth - no duplicate logic
  • βœ… Easy to test and maintain
  • βœ… Consistent calculations across all pages
  • βœ… Well-documented with JSDoc comments
  • βœ… Type-safe with PropTypes validation

πŸ“Š Dashboard Overview

Main Sections

  1. Overview Tab - Your financial command center

    • Main KPI Cards (Income, Expenses, Net Balance)
    • 6 Financial Health Metrics (Savings Rate, Burn Rate, Velocity, etc.)
    • Smart Insights & Recommendations with time filtering
    • Account balances and transfer tracking
  2. Income & Expense Tab - Detailed breakdowns

    • Income vs Expense comparison charts
    • Top expense categories with time filtering
    • Income sources analysis
    • Spending by account visualization
  3. Trends & Forecasts Tab - Temporal analysis

    • Monthly trends with time filtering
    • Daily spending patterns
    • Category-wise spending over time
    • Seasonal variation detection
  4. Category Analysis Tab - Deep dives

    • Subcategory breakdown with drill-down
    • Multi-category time comparisons
    • Category concentration analysis
    • Spending heatmaps
  5. Insights Tab - Advanced analytics

    • Food spending analytics
    • Commute optimization insights
    • Account-level analysis
    • Recurring payment detection
  6. Transactions Tab - Full transaction list

    • Running balance column
    • Advanced filtering and search
    • Proper sorting on all columns
    • Pagination and export capabilities
  7. Budget & Goals Tab - Financial planning

    • Budget tracking by category
    • Goal setting and monitoring
    • Budget vs actual comparison
    • Progress visualization

Key Metrics & Insights

Automatically calculated for your data:

  • Savings rate and financial health score
  • Daily and monthly burn rates
  • Spending velocity (are you spending more than usual?)
  • Category concentration (is spending too concentrated?)
  • Weekend vs weekday spending patterns
  • Most frequent categories and transaction patterns
  • Potential savings opportunities
  • Large transaction alerts
  • Running balance throughout the period

πŸ› Troubleshooting

Common Issues

CSV/Excel Upload Not Working

  • Ensure file follows the exact format specified
  • Check that all required columns are present
  • Verify date format is DD/MM/YYYY
  • For Excel files, ensure data is in the first worksheet

Charts Not Displaying

  • Check browser console for JavaScript errors
  • Ensure all dependencies are installed correctly
  • Verify file data is properly formatted

Build Failures

  • Run pnpm install to ensure all dependencies are installed
  • Check Node.js version compatibility (>=20.0.0 required)
  • Clear pnpm cache: pnpm store prune

πŸ“š Documentation

Comprehensive technical documentation is available in the docs/ folder:

πŸ“– View Full Documentation Index β†’

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature-name
  3. Commit changes: git commit -m 'Add new feature'
  4. Push to branch: git push origin feature-name
  5. Submit a Pull Request

Before contributing:

More Projects

Project Description
LeetCode Rating Predictor Full-stack ML-powered LeetCode contest rating predictor
InstagramLikesLeaderboard Browser tool showing who likes your Instagram posts the most
claude-cost-optimizer Save 30-60% on Claude Code costs - proven strategies and benchmarks
Contact Manager Full-stack MERN contact manager with CRUD and dark mode

πŸ“„ License

This project is open source and available under the MIT License.

πŸ‘€ Author

Sagar Gupta

πŸ™ Acknowledgments


⭐ Star this repository if you find it helpful!

About

React TypeScript financial dashboard with Chart.js analytics, data visualization, trends forecasting, and responsive Tailwind CSS design

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages