File size: 7,149 Bytes
a282d4b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
# BankBot AI β€” Presentation Structure (12 Slides)

---

## Slide 1 β€” Title Slide
**BankBot AI**
*An AI-Native Financial Operating System*

Subtitle: Production-grade Β· Real-time Β· Intelligent

Visual: Dark glassmorphism background, animated gradient orb, tech badges

---

## Slide 2 β€” Problem Statement
**Traditional banking apps are passive. BankBot is intelligent.**

| Problem | BankBot Solution |
|---------|-----------------|
| Banks show data, not insights | AI-powered financial analysis |
| No real-time fraud intelligence | Live anomaly detection scoring |
| No personalized coaching | Financial health score + AI briefing |
| No scenario planning | What-If Simulator with 36-month projection |
| No behavioral analysis | Spending heatmap + pattern detection |

Visual: Side-by-side comparison screenshot

---

## Slide 3 β€” Solution Overview
**Your AI Financial Twin**

5 core capabilities:
1. Real-time AI chat with full financial context
2. Predictive balance forecasting (conservative/expected/optimistic)
3. Automated fraud detection (4-factor scoring)
4. Behavioral spending analysis (heatmap, patterns)
5. Interactive what-if financial simulator

Visual: Dashboard screenshot

---

## Slide 4 β€” System Architecture
**Production-Grade Full-Stack Architecture**

```
Next.js 14 Frontend
    ↕ HTTPS / WSS
Nginx (TLS + Rate Limiting)
    ↕
FastAPI Backend (33 routes)
    ↕              ↕              ↕
PostgreSQL 15   Redis 7      AI Engine
β†’ SQLite        β†’ memory     OpenAI β†’ Groq
  fallback        fallback   β†’ Ollama β†’ offline
```

Key point: **Every layer has a fallback β€” the system never fully fails**

---

## Slide 5 β€” AI Intelligence Engine
**4-Tier AI Fallback Chain**

```
Priority 1: OpenAI GPT-4o-mini    (fastest, most capable)
    ↓ if unavailable
Priority 2: Groq llama-3.3-70b    (free tier, very fast)
    ↓ if unavailable
Priority 3: Local Ollama llama3   (fully offline)
    ↓ if unavailable
Priority 4: Rule-based engine     (always available)
```

Context injected per message:
- Live account balances Β· Transaction history
- Financial goals Β· Investment portfolio
- Behavioral patterns Β· Health score

Visual: Chat page with streaming animation

---

## Slide 6 β€” Real-Time WebSocket Architecture
**Streaming AI + Live Updates**

```
Browser ──WS connect──► FastAPI
Browser ──{ type: "chat", message: "..." }──►
         ◄──{ type: "chat_start" }──
         ◄──{ type: "chat_chunk", content: "H" }──
         ◄──{ type: "chat_chunk", content: "er" }──
         ◄──{ type: "chat_end" }──
Browser ──{ type: "ping" }──► (every 25s)
         ◄──{ type: "pong" }──
```

Features:
- Character-by-character streaming
- Heartbeat every 25s
- Exponential backoff reconnect (1s β†’ 2s β†’ 4s β†’ 30s max)
- HTTP fallback when WebSocket unavailable
- Prompt injection prevention (9 regex patterns)

---

## Slide 7 β€” Financial Intelligence
**AI-Powered Analytics**

- **Health Score** β€” 100-point composite (6 dimensions)
- **Spending Heatmap** β€” weekly activity patterns
- **Category Intelligence** β€” AI insights per spending category
- **Net Worth Timeline** β€” balance trajectory
- **Behavioral Analysis** β€” late-night spending, weekend patterns
- **Subscription Optimization** β€” detect unused subscriptions

Visual: Analytics page screenshot

---

## Slide 8 β€” Fraud Detection Algorithm
**Real-Time Anomaly Scoring**

