Finance coaching app using AI. (Currently just a demo)
- Create and activate a virtual environment.
python -m venv .venv source .venv/bin/activate - Install backend dependencies.
pip install -r requirements.txt
- Copy the example environment file.
cp .env.example .env # `.env` should normally stay in mock mode for free local runs
Key environment variables:
FRONTEND_ORIGIN: Allowed CORS origins (comma-separated). Defaults to common localhost Vite ports.AI_PROVIDER:mock(default, no external calls) oropenai(requiresOPENAI_API_KEY).AI_MODEL: Model name for AI responses (default:gpt-4.1-mini).OPENAI_API_KEY: Your OpenAI API key when using the OpenAI provider.
cd frontend
npm installTo build the frontend for production:
npm run build
npm run previewThis uses the default mock AI provider and costs nothing.
# Backend (from repo root)
make dev
# Frontend (new terminal)
cd frontend
VITE_API_BASE_URL=http://localhost:8000 npm run devOpen http://localhost:5173 and chat with any persona. The API listens on http://localhost:8000 by default. Use FRONTEND_ORIGIN if you need to override the allowed CORS origin.
You need to setup a billing method on https://platform.openai.com/settings/organization/billing/overview if you haven't already. Keep .env in mock mode for normal development. Create a separate file for OpenAI usage to avoid accidental costs:
cp .env.example .env.openai
echo "AI_PROVIDER=openai" >> .env.openai
echo "OPENAI_API_KEY=sk-your-key" >> .env.openaiStart the app using OpenAI:
# Backend (loads .env.openai)
make dev-openai
# Frontend (new terminal)
cd frontend
VITE_API_BASE_URL=http://localhost:8000 npm run dev- Unit tests (mock data):
make test - Mock end-to-end chat smoke test (safe):
make chat-smoke
- OpenAI smoke test (paid, requires
.env.openai):Saves request/response JSONs tomake openai-smoke
/tmp/openai_smoke_request.jsonand/tmp/openai_smoke_response.json.
Base URL: http://localhost:8000
-
Health check
curl http://localhost:8000/health/
-
List personas (demo/read-only data)
curl http://localhost:8000/personas/
-
Persona finance summary (demo/read-only data)
curl http://localhost:8000/personas/{persona_id}/summary # Example curl http://localhost:8000/personas/family/summary -
Chat (AI-backed; read-only demo data)
curl -X POST http://localhost:8000/chat/ \ -H "Content-Type: application/json" \ -d '{ "personaId": "family", "messages": [ {"id": "1", "role": "user", "content": "How am I tracking this month?"} ], "summary": $(curl -s http://localhost:8000/personas/family/summary) }'
.envshould remain in mock mode for normal development.- OpenAI usage requires
.env.openaiAND an explicit Makefile command. - Only these targets will use your API key:
make openai-smoke-> one request (automated test)make dev-openai-> manual testing via UI or curl
- To return to free mode, simply stop the server and run
make dev.