Skip to content

AI-powered personal finance web app to track income/expenses, scan receipts with AI, import CSV transactions, and visualize insights with beautiful analytics

Notifications You must be signed in to change notification settings

Kalpan2007/FinAIlytics

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

16 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ’ฐ FinAIlytics Demo Video

AI-Powered Personal Finance Management Platform

TypeScript React Node.js MongoDB Express.js TailwindCSS

AI-powered personal finance web app to track income/expenses, scan receipts with AI, import CSV transactions, and visualize insights with beautiful analytics.

Features โ€ข Tech Stack โ€ข Setup โ€ข Usage โ€ข Architecture


๐Ÿš€ Key Features

๐Ÿ” Authentication & Security

  • Email + Password authentication
  • JWT-based secure sessions
  • Access & refresh token handling

๐Ÿ’ณ Transaction Management

  • Create, edit, duplicate & delete
  • Bulk CSV import (up to 300 transactions)
  • Recurring transaction support
  • Advanced filtering & search

๐Ÿค– AI-Powered Receipt Scanning

  • Upload receipt image
  • Auto-extract transaction details
  • Powered by Google Gemini AI
  • Cloudinary image storage

๐Ÿ“Š Advanced Analytics

  • Real-time financial summaries
  • Income vs Expense charts
  • Category breakdown pie charts
  • Custom date range presets
  • Savings rate calculation

โšก Additional Features

  • ๐Ÿ“ง Monthly email reports via Resend
  • ๐Ÿ”„ Automated recurring transactions (cron-enabled)
  • ๐ŸŒ“ Dark/Light theme support
  • ๐Ÿ“ฑ Responsive design

๐Ÿ› ๏ธ Tech Stack

Frontend

React Vite TypeScript Redux TailwindCSS Radix UI

Backend

Node.js Express MongoDB Mongoose TypeScript

AI & Cloud Services

Gemini Cloudinary Resend


๐Ÿ“ Architecture Overview

graph TB
    A[Client - React + Vite] -->|API Calls| B[Express Backend]
    B -->|Auth| C[JWT Tokens]
    B -->|Data Storage| D[MongoDB]
    B -->|Image Upload| E[Cloudinary]
    B -->|AI Processing| F[Google Gemini]
    B -->|Email Reports| G[Resend]
    B -->|Scheduling| H[Cron Jobs]
Loading

Frontend Architecture

  • React 18 with Vite for blazing-fast development
  • Redux Toolkit Query for state management & API caching
  • TailwindCSS + shadcn/radix for modern, accessible UI
  • JWT authentication with automatic token refresh
  • Features: CRUD operations, bulk import, AI scan, analytics

Backend Architecture

  • Express + TypeScript for type-safe API development
  • MongoDB + Mongoose for flexible data modeling
  • JWT-based authentication (access + refresh tokens)
  • Cloudinary integration for receipt image storage
  • Google Gemini AI for intelligent receipt parsing
  • Resend for automated email reports
  • Cron jobs for recurring transactions and monthly reports
  • All routes mounted under BASE_PATH (default /api)

๐Ÿ“‚ Project Structure

root
โ”œโ”€ ๐Ÿ”ง backend/
โ”‚  โ”œโ”€ src/
โ”‚  โ”‚  โ”œโ”€ ๐ŸŽฎ controllers/        # Route handlers
โ”‚  โ”‚  โ”œโ”€ โš™๏ธ services/           # Business logic (auth, analytics, transactions)
โ”‚  โ”‚  โ”œโ”€ ๐Ÿ“Š models/             # Mongoose schemas
โ”‚  โ”‚  โ”œโ”€ ๐Ÿ›ฃ๏ธ routes/             # Express routers
โ”‚  โ”‚  โ”œโ”€ โš™๏ธ config/             # Environment, DB, Cloudinary, AI, Passport, CORS
โ”‚  โ”‚  โ”œโ”€ ๐Ÿ› ๏ธ utils/              # Helper functions
โ”‚  โ”‚  โ”œโ”€ ๐Ÿ”’ middlewares/        # Auth & validation
โ”‚  โ”‚  โ””โ”€ index.ts            # Application entry point
โ”‚  โ””โ”€ package.json
โ”‚
โ””โ”€ ๐Ÿ’ป client/
   โ”œโ”€ src/
   โ”‚  โ”œโ”€ ๐Ÿช app/                # RTK store and API client
   โ”‚  โ”œโ”€ โœจ features/           # RTK Query endpoints and types
   โ”‚  โ”œโ”€ ๐ŸŽจ components/         # Reusable UI components
   โ”‚  โ”œโ”€ ๐Ÿ“„ pages/              # Route pages (dashboard, transactions, settings)
   โ”‚  โ”œโ”€ ๐ŸŽญ layouts/            # Base/app layouts
   โ”‚  โ”œโ”€ ๐Ÿ›ฃ๏ธ routes/             # Route configurations
   โ”‚  โ”œโ”€ ๐Ÿ“š lib/                # Helper functions (formatting, etc.)
   โ”‚  โ””โ”€ ๐Ÿ“‹ constant/           # Enums and constants
   โ””โ”€ package.json

๐Ÿš€ End-to-End Setup

๐Ÿ“‹ Prerequisites

Before you begin, ensure you have the following installed:

  • Node.js Node.js 18+
  • MongoDB MongoDB (local or cloud)
  • Cloudinary Cloudinary account (for receipt images)
  • Google Google Gemini API key
  • Resend Resend API key (optional in dev)

โš™๏ธ Backend Setup

1๏ธโƒฃ Navigate to backend directory and install dependencies:

