Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

21 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

FinAIlytics

AI-Powered Personal Finance Management Platform

TypeScript React Node.js MongoDB Express.js TailwindCSS

Track. Analyze. Save. β€” The intelligent way to manage your personal finances with AI-powered receipt scanning, automated insights, and beautiful analytics.

Features β€’ Tech Stack β€’ Quick Start β€’ Documentation β€’ Contributing


Why FinAIlytics?

Traditional budgeting apps are tedious. FinAIlytics uses AI to automate the boring stuff:

  • πŸ“Έ Snap & Go β€” Upload receipts, let AI extract the details
  • πŸ“Š Visual Insights β€” Beautiful charts show where your money goes
  • πŸ”„ Auto-Tracking β€” Recurring payments handled automatically
  • πŸ“§ Stay Informed β€” Monthly reports delivered to your inbox

Features

πŸ” Authentication & Security

  • Email/password authentication with bcrypt password hashing
  • JWT-based sessions with access (15min) and refresh (7d) tokens
  • Secure HTTP-only cookies for refresh tokens
  • Protected routes with Passport.js JWT strategy

πŸ’³ Transaction Management

  • CRUD Operations β€” Create, read, update, delete transactions
  • Duplicate Transactions β€” One-click duplication
  • Bulk Import β€” CSV import supporting up to 300 transactions
  • Advanced Filtering β€” By type (income/expense), keyword, recurring status
  • Pagination β€” Efficient list handling with configurable page sizes

πŸ€– AI-Powered Receipt Scanning

  • Upload receipt images (JPEG/PNG, max 2MB)
  • Google Gemini 2.0 Flash extracts: title, amount, date, category, payment method
  • Cloudinary handles image storage and retrieval
  • Review extracted data before saving

πŸ“Š Analytics Dashboard

  • Summary Cards β€” Available balance, total income, total expenses
  • Savings Rate β€” Percentage of income saved (clamped -100% to 100%)
  • Percentage Changes β€” Compare current vs previous period
  • Line Chart β€” Income vs expenses over time
  • Pie Chart β€” Category breakdown (top 3 + others)
  • Date Range Presets β€” Today, Last 7/30 days, This/Last month, This/Last year, All time

πŸ“ˆ Reports & Email

  • On-Demand Reports β€” Generate for any custom date range
  • Automated Reports β€” Weekly or monthly via Resend email
  • Report History β€” View past sent reports
  • Configurable Settings β€” Enable/disable, set frequency

πŸ”„ Recurring Transactions

  • Intervals β€” Daily, Weekly, Monthly, Yearly
  • Auto-Processing β€” Cron job runs hourly to create instances
  • Smart Scheduling β€” Automatically calculates next occurrence

🎨 UI/UX

  • Dark/Light Theme β€” Toggle via settings
  • Responsive Design β€” Works on mobile and desktop
  • Modern Components β€” Built with shadcn/ui and Radix UI
  • Loading States β€” Skeleton loaders for better UX

Tech Stack

Frontend

Technology Purpose
React 18 UI Framework
Vite Build Tool
TypeScript Type Safety
Redux Toolkit + RTK Query State Management & Data Fetching
TailwindCSS Styling
shadcn/ui + Radix UI Component Library
Recharts Data Visualization
React Router DOM Routing
React Hook Form + Zod Form Handling
date-fns Date Utilities

Backend

Technology Purpose
Node.js Runtime
Express.js Web Framework
TypeScript Language
MongoDB + Mongoose Database
Passport.js (JWT) Authentication
Zod Input Validation
node-cron Job Scheduling

External Services

Service Purpose
Google Gemini 2.0 Flash AI Receipt Scanning
Cloudinary Image Storage & CDN
Resend Transactional Email

Quick Start

Prerequisites

  • Node.js 18+
  • MongoDB (local or Atlas)
  • Cloudinary account (for receipts)
  • Google Gemini API key (for AI)
  • Resend API key (for emails, optional in dev)

Clone & Install

# Clone the repository
git clone https://github.com/yourusername/finailytics.git
cd finailytics

# Install backend dependencies
cd backend
npm install

# Install frontend dependencies
cd ../client
npm install

Environment Configuration

Backend (.env)

NODE_ENV=development
PORT=8000
BASE_PATH=/api

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

# JWT
JWT_SECRET=your_super_secret_jwt_key_at_least_32_chars
JWT_EXPIRES_IN=15m
JWT_REFRESH_SECRET=your_refresh_secret_key
JWT_REFRESH_EXPIRES_IN=7d

# Cloudinary
CLOUDINARY_CLOUD_NAME=your_cloud_name
CLOUDINARY_API_KEY=your_api_key
CLOUDINARY_API_SECRET=your_api_secret

# Google AI
GEMINI_API_KEY=your_gemini_api_key

# Email (optional in dev)
RESEND_API_KEY=your_resend_api_key
RESEND_MAILER_SENDER=no-reply@yourdomain.com

# CORS
FRONTEND_ORIGIN=http://localhost:5173

Frontend (.env)

VITE_API_URL=http://localhost:8000/api

