---
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
[](https://fastapi.tiangolo.com)
[](https://nextjs.org)
[](https://python.org)
[](https://typescriptlang.org)
[](https://docker.com)
[](https://openai.com)
**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](https://github.com/your-username/bankbot-ai)
Documentation:
- [Architecture](./docs/ARCHITECTURE.md)
- [API Reference](./docs/API_DOCUMENTATION.md)
- [Deployment Guide](./docs/DEPLOYMENT_GUIDE.md)
- [ER Diagram](./docs/ER_DIAGRAM.md)