Skip to content

Modern personal finance management system with intelligent insights - Track debts, savings, budgets, investments, and financial goals

Notifications You must be signed in to change notification settings

shubhamattri/finflow

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

12 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

FinFlow

A modern personal finance management system built with Next.js 14, TypeScript, and Prisma. Designed for home use to manage debts, savings, budgets, investments, and financial goals with intelligent insights and recommendations.

Features

  • ๐Ÿ“Š Transaction Tracking - Income and expenses with categories
  • ๐Ÿ’ณ Account Management - Multiple bank accounts with reconciliation
  • ๐Ÿ’ฐ Debt Management - Track loans with EMI calculations
  • ๐ŸŽฏ Savings Goals - Set and monitor savings targets
  • ๐Ÿ“… Budget Planning - Monthly and yearly budgets
  • ๐Ÿ“ˆ Investment Tracking - SIP and lump sum investments with returns
  • ๐Ÿ“‰ Analytics - Charts and insights with spending trends
  • ๐Ÿงฎ Financial Calculators - EMI, SIP, Prepay vs Invest
  • ๐Ÿ’ฌ WhatsApp Integration - Manage finances via WhatsApp (optional)

Tech Stack

  • Frontend: Next.js 14, React 18, TypeScript, Tailwind CSS
  • Backend: Next.js API Routes, Prisma ORM
  • Database: SQLite (easily switchable to PostgreSQL)
  • Charts: Recharts
  • AI: Google Gemini Pro (optional for WhatsApp)

Quick Start

# Install dependencies
npm install

# Set up database
npm run db:push
npm run db:generate

# Initialize with default data
npm run db:init

# Start development server
npm run dev

Visit http://localhost:3000 to access the dashboard

Data Migration

Import your historical data from Excel:

# Place HomeBudget.xlsx and LoanDetails.xlsx in project root
npm run db:migrate

Project Structure

โ”œโ”€โ”€ app/                    # Next.js app directory
โ”‚   โ”œโ”€โ”€ (dashboard)/       # Dashboard pages (transactions, debts, etc.)
โ”‚   โ”œโ”€โ”€ api/               # API routes (32+ endpoints)
โ”‚   โ””โ”€โ”€ globals.css        # Global styles
โ”œโ”€โ”€ components/            # React components
โ”‚   โ””โ”€โ”€ forms/            # Form components
โ”œโ”€โ”€ lib/                   # Utilities and helpers
โ”‚   โ”œโ”€โ”€ calculations.ts   # Financial calculations (EMI, SIP, etc.)
โ”‚   โ”œโ”€โ”€ decision-engine.ts # Financial recommendations
โ”‚   โ”œโ”€โ”€ ai-parser.ts      # AI-powered message parsing
โ”‚   โ””โ”€โ”€ whatsapp-parser.ts # WhatsApp message parsing
โ”œโ”€โ”€ modules/               # Feature modules (modular monolith)
โ”‚   โ”œโ”€โ”€ transactions/     # Transaction management
โ”‚   โ”œโ”€โ”€ debts/           # Debt management
โ”‚   โ”œโ”€โ”€ savings/         # Savings goals
โ”‚   โ”œโ”€โ”€ budget/          # Budget management
โ”‚   โ”œโ”€โ”€ accounts/        # Account management
โ”‚   โ””โ”€โ”€ investments/     # Investment tracking
โ”œโ”€โ”€ prisma/               # Database schema and migrations
โ”œโ”€โ”€ scripts/             # Utility scripts
โ”‚   โ”œโ”€โ”€ init-db.ts      # Database initialization
โ”‚   โ””โ”€โ”€ migrate-sheets.ts # Excel data migration
โ””โ”€โ”€ shared/              # Shared services
    โ”œโ”€โ”€ cache/          # Caching service
    โ”œโ”€โ”€ events/         # Event system
    โ””โ”€โ”€ queue/          # Background jobs

API Endpoints

Core Resources

  • /api/transactions - Transaction CRUD
  • /api/debts - Debt management
  • /api/savings - Savings goals
  • /api/budget - Budget management
  • /api/accounts - Account management
  • /api/investments - Investment tracking

