BankBot-AI / hf /README_HF.md
mohsin-devs's picture
Deploy to HF
a282d4b
metadata
title: BankBot AI
emoji: 🏦
colorFrom: blue
colorTo: green
sdk: docker
pinned: true
license: mit
short_description: >-
  AI-Native Financial Operating System β€” real-time streaming, fraud detection,
  forecasting

🏦 BankBot AI

AI-Native Financial Operating System

FastAPI Next.js Python TypeScript Docker OpenAI

A production-grade AI fintech platform with real-time WebSocket streaming, multi-provider AI fallback, fraud detection, financial forecasting, and a premium glassmorphism UI.


πŸš€ Demo

Login with the demo account:

Email:    alex@bankbot.dev
Password: BankBot2026!

The demo account includes:

  • $59,637 across 3 accounts (checking Β· savings Β· investment)
  • 301 transactions across 6 months
  • 1 fraud alert (Tech Store NYC, $847, 78% risk score)
  • 4 financial goals (Emergency Fund Β· Vacation Β· MacBook Β· Down Payment)
  • 4 investments (S&P 500 Β· AAPL Β· BTC Β· Treasury Bonds)
  • 6 notifications (3 unread)

✨ Features

πŸ€– AI Financial Twin

  • Contextual chat β€” AI knows your real balance, goals, investments, and spending patterns
  • 4-tier AI fallback: OpenAI β†’ Groq β†’ Ollama β†’ Rule-based (always responds)
  • Real-time streaming via WebSocket β€” character-by-character with auto-reconnect

πŸ“Š Financial Intelligence

  • Health Score β€” 100-point composite across 6 dimensions
  • What-If Simulator β€” 6 sliders, instant 36-month projection
  • Spending Heatmap β€” weekly behavioral patterns
  • Category Intelligence β€” AI insights per spending category

πŸ›‘οΈ Fraud Detection

  • Real-time scoring β€” amount spikes, timing anomalies, rapid-fire, duplicates
  • Risk levels β€” verified / suspicious / flagged
  • Live alerts β€” notification panel with unread count

⚑ Performance

  • Dashboard: 65ms cold, 10ms cached
  • Cache-aside: Redis β†’ in-memory fallback (automatic)
  • All data endpoints: < 20ms warm

πŸ” Observability

  • Live metrics at /api/metrics
  • System Status page at /status
  • Structured JSON logging with request tracing

πŸ—οΈ Architecture

Browser (port 7860)
    β”‚
    β–Ό
Nginx (port 7860) β€” single entry point
    β”‚                    β”‚
    β–Ό                    β–Ό
Next.js (3000)      FastAPI (8000)
    β”‚                    β”‚
    └─────────────────────
                         β”‚
              β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
              β”‚                     β”‚
         SQLite/PostgreSQL      Redis/Memory
         (auto-fallback)        (auto-fallback)
                         β”‚
              β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
              β”‚          β”‚          β”‚
           OpenAI      Groq      Ollama
           (P1)        (P2)      (P3)
                              Rule-based (P4)

βš™οΈ Configuration (HF Secrets)

Set these in your Space's Settings β†’ Repository secrets:

Secret Required Description
OPENAI_API_KEY Optional* OpenAI GPT-4o-mini
GROQ_API_KEY Optional* Groq llama-3.3-70b (free)
JWT_SECRET_KEY Recommended JWT signing secret
DATABASE_URL Optional External PostgreSQL (Neon/Supabase)
REDIS_URL Optional External Redis

*At least one AI key recommended. Without any key, the app uses rule-based responses from your actual financial data.

Get a free Groq key: https://console.groq.com/keys


πŸ—„οΈ Database Options

Option 1: SQLite (Default β€” works out of the box)

No configuration needed. Data resets on Space restart (fine for demo).

Option 2: Neon PostgreSQL (Persistent)

  1. Create free DB at https://neon.tech
  2. Set DATABASE_URL secret: postgresql://user:pass@ep-xxx.neon.tech/bankbot?sslmode=require

Option 3: Supabase PostgreSQL (Persistent)

  1. Create project at https://supabase.com
  2. Set DATABASE_URL from Settings β†’ Database β†’ Connection string

πŸ“‘ API Endpoints

GET  /health                    Health check
GET  /api/status                Runtime info
GET  /api/metrics               Live observability
GET  /docs                      Interactive API docs

POST /api/auth/login            Login β†’ JWT
POST /api/auth/register         Register
GET  /api/dashboard/overview    Full dashboard (65ms)
GET  /api/transactions/         Transaction history
GET  /api/notifications/        Notifications
GET  /api/ai/coaching/score     Health score
GET  /api/ai/fraud/analysis     Fraud alerts
POST /api/ai/chat               HTTP chat
WS   /api/ai/chat/ws            Streaming chat

πŸ› οΈ Tech Stack

Layer Technology
Frontend Next.js 14, TypeScript, Tailwind CSS
Animation Framer Motion
Charts Recharts
State Zustand
Backend FastAPI, Python 3.11
Database PostgreSQL / SQLite fallback
Cache Redis / in-memory fallback
Auth JWT (python-jose), bcrypt
AI OpenAI / Groq / Ollama / Rule-based
Container Docker (single container)
Proxy Nginx (port 7860)

πŸ“ Source Code

Full source: GitHub Repository

Documentation: