A financial stress simulator that models "what-if" scenarios and provides actionable recommendations to extend your financial runway.
Most finance apps show you the present. This models the future under stress:
- Scenarios: Job loss, income cuts, rent increases, emergencies, inflation
- Runway Analysis: How many months until you hit $0?
- Risk Assessment: High/Medium/Low risk scoring
- Actionable Levers: Concrete recommendations with quantified impact
This is the third project in a connected fintech suite:
- Budget Buddy โ Captures real spending behavior
- Cost of Living Calculator โ Provides location baseline assumptions
- Stress Simulator (this) โ Models fragility + tradeoffs under shocks
Technical Connection: This app calls your Cost of Living Calculator API to auto-fill baseline expense assumptions by city. When COL API is unavailable, it falls back to cached data.
Backend (FastAPI + Python)
โโโ Domain Logic (pure Python, no framework deps)
โ โโโ Scenario Engine (6 default scenarios)
โ โโโ Financial Simulator (month-by-month modeling)
โ โโโ Levers Calculator (actionable recommendations)
โโโ API Layer (FastAPI routes)
โโโ Database (PostgreSQL + SQLModel)
โโโ External Integration (COL API client)
Why Python + FastAPI?
- Financial modeling is naturally Python territory
- Demonstrates backend language diversity (vs Node.js in other projects)
- Fast, modern, and typed
- Job Loss - Complete income loss
- Income Cuts - 20% or 40% reduction
- Rent Increase - 15% housing cost spike
- Emergency Expense - $1,500 one-time shock
- Inflation Spike - 5% annual increase in essentials
For each scenario, the app calculates:
- Impact of cutting discretionary spending (10%, 20%, 30%)
- Impact of reducing housing costs (roommate, cheaper location)
- Impact of side income ($300-500/month)
- Emergency fund targets (3-6 months)
Each recommendation shows +months of runway gained.
Backend:
- FastAPI (modern Python web framework)
- SQLModel (SQL databases with Python type hints)
- PostgreSQL (data persistence)
- Pydantic (data validation)
- httpx (async HTTP client for COL API)
- pytest (testing)
Deployment:
- Backend: Render / Railway / Fly.io
- Database: Managed PostgreSQL
- Frontend: Vercel / Netlify
backend/
โโโ app/
โ โโโ core/ # Config, DB connection
โ โโโ models/ # SQLModel database models
โ โโโ domain/ # Pure business logic (testable!)
โ โ โโโ scenarios.py
โ โ โโโ simulator.py
โ โ โโโ levers.py
โ โโโ services/ # External integrations (COL API)
โ โโโ api/
โ โ โโโ routes/ # FastAPI endpoints
โ โโโ tests/ # Unit tests
โ โโโ main.py # FastAPI app
โโโ data/ # Fallback data
โโโ pyproject.toml # Dependencies
POST /api/snapshots- Create financial snapshotGET /api/snapshots/{id}- Get snapshotGET /api/snapshots- List recent snapshots
POST /api/simulate- Run simulations for a snapshotGET /api/simulate/scenarios- List available scenariosGET /api/simulate/snapshots/{id}/results- Get all results for snapshot
GET /health- Health checkGET /- API info
POST /api/snapshots
{
"city": "San Francisco, CA",
"monthly_income_takehome": 6000,
"emergency_fund_balance": 15000,
"essential_total": 3500,
"discretionary_total": 1200,
"use_col_baseline": false
}POST /api/simulate
{
"snapshot_id": "uuid-here"
}Returns:
{
"snapshot_id": "uuid",
"results": [
{
"scenario_type": "job_loss",
"runway_months": 3.2,
"breach_month": 4,
"risk_level": "high",
"top_levers": [
{
"label": "Cut discretionary spending by 50%",
"delta_months": 1.8,
"new_runway_months": 5.0
}
]
}
]
}- Domain-Driven Design: Separating business logic from infrastructure
- Financial Modeling: Month-by-month simulation with compound effects
- Python Type Safety: Using Pydantic and SQLModel for type-safe Python
- Async Python: httpx for non-blocking external API calls
- Testing Domain Logic: Pure functions make testing easy
The domain/ folder contains pure Python with zero framework dependencies. This means:
- Easy to test (no mocking FastAPI/DB)
- Easy to reuse (could wrap in Django, Flask, CLI, etc.)
- Clear business logic separation
Scenarios evolve. Storing results as JSON in the database allows adding fields without migrations.
Demonstrates:
- Calling external APIs from backend
- Graceful degradation (fallback data)
- Real technical connection between projects
- Monte Carlo mode (probabilistic scenarios)
- CSV import from Budget Buddy
- Multi-scenario comparison view
- Savings goal modeling
- Debt payoff optimization
- Tax impact modeling
MIT
Part of the Connected Fintech Suite:
- Budget Buddy
- Cost of Living Calculator
- Finance Stress Simulator (you are here)