Run the Application

# Terminal 1: Backend
cd backend
npm run dev

# Terminal 2: Frontend
cd client
npm run dev

Project Structure

finailytics/
β”œβ”€β”€ docs/                    # Detailed documentation
β”‚   β”œβ”€β”€ api_documentation.md    # Complete API reference
β”‚   β”œβ”€β”€ backend.md             # Backend architecture
β”‚   β”œβ”€β”€ frontend.md            # Frontend architecture
β”‚   β”œβ”€β”€ authentication.md      # Auth flow details
β”‚   β”œβ”€β”€ ocr-receipt-scanning.md # AI receipt scanning
β”‚   β”œβ”€β”€ ai-integration.md      # Google Gemini integration
β”‚   β”œβ”€β”€ analytics.md           # Analytics & reporting
β”‚   β”œβ”€β”€ reports-email.md       # Email reports
β”‚   └── recurring-transactions.md # Recurring transactions
β”‚
β”œβ”€β”€ backend/                 # Express + TypeScript API
β”‚   └── src/
β”‚       β”œβ”€β”€ controllers/     # Route handlers
β”‚       β”œβ”€β”€ services/       # Business logic
β”‚       β”œβ”€β”€ models/         # Mongoose schemas
β”‚       β”œβ”€β”€ routes/         # Express routers
β”‚       β”œβ”€β”€ config/         # Configuration
β”‚       β”œβ”€β”€ middlewares/    # Express middleware
β”‚       β”œβ”€β”€ validators/     # Zod schemas
β”‚       β”œβ”€β”€ utils/          # Helpers
β”‚       β”œβ”€β”€ cron/           # Scheduled jobs
β”‚       └── mailers/        # Email handling
β”‚
└── client/                 # React + Vite frontend
    └── src/
        β”œβ”€β”€ pages/         # Route pages
        β”œβ”€β”€ components/   # UI components
        β”œβ”€β”€ features/      # RTK Query API slices
        β”œβ”€β”€ hooks/        # Custom hooks
        β”œβ”€β”€ layouts/      # Layout components
        β”œβ”€β”€ routes/      # Routing config
        └── lib/          # Utilities

Documentation

For detailed documentation, see the docs/ folder:

Document Description
docs/api_documentation.md Complete API reference with all endpoints, request/response formats
docs/backend.md Backend architecture, folder structure, database schema
docs/frontend.md Frontend pages, components, state management
docs/authentication.md JWT authentication flow, token management
docs/ocr-receipt-scanning.md AI receipt scanning workflow
docs/ai-integration.md Google Gemini AI configuration
docs/analytics.md Analytics endpoints, aggregation pipelines
docs/reports-email.md Report generation, automated emails
docs/recurring-transactions.md Recurring transaction processing

API Endpoints Overview

Authentication

  • POST /api/auth/register β€” Create account
  • POST /api/auth/login β€” Sign in

User

  • GET /api/user/current-user β€” Get profile
  • PUT /api/user/update β€” Update profile

Transactions

  • POST /api/transaction/create β€” New transaction
  • GET /api/transaction/all β€” List (paginated)
  • GET /api/transaction/:id β€” Get one
  • PUT /api/transaction/update/:id β€” Update
  • PUT /api/transaction/duplicate/:id β€” Duplicate
  • DELETE /api/transaction/delete/:id β€” Delete
  • POST /api/transaction/bulk-transaction β€” CSV import
  • DELETE /api/transaction/bulk-delete β€” Bulk delete
  • POST /api/transaction/scan-receipt β€” AI scan

Analytics

  • GET /api/analytics/summary β€” Financial summary
  • GET /api/analytics/chart β€” Chart data
  • GET /api/analytics/expense-breakdown β€” Pie chart data

Reports

  • GET /api/report/all β€” Report history
  • GET /api/report/generate β€” Generate report
  • PUT /api/report/update-setting β€” Configure auto-reports

Scripts

Backend

npm run dev    # Development with hot reload
npm run build  # Compile TypeScript
npm start      # Run production build

Frontend

npm run dev      # Start dev server
npm run build    # Production build
npm run preview  # Preview production

Security Considerations

Important: Never commit real API keys or secrets to version control.

  • All secrets stored in .env files (gitignored)
  • Passwords hashed with bcrypt (12 rounds)
  • JWT tokens with short expiry (15 min)
  • CORS configured for specific origin only
  • Input validation with Zod prevents malformed data
  • MongoDB query injection prevention
  • HTTPS recommended for production

Troubleshooting

Issue Solution
404 on auth from localhost:5173 Ensure VITE_API_URL=http://localhost:8000/api in client/.env
"Transaction numbers are only allowed on a replica set" Use MongoDB replica set or code fallback handles it automatically
Login says "Email/password not found" Email normalized to lowercase; check exact email used at signup
Savings rate unrealistic Values clamped to -100% to 100% for realism

License

MIT License β€” feel free to use for personal or commercial projects.


Contributing

Contributions welcome! Please open an issue or submit a PR.


If you find this useful, please give it a ⭐

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

Packages

Contributors

Languages