Analytics

  • /api/analytics/spending-trend - Spending over time
  • /api/analytics/category-breakdown - Expenses by category
  • /api/analytics/net-worth-trend - Net worth progression

Utilities

  • /api/dashboard/stats - Dashboard statistics
  • /api/advice - Financial recommendations
  • /api/summary - Overall financial summary
  • /api/whatsapp/webhook - WhatsApp integration

WhatsApp Integration

For WhatsApp integration setup, see WHATSAPP_SETUP_GUIDE.md.

Supported Commands:

add expense 500 food lunch
add income 50000 salary
balance
show debts
show savings
how much did I spend on food?
can I afford 20000?

Authentication

Current: No authentication (home use, single household) Production: See AUTH_IMPLEMENTATION_GUIDE.md for multi-user deployment

Deployment

PM2 (Recommended)

npm run build
pm2 start npm --name "finance-app" -- start

Docker

docker build -t finance-app .
docker run -p 3000:3000 finance-app

Environment Variables

Create .env file:

# Database (optional, defaults to SQLite)
DATABASE_URL="file:./prisma/finance.db"

# Google Cloud (optional, for AI features)
GOOGLE_CLOUD_PROJECT=your-project-id
GOOGLE_CLOUD_LOCATION=us-central1

# NextAuth (optional, for production multi-user)
NEXTAUTH_URL=http://localhost:3000
NEXTAUTH_SECRET=your-secret-here

Key Features Explained

Financial Calculators

  • EMI Calculator: Calculate monthly payments for loans
  • SIP Calculator: Project investment returns with step-up
  • Prepay Analyzer: Compare prepayment vs investment returns

Analytics & Insights

  • Spending trends over last 6 months
  • Category-wise expense breakdown
  • Net worth progression
  • Budget vs actual comparison
  • Investment returns tracking

Decision Engine

  • Affordability checks
  • Debt payoff recommendations (snowball/avalanche)
  • Budget alerts
  • Savings goal progress
  • Financial health score

Database Schema

Key models:

  • Transaction - Income/expense records
  • Account - Bank accounts
  • Debt - Loans with EMI tracking
  • SavingsGoal - Savings targets
  • Budget - Monthly/yearly budgets
  • Investment - SIP/lump sum investments
  • FinancialYear - Financial year tracking
  • FinancialAlert - Automated alerts

Scripts

npm run dev          # Start development server
npm run build        # Build for production
npm run start        # Start production server
npm run db:generate  # Generate Prisma client
npm run db:push      # Push schema to database
npm run db:init      # Initialize with seed data
npm run db:migrate   # Import Excel data

Development

Built with modular monolith architecture for clean separation of concerns while maintaining simplicity of deployment.

Architecture:

  • API Layer: Next.js API routes
  • Service Layer: Business logic (modules/*/services)
  • Repository Layer: Database access (modules/*/repositories)
  • Shared Services: Cache, events, queue

Production Considerations

Security

  • โœ… All numeric inputs validated
  • โœ… No NaN can enter database
  • โœ… XLSX vulnerability patched
  • โœ… SQL injection prevention (Prisma)

Performance

  • โœ… Database queries optimized
  • โœ… Caching implemented
  • โœ… Atomic operations for concurrency
  • โœ… Transaction-wrapped deletes

Data Integrity

  • โœ… Comprehensive validation
  • โœ… Race condition prevention
  • โœ… Atomic increment operations
  • โœ… Foreign key constraints

License

MIT License - Free to use for personal and commercial purposes.

Support

For issues or questions, check the documentation files:

  • WHATSAPP_SETUP_GUIDE.md - WhatsApp integration
  • AUTH_IMPLEMENTATION_GUIDE.md - Multi-user authentication

Status: โœ… Production Ready
Version: 1.0.0
Build: โœ… Successful (0 errors, 0 warnings)

Made with โค๏ธ for better financial management.

About

Modern personal finance management system with intelligent insights - Track debts, savings, budgets, investments, and financial goals

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages