Configuration — Implementation¶
API Keys (.env)¶
FINNHUB_API_KEY=your_key # Required — US news (60 req/min free tier)
AZURE_TRANSLATOR_KEY=your_key # Optional — headline translation (F0: 2M chars/month free)
AZURE_TRANSLATOR_REGION=eastus # Optional — Azure region (default: eastus)
GOOGLE_API_KEY=your_key # Required for My Portfolio screenshot parsing (Gemini 2.5 Flash)
ANTHROPIC_API_KEY=your_key # Optional — loaded but not currently wired to any feature
DATABASE_URL=postgresql://... # Required for production — Supabase Session Pooler URL (sslmode=require)
- Never hard-code keys — always read through
config.py - With no
AZURE_TRANSLATOR_KEY, the translation toggle renders but shows original titles (no crash) - DB is Supabase PostgreSQL (AWS ap-northeast-1). If
DATABASE_URLis unset, the app falls back tosqlite:///fintech.db— local dev only, not for production use.psycopg2-binaryis inrequirements.txt
Local vs Production DB¶
The intended workflow once remote deployment is live:
- Local dev — omit
DATABASE_URLfrom.env(or point it at a local Postgres). The app usessqlite:///fintech.dbas a sandboxed dev database that never touches Supabase. - Production (Railway) — set
DATABASE_URLas an environment secret in the deployment platform pointing to Supabase. No.envfile needed on the server.
Schema migrations (_migrate_add_* functions in database.py) run on every init_db() call and are dialect-agnostic, so they apply cleanly to both SQLite locally and Postgres in production.
Running¶
# All-in-one (recommended)
make up # opens backend+scheduler and frontend in separate terminal windows
make stop # kills processes on ports 8000 and 5173
# Backend
python main.py # full startup — scheduler + FastAPI
python main.py --skip-initial # fast restart, skips initial data load
uvicorn api.main:app --reload --port 8000 # API only, no scheduler (dev)
# Frontend
cd frontend && npm run dev # React dev server at http://localhost:5173
cd frontend && npm run build # production build to frontend/dist/
Vite proxies /api requests to localhost:8000 in dev mode. FastAPI Swagger UI at http://localhost:8000/docs.
DB Migrations¶
_migrate_add_translation_columns() and _seed_tickers() in database.py both run on every init_db() call. They check existing state before making changes — safe for both fresh deployments and restarts.
Data Retention Config¶
Retention windows defined in config.py as RETENTION_*_DAYS constants. See docs/implementation/data-retention.md.