```
Transaction β†’ Score 4 factors:
  Amount spike    > 3.5x avg  β†’ +40 pts
  Timing anomaly  11PM–4AM    β†’ +25 pts
  Rapid-fire      < 3min gap  β†’ +20 pts
  Duplicate       same+10min  β†’ +30 pts

Score β‰₯ 30 β†’ logged to fraud_logs
Score β‰₯ 50 β†’ status: "flagged"
Score < 30 β†’ status: "verified"
```

Visual: Fraud alert notification screenshot

---

## Slide 9 β€” Performance & Caching
**Cache-Aside Pattern with Auto-Fallback**

| Endpoint | Cold | Cached | TTL |
|----------|------|--------|-----|
| Dashboard | 65ms | 10ms | 2 min |
| AI Score | ~2s | 10ms | 10 min |
| AI Briefing | ~3s | 10ms | 1 hr |
| Transactions | 18ms | β€” | β€” |

Optimization: `Query.with_entities()` β€” column-only queries, no ORM hydration
Result: **32x speedup** (2.1s β†’ 65ms)

Cache: Redis β†’ in-memory fallback (automatic, zero config)

---

## Slide 10 β€” Database Design
**10-Table Normalized Schema**

Core tables:
- `users` β€” profile, personality, AI settings
- `accounts` β€” checking/savings/investment
- `transactions` β€” 300+ with categories, tags, emotion labels
- `goals` β€” target amounts, AI-generated plans
- `investments` β€” portfolio with AI risk analysis
- `subscriptions` β€” with AI usage detection
- `notifications` β€” typed alerts (fraud/insight/warning)
- `fraud_logs` β€” risk scores, details, status
- `ai_insights` β€” cached AI-generated content
- `analytics_snapshots` β€” daily financial snapshots

Fallback: PostgreSQL β†’ SQLite (automatic, same ORM code)

---

## Slide 11 β€” Security & Observability
**Production-Grade Engineering**

Security:
- JWT (60min access + 7-day refresh rotation)
- bcrypt hashing (rounds=12, direct library)
- Rate limiting (120/min API, 10/min auth)
- Security headers (CSP, X-Frame-Options, etc.)
- Prompt injection prevention (9 patterns)
- CORS restricted to configured origins

Observability (`GET /api/metrics`):
- Request count, error rate, auth failures
- AI provider health (calls/errors/latency)
- Cache hit ratio
- Per-route timing (avg + max)
- Last 50 errors with timestamps

CI/CD: GitHub Actions (backend lint, frontend build, Docker smoke test)

---

## Slide 12 β€” Demo + Conclusion
**Live Demo**

Demo flow (5 min):
1. Login β†’ Dashboard (65ms load)
2. AI Chat β†’ WebSocket streaming
3. What-If Simulator β†’ live sliders
4. Analytics β†’ heatmap + radar
5. System Status β†’ live metrics

**What makes this different:**
- Not a prototype β€” deployable to production today
- Every feature backed by real data (301 transactions)
- AI that knows your finances, not generic advice
- Resilient architecture that never fully fails
- Full observability β€” you can see it working

**Numbers:**
33 routes Β· 14 pages Β· 10 DB tables Β· 65ms dashboard Β· 4-tier AI fallback

---

## Presenter Notes

**Opening line:**
> "Most banking apps show you data. BankBot understands it."

**Closing line:**
> "This isn't a student project that happens to use an AI API. It's a production-grade system where AI is the core β€” every response is personalized, every insight is grounded in real data, and every layer has a fallback."

**If asked about deployment:**
> "The frontend is on Vercel, the backend on Render with managed PostgreSQL and Redis. The whole stack can also run locally with a single command β€” `run.bat` on Windows."

**If asked about the most impressive feature:**
> "The AI orchestration layer. It builds a personalized system prompt from the user's live database records, streams the response through whichever AI provider is available, and falls back gracefully through 4 levels. Very few projects implement this kind of resilient AI infrastructure."