TraceBack helps you understand exactly what caused you to overspend — and what to do about it. By securely connecting to your bank account via Plaid, TraceBack provides detailed financial analysis including spending patterns, category breakdowns, and actionable insights into your transaction history.
🔗 Live Demo: https://trace-back.netlify.app/
- 🏦 Secure Bank Connection - Connect your bank account safely via Plaid
- 📊 Spending Analysis - Comprehensive breakdown of expenses by category
- 📈 Weekly Trace - Visualize spending patterns across weeks
- 🎯 Overspend Detection - Identify which categories and transactions caused overspending
- 📅 Multi-Month Analysis - Compare spending patterns across different time periods
- 🔍 Category Drilldown - Deep dive into specific spending categories
- 💡 Counterfactual Analysis - Understand what-if scenarios for better budgeting
- 📌 Shapley Attribution - ML-powered feature importance analysis for spending insights
- React 19.2.4 - Modern UI library
- Vite 8.0.4 - Fast build tool and dev server
- Tailwind CSS 3.4.19 - Utility-first CSS framework
- Recharts 3.8.1 - Composable charting library
- Plaid Link - Secure bank account authentication
- FastAPI 0.135.3 - Modern Python web framework
- Plaid Python SDK 39.0.0 - Bank account integration
- Python 3.11+ - Core runtime
- Frontend Deployment: Netlify
- Backend Deployment: Render
- Authentication: Plaid Link (OAuth-based)
- Data Storage: Plaid API (transactions stored in Plaid, access tokens securely cached locally)
-
Bank Connection Flow
- User clicks "Link Bank Account" on the frontend
- Frontend requests a link token from the backend
- Plaid Link widget opens securely
- User selects bank and authenticates
- Frontend receives
public_tokenfrom Plaid Link - Frontend sends
public_tokento backend for exchange - Backend exchanges for
access_token(stored securely)
-
Transaction Analysis Flow
- User selects a month to analyze
- Frontend requests analysis data from backend
- Backend fetches transactions from Plaid API
- Backend performs overspend analysis:
- Categorizes transactions using Plaid's personal finance categories
- Calculates spending by category
- Applies counterfactual and Shapley attribution analysis
- Identifies overspend drivers
- Backend returns analysis results to frontend
- Frontend visualizes data with interactive charts
Frontend (React/Vite)
↓
Backend (FastAPI)
↓
Plaid API
↓
User's Bank
- Python 3.11+
- Node.js 18+
- Plaid account (sandbox keys available at plaid.com)
-
Navigate to backend directory
cd backend -
Create and activate virtual environment
python3 -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install dependencies
pip install -r requirements.txt
-
Create
.envfile with Plaid credentials:PLAID_CLIENT_ID=your_client_id PLAID_SECRET=your_secret PLAID_ENVIRONMENT=sandbox
-
Run backend server
PYTHONPATH=$(pwd) ./venv/bin/uvicorn main:app --reload --port 8000Backend runs at
http://localhost:8000
-
Navigate to frontend directory
cd frontend -
Install dependencies
npm install
-
Create
.env.localfile (for local API connection):VITE_API_URL=http://localhost:8000/api
-
Run development server
npm run dev
Frontend runs at
http://localhost:5173
Open http://localhost:5173 in your browser and start analyzing!
Frontend (Netlify)
VITE_API_URL: Your Render backend URL with/apipath- Example:
https://traceback-backend-xxxx.onrender.com/api
- Example:
Backend (Render)
PLAID_CLIENT_ID: Your Plaid client IDPLAID_SECRET: Your Plaid secretPLAID_ENVIRONMENT:sandboxorproduction
Frontend Build
cd frontend && npm run buildBackend Start Command (for Render)
uvicorn main:app --host 0.0.0.0 --port $PORTtraceback/
├── backend/
│ ├── main.py # FastAPI application & routes
│ ├── plaid_client.py # Plaid SDK integration
│ ├── analysis.py # Financial analysis logic
│ ├── requirements.txt # Python dependencies
│ └── .env # Plaid credentials (not in repo)
├── frontend/
│ ├── src/
│ │ ├── main.jsx # React entry point
│ │ ├── App.jsx # Main app component
│ │ ├── components/
│ │ │ ├── PlaidAuth.jsx # Plaid Link integration
│ │ │ ├── Dashboard.jsx # Main analysis dashboard
│ │ │ ├── MetricCards.jsx # KPI cards
│ │ │ ├── WeeklyTrace.jsx # Weekly spending chart
│ │ │ ├── CategoryDrilldown.jsx # Category breakdown
│ │ │ └── ...
│ │ └── pages/
│ │ ├── Home.jsx # Landing page
│ │ └── Dashboard.jsx # Analysis pages
│ ├── package.json # Node dependencies
│ ├── vite.config.js # Vite configuration
│ └── index.html # HTML entry point
└── README.md
POST /api/link-token- Create Plaid Link tokenPOST /api/exchange-token- Exchange public token for access token
GET /api/analyze/:user_id?month=<offset>- Get spending analysismonth=0: Current monthmonth=1: Last monthmonth=2: Two months ago, etc.
The backend CORS middleware allows:
- Localhost (development):
http://localhost:5173,http://localhost:3000 - Production:
https://trace-back.netlify.app,https://*.netlify.app
- Access tokens are stored in
/tmp/plaid_tokens.jsonon the backend - Each user's token is accessed by their
user_id - Tokens are never sent to frontend
Plaid's personal_finance_category tags are mapped to user-friendly category names for better UX.
- Frontend: Vite's code splitting and lazy loading
- Backend: Caching of Plaid responses to reduce API calls
- Charts: Recharts for efficient data visualization
- 🔒 Bank credentials never shared with frontend (Plaid Link handles auth)
- 🔐 Access tokens stored securely on backend only
- ✅ CORS properly configured to prevent unauthorized access
- 🛡️ Environment variables for sensitive configuration
- Verify
PLAID_CLIENT_IDandPLAID_SECRETin backend.env - Ensure backend is running and accessible
- For Netlify: Confirm
VITE_API_URLincludes/apipath
- Check that bank account is properly linked
- Verify Plaid sandbox credentials are valid
- Ensure backend has valid access token for the user
- Update backend
main.pyCORS origins if deploying to new domain - Clear browser cache and reload
- Budget goal tracking and alerts
- Recurring transaction detection
- Spending forecasting with ML
- Multi-account support
- Mobile app version
MIT
For issues or questions, please open an issue in the repository.