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
|
|
- ๐ง Monthly email reports via Resend
- ๐ Automated recurring transactions (cron-enabled)
- ๐ Dark/Light theme support
- ๐ฑ Responsive design
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]
- 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
- 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)
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
Before you begin, ensure you have the following installed:
Node.js 18+
MongoDB (local or cloud)
Cloudinary account (for receipt images)
Google Gemini API key
Resend API key (optional in dev)
1๏ธโฃ Navigate to backend directory and install dependencies:
cd backend
npm install2๏ธโฃ Create .env file (see Example .env Files below)
3๏ธโฃ Start development server:
npm run dev4๏ธโฃ Expected output:
โ
Server is running on port 8000 in development mode
Routes will be available at: http://localhost:8000/api/*
1๏ธโฃ Navigate to client directory and install dependencies:
cd client
npm install2๏ธโฃ Create .env file (see Example .env Files below)
3๏ธโฃ Start development server:
npm run dev4๏ธโฃ Open your browser:
๐ http://localhost:5173
- Sign up and sign in with email/password
- Tokens handled automatically via RTK Query
- Refresh tokens managed with
credentials: "include"
Create transactions with the following details:
- Title, type (income/expense), amount
- Category, date, payment method
- Supports duplicate, update, and delete operations
Endpoint: POST /api/transaction/scan-receipt
How it works:
- Upload receipt image (JPEG/PNG, max 2MB)
- Backend uploads to Cloudinary
- Image processed by Google Gemini AI
- Automatically extracts:
title,amount,datedescription,categorypaymentMethod,type,receiptUrl
- Review and save as transaction
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
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
npm run dev # Start development server with ts-node-dev
npm run build # Compile TypeScript
npm start # Run compiled production servernpm run dev # Start Vite dev server
npm run build # Build for production
npm run preview # Preview production buildNODE_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# Must include /api if backend uses BASE_PATH=/api
VITE_API_URL=http://localhost:8000/apiโ 404 Error on auth/register from localhost:5173
Solution:
- Ensure
client/.envhas: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
โ ๏ธ Important Security Guidelines:
- โ Never commit real API keys or secrets to version control
- โ
Use
.envfiles 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
Personal usage permitted. For commercial usage, follow the original project's license terms.