InsightLedger
AI-assisted personal finance and budgeting
Local-first personal finance workspace that tracks spending, manages budgets, and surfaces Gemini-powered insights over your live data.
Overview
What it solves
Gives individuals a single place to plan budgets, review transactions, and ask natural-language questions about their spending.
Ships with demo data so reviewers can try features instantly without setup.
Guardrails
Input validation, rate limiting, strict CORS, and hardened error handling on the Express API.
JWT auth with per-user data isolation and bcrypt password hashing.
Features
Secure auth and RBAC with JWT, bcrypt hashing, and role-based access.
Full CRUD for income/expense transactions with filters, search, pagination, and CSV export.
Category-level budgets with progress indicators, periods, and overspend highlights.
Custom categories with icons/colors per user and uniqueness enforcement.
Analytics dashboards for income vs expenses, spending by category, and trends.
Gemini-powered insights and chat with suggested questions from live data.
Responsive React SPA with consistent design system and offline-friendly demo data.
Security-first Express backend with validation, rate limits, CORS, and hardened errors.
Tech Stack
Frontend
Backend
Tooling
Architecture
React SPA (frontend/src) renders Home, Transactions, Budgets, Categories, Analytics, and AI Chat. Context handles auth and shared state; API modules talk to Express.
Express API (/api) with Helmet, CORS, JSON parsing, rate limiting, auth middleware, and centralized error handling. Routes grouped by auth, transactions, categories, budgets, analytics.
MongoDB models for users, transactions, categories, budgets with indexes on user/date/category. Aggregation pipelines power analytics endpoints. Gemini integration encapsulated in config/services and used by analytics Q&A and suggested questions.
Flow: React SPA ⇄ Express API ⇄ MongoDB · React SPA ⇄ Express /analytics → Gemini API
Getting Started
Prerequisites & Install
Node.js 14+, MongoDB 4.4+, npm/yarn; optional Gemini API key.
Run
Configuration
Backend (.env)
Frontend (.env)
Key config: backend/src/config/database.ts, backend/src/config/gemini.ts, backend/src/middleware/auth.ts, backend/src/middleware/errorHandler.ts.
API / Modules
- Auth: POST /api/auth/register, POST /api/auth/login (returns JWT + user).
- Transactions: GET/POST/PUT/DELETE /api/transactions with filters and pagination.
- Categories: GET/POST/PUT/DELETE /api/categories.
- Budgets: GET/POST/PUT/DELETE /api/budgets.
- Analytics & AI: GET /api/analytics/dashboard, /spending-by-category, /monthly-trends; POST /api/analytics/ask, /suggestions.
- Health: GET /api/health.
Data & Migrations
MongoDB collections for users, transactions, categories, budgets with indexes on user/date/category.
Aggregation pipelines for analytics; schema evolution handled in Mongoose code (no external migration framework).
Demo user auto-created via config; other seed data created via UI/API.
Testing
Frontend: CRA Jest + React Testing Library (tests in frontend/src). Run: npm test inside frontend.
Backend: npm test placeholder today; planned unit + integration coverage for controllers/services.
Manual flows: auth, CRUD for transactions/categories/budgets, analytics screens, AI chat, rate limits, validation messaging.
CI/CD
No workflows committed yet; recommended CI runs backend/frontend builds plus frontend tests on PRs, with lint/type-check jobs.
Deployment options: Render/Heroku/VPS for backend; Netlify/Vercel/static hosting for frontend (serve frontend/build).
Suggested: staging auto-deploy from main, manual approval to production.
Performance & Security
Performance: Aggregation pipelines; indexed queries; focused analytics responses; production build for SPA.
Security: JWT + RBAC; bcrypt password hashing; validation/sanitization; rate limiting; helmet headers; trusted CORS; centralized error handling.
Recommendations: HTTPS, strong secrets, DB auth, logging/monitoring, future caching layer.
Roadmap
Short term
Medium term
Long term
Contributing
Use feature branches; keep controllers thin and push logic into helpers/services.
TypeScript everywhere; explicit interfaces for API payloads/models; mirror validation and error-handling patterns.
Commit style: conventional, descriptive (e.g., feat: add recurring transaction model).
Update docs when behavior or setup changes (API docs, deployment notes).
License & Credits
License: ISC declared in backend package.json; add a root LICENSE for public release if needed.
Credits: React, React Router, CRA, Recharts, Axios, Express, Mongoose, JWT, bcryptjs, Helmet, express-validator, express-rate-limit, Gemini API.