cd backend
npm install

2๏ธโƒฃ Create .env file (see Example .env Files below)

3๏ธโƒฃ Start development server:

npm run dev

4๏ธโƒฃ Expected output:

โœ… Server is running on port 8000 in development mode

Routes will be available at: http://localhost:8000/api/*


๐Ÿ’ป Frontend Setup

1๏ธโƒฃ Navigate to client directory and install dependencies:

cd client
npm install

2๏ธโƒฃ Create .env file (see Example .env Files below)

3๏ธโƒฃ Start development server:

npm run dev

4๏ธโƒฃ Open your browser:

๐ŸŒ http://localhost:5173

๐Ÿ“– Usage Guide

๐Ÿ” Authentication

  • Sign up and sign in with email/password
  • Tokens handled automatically via RTK Query
  • Refresh tokens managed with credentials: "include"

๐Ÿ’ณ Add Transactions

Create transactions with the following details:

  • Title, type (income/expense), amount
  • Category, date, payment method
  • Supports duplicate, update, and delete operations

๐Ÿค– AI Receipt Scan

Endpoint: POST /api/transaction/scan-receipt

How it works:

  1. Upload receipt image (JPEG/PNG, max 2MB)
  2. Backend uploads to Cloudinary
  3. Image processed by Google Gemini AI
  4. Automatically extracts:
    • title, amount, date
    • description, category
    • paymentMethod, type, receiptUrl
  5. Review and save as transaction

๐Ÿ“Š Bulk Import via CSV

Endpoint: POST /api/transaction/bulk-transaction

The client parses CSV and sends JSON:

{
  "transactions": [
    {
      "title": "Coffee",
      "type": "EXPENSE",
      "amount": 4.50,
      "category": "dining",
      "description": "",
      "date": "2025-11-10",
      "paymentMethod": "CASH",
      "isRecurring": false,
      "recurringInterval": null
    }
  ]
}

Transaction Types: INCOME | EXPENSE

Payment Methods: CARD | BANK_TRANSFER | MOBILE_PAYMENT | AUTO_DEBIT | CASH | OTHER

Recurring Intervals: DAILY | WEEKLY | MONTHLY | YEARLY | null

Limits: Up to 300 transactions per request


๐Ÿ“ˆ Analytics

Real-time financial insights:

  • ๐Ÿ’ฐ Summary Dashboard

    • Available Balance
    • Total Income
    • Total Expenses
    • Savings Rate (clamped: โˆ’100% to 100%)
      • โŒ Negative = Overspending (Red)
      • โœ… Positive = Healthy Savings (Green)
  • ๐Ÿ“Š Visualizations

    • Income vs Expenses over time
    • Expense breakdown pie chart
    • Custom date range presets

๐Ÿ“œ Scripts

Backend Commands

npm run dev      # Start development server with ts-node-dev
npm run build    # Compile TypeScript
npm start        # Run compiled production server

Client Commands

npm run dev      # Start Vite dev server
npm run build    # Build for production
npm run preview  # Preview production build

๐Ÿ”ง Example .env Files

backend/.env

NODE_ENV=development
PORT=8000
BASE_PATH=/api

# MongoDB
MONGO_URI=mongodb://localhost:27017/finailytics

# JWT Secrets
JWT_SECRET=your_jwt_secret
JWT_EXPIRES_IN=15m
JWT_REFRESH_SECRET=your_jwt_refresh_secret
JWT_REFRESH_EXPIRES_IN=7d

# AI (Google Gemini)
GEMINI_API_KEY=your_gemini_api_key

# Cloudinary
CLOUDINARY_CLOUD_NAME=your_cloud_name
CLOUDINARY_API_KEY=your_cloudinary_api_key
CLOUDINARY_API_SECRET=your_cloudinary_api_secret

# Email (Resend)
RESEND_API_KEY=your_resend_api_key
RESEND_MAILER_SENDER=no-reply@yourdomain.com

# CORS
FRONTEND_ORIGIN=http://localhost:5173

client/.env

# Must include /api if backend uses BASE_PATH=/api
VITE_API_URL=http://localhost:8000/api

๐Ÿ› Troubleshooting

โŒ 404 Error on auth/register from localhost:5173

Solution:

  • Ensure client/.env has: VITE_API_URL=http://localhost:8000/api
  • Restart Vite after changing environment variables
โŒ 500: "Transaction numbers are only allowed on a replica set member"

Cause: Occurs on MongoDB standalone during transactions

Solution: Backend automatically falls back to non-transactional writes for signup

โŒ Login says "Email/password not found"

Solution:

  • Email lookups are normalized to lowercase
  • Ensure you signed up first with the exact same email
๐Ÿ“Š Savings rate shows unrealistic values

Note: Values are clamped (โˆ’100% to 100%) for display realism

  • Negative values indicate overspending

๐Ÿ”’ Security Notes

โš ๏ธ Important Security Guidelines:

  • โŒ Never commit real API keys or secrets to version control
  • โœ… Use .env files and add them to .gitignore
  • ๐Ÿ” In production:
    • Use HTTPS for all communications
    • Enable secure cookies
    • Configure proper CORS settings
    • Use hardened JWT settings
    • Implement rate limiting
    • Use environment-specific secrets

๐Ÿ“„ License

Personal usage permitted. For commercial usage, follow the original project's license terms.


๐ŸŒŸ If you find this project useful, please give it a star!

Made with ๐Ÿ’ป and โ˜•

About

AI-powered personal finance web app to track income/expenses, scan receipts with AI, import CSV transactions, and visualize insights with beautiful analytics

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages