CoolFace
Apppublic

UmairLari/ai-financial-advisor-backend

sourceHugging Faceupdated 18h agoView on Hugging Face
1likes
App README

<div align="center">

<img src="https://img.shields.io/badge/Status-Live-brightgreen?style=for-the-badge" /> <img src="https://img.shields.io/badge/Frontend-Vercel-black?style=for-the-badge&logo=vercel" /> <img src="https://img.shields.io/badge/Backend-HuggingFace-yellow?style=for-the-badge&logo=huggingface" /> <img src="https://img.shields.io/badge/AI-Groq%20LLaMA--3-blueviolet?style=for-the-badge" /> <img src="https://img.shields.io/badge/DB-MongoDB%20Atlas-green?style=for-the-badge&logo=mongodb" />

FinPass AI

Your Personal AI Financial Advisor โ€” Built for India's Future Investors

[๐Ÿš€ Try Live App](https://ai-driven-invest-planner.vercel.app) &nbsp;ยท&nbsp; [๐Ÿ“– Full Docs](./docs/PRODUCT_DOCS.md) &nbsp;ยท&nbsp; [๐Ÿ–ผ Screenshots](./docs/SCREENSHOTS.md)

</div>


โŒ The Problem

Most Indians earn enough to build real wealth โ€” but never do.

Not because they don't try. But because the system is broken:

  • โ€”๐Ÿ’ธ No one explains where their money actually goes โ€” expenses, debt, and lifestyle creep silently consume every rupee of surplus
  • โ€”๐Ÿ“‰ Generic advice doesn't work โ€” "invest in SIPs" means nothing without knowing how much, in what, and for how long, tailored to your income
  • โ€”๐Ÿงฎ Planning tools are either too complex or too shallow โ€” spreadsheets intimidate beginners; generic apps give useless blanket advice
  • โ€”๐Ÿ”ฎ People invest blind โ€” no way to simulate outcomes, stress-test goals, or see if they're on track
  • โ€”๐Ÿค– AI tools exist โ€” but not for personal finance in India โ€” no product combines real financial math with conversational AI in a single accessible platform

The result? Millions of earning Indians leave their money idle in savings accounts, missing a decade of compounding returns.


โœ… The Solution โ€” FinPass AI

FinPass AI is a full-stack, AI-powered financial advisor built for Indian investors. It combines rigorous financial mathematics with Groq-powered LLaMA-3 AI to give you:

A personalized investment plan, goal probability forecast, and a conversational AI advisor โ€” all in one intelligent dashboard.

You input your financials once. FinPass AI tells you exactly:

  • โ€”Where your money is going (visual cash flow breakdown)
  • โ€”Whether you'll hit your goal (Monte Carlo probability with 1,000 simulations)
  • โ€”How to allocate your investments (risk-adjusted asset allocation)
  • โ€”What to do next (AI-generated, context-aware action plan)

No spreadsheets. No jargon. No guessing.


๐ŸŽฏ Who Is It For?

ProfileWhat FinPass AI Does For Them
๐Ÿง‘โ€๐Ÿ’ผ Salaried ProfessionalsAnalyzes take-home pay, expenses & SIP capacity; shows retirement readiness
๐Ÿš€ First-Time InvestorsDemystifies asset allocation โ€” tells you exactly where to put your money
๐ŸŽ“ Young Adults (22โ€“35)Shows the power of early investing through SIP projections and compounding math
๐Ÿ’ผ Self-Employed / FreelancersHandles variable income; sets conservative projections
๐Ÿ‘จโ€๐Ÿ‘ฉโ€๐Ÿ‘ง Goal-Oriented FamiliesTracks multiple financial goals โ€” home, retirement, education โ€” in one place

โšก Key Features

๐Ÿง  AI Financial Intelligence

  • โ€”Groq LLaMA-3 Analysis โ€” Sends your full financial profile to LLaMA-3.1-8b-instant and returns a personalized health score (0โ€“100), honest assessment, and 3 actionable recommendations
  • โ€”Conversational AI Advisor โ€” Chat with an AI that knows your portfolio โ€” ask anything about your finances in plain English
  • โ€”Graceful Fallback โ€” If AI is unavailable, a deterministic rule engine computes the same fields instantly

๐Ÿ“Š Goal Intelligence Engine

  • โ€”SIP Future Value Formula โ€” Calculates your projected corpus at goal maturity:
  FV = P ร— [(1 + r)^n โˆ’ 1] / r

Where P = monthly surplus, r = monthly return rate, n = timeline in months

  • โ€”Monte Carlo Simulation โ€” Runs 1,000 simulations with Gaussian noise to compute statistical goal probability
  • โ€”Gap Analysis โ€” Shows exactly how far you are from your target and what it takes to close the gap
  • โ€”Plain-English Verdicts โ€” "On Track ยท Slightly Behind ยท Needs Immediate Attention"

๐Ÿ’น Cash Flow Analysis

  • โ€”Full visual breakdown of income โ†’ Expenses ยท Debt ยท Investments ยท Surplus
  • โ€”Live progress bars with โ‚น values for every allocation category
  • โ€”Key financial ratios: Savings Rate ยท Debt-to-Income ยท Expense Ratio

๐Ÿ“ˆ Smart Asset Allocation (Risk-Based)

Risk AppetiteEquityDebtGold
๐ŸŸข Low30%60%10%
๐ŸŸก Moderate60%30%10%
๐Ÿ”ด High80%15%5%

๐Ÿ–ฅ Personalized Dashboard

  • โ€”Real-time stat cards: Monthly Income ยท Total Portfolio ยท Goal Target ยท Monthly Debt
  • โ€”Interactive Chart.js donut for cash flow visualization
  • โ€”Live goal probability progress bar (pulled from /api/goal-intelligence)
  • โ€”AI Advisor chat panel embedded directly in the dashboard
  • โ€”Dark / Light mode with glassmorphism UI

๐Ÿง™โ€โ™‚๏ธ Guided Onboarding Wizard

  • โ€”3-step guided setup: Financial Goal โ†’ Monthly Financials โ†’ Investment Preferences
  • โ€”Session-saved โ€” resume exactly where you left off
  • โ€”Completed in under 5 minutes

๐Ÿ”„ How It Works

User Registers โ†’ Onboarding Wizard (3 steps) โ†’ Dashboard
                                                    โ”‚
                                    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                                    โ–ผ                               โ–ผ
                           Goal Intelligence Engine          AI Advisor Chat
                      (SIP FV Math + Monte Carlo)       (Groq LLaMA-3 Analysis)
                                    โ”‚                               โ”‚
                                    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                                    โ–ผ
                                       Personalized Dashboard
                            (Stat Cards ยท Cash Flow ยท Goal Bar ยท Insights)

Investment Route Logic

The system determines your investment recommendation by combining:

  1. 1.Risk appetite (Low / Moderate / High) set during onboarding wizard
  2. 2.Investable surplus = Monthly Income โˆ’ Expenses โˆ’ Debt EMI
  3. 3.Goal timeline โ€” shorter timelines shift allocation toward safer debt instruments
  4. 4.AI verdict (HOLD / BUY / REBALANCE) โ€” computed by the financial agent

๐Ÿ›  Tech Stack

LayerTechnology
FrontendHTML5 ยท Vanilla CSS (style.css) ยท Tailwind CDN ยท Chart.js ยท Google Fonts (Inter)
BackendPython Flask 3.0 ยท Gunicorn (2 workers, 4 threads)
AI ModelGroq SDK ยท llama-3.1-8b-instant (temp 0.4 analysis / 0.5 chat)
DatabaseMongoDB Atlas via PyMongo + Certifi TLS
AuthWerkzeug scrypt/pbkdf2 password hashing
Frontend DeployVercel (static, frontend/ root)
Backend DeployHugging Face Spaces (Docker container)

๐Ÿš€ Live Deployment

ServiceHostsURL
VercelFrontendai-driven-invest-planner.vercel.app
Hugging Face SpacesBackend Flask APIumairlari-ai-financial-advisor-backend.hf.space

๐Ÿ— Project Structure

AI-Financial Advisor/
โ”œโ”€โ”€ backend/
โ”‚   โ”œโ”€โ”€ main.py                   โ† Flask app + 21 API endpoints
โ”‚   โ”œโ”€โ”€ groq_service.py           โ† Groq AI client + financial insights
โ”‚   โ”œโ”€โ”€ ai/                       โ† LLaMA-3 client, prompts, response formatter
โ”‚   โ”œโ”€โ”€ ml/                       โ† SIP math (goal_intelligence.py), Monte Carlo (goal_predictor.py)
โ”‚   โ”œโ”€โ”€ analytics/                โ† compute_financial_health()
โ”‚   โ”œโ”€โ”€ core/                     โ† Rule engine, FinancialState, MarketState
โ”‚   โ”œโ”€โ”€ agent/                    โ† AI decision agent, what-if analysis
โ”‚   โ””โ”€โ”€ routes/                   โ† /api/advisor/chat, /api/intelligence/insights
โ”‚
โ”œโ”€โ”€ frontend/
โ”‚   โ”œโ”€โ”€ css/style.css             โ† Master stylesheet (dark/light CSS variables, 1300+ lines)
โ”‚   โ”œโ”€โ”€ js/                       โ† dashboard.js ยท wizard.js ยท api.js ยท theme.js ยท login.js
โ”‚   โ””โ”€โ”€ static/                   โ† index.html ยท login.html ยท register.html ยท dashboard.html
โ”‚
โ””โ”€โ”€ docs/
    โ”œโ”€โ”€ PRODUCT_DOCS.md           โ† Full product documentation
    โ””โ”€โ”€ SCREENSHOTS.md            โ† Visual app walkthrough

๐Ÿ“– Documentation

DocumentDescription
[PRODUCT_DOCS.md](./docs/PRODUCT_DOCS.md)Full feature docs, user flows, recommendation logic, API reference
[SCREENSHOTS.md](./docs/SCREENSHOTS.md)Visual walkthrough โ€” every page of the live app

โš™๏ธ Running Locally

Backend

bash
cd backend
pip install -r requirements.txt
# Create .env with: MONGO_URI, GROQ_API_KEY, DB_NAME, COLLECTION_NAME, PORT
python main.py
# Runs on http://localhost:5000

Frontend

bash
npx serve frontend
# config.js automatically switches BACKEND_URL between localhost:5000 and prod

๐Ÿ” Environment Variables

env
MONGO_URI=mongodb+srv://...         # MongoDB Atlas connection string
DB_NAME=mockDB                      # Database name
COLLECTION_NAME=userGoals           # Collection name
GROQ_API_KEY=gsk_...                # Groq API key (LLaMA-3 access)
PORT=5000                           # Server port

โš ๏ธ Disclaimer

FinPass AI is an educational and informational tool only. It does not execute trades, manage funds, or provide legally binding financial advice. All projections are illustrative. Please consult a SEBI-registered investment advisor before making significant financial decisions.


<div align="center">

Made with โค๏ธ by Umair Lari &nbsp;|&nbsp; ยฉ 2026 FinPass AI ยท All Rights Reserved

</div>