Inspiration

We were inspired by the pain points of managing personal finances in a globalized world:

Multi-Currency Confusion: Accurately tracking expenses across different currencies during travel or international commerce is manually intensive and prone to error. Generic Advice: Existing finance apps offer basic reporting but lack the personalized, proactive, and conversational advice that a human financial advisor provides. Data Isolation: The process of logging expenses and getting advice often requires two separate tools. Our goal was to merge these functions into a single, intelligent application—the "Money Doctor"—that not only tracks your spending but actively diagnoses your financial habits.

What it does

Money Doctor is an intelligent financial advisory platform that operates as follows: Base Currency Foundation: Upon setup, the user defines their Base Currency ( ) for all reporting. Seamless Expense Tracking: Users quickly log transactions. If a foreign currency ( ) is selected, the app immediately fetches the historical exchange rate ( ) for the transaction date and converts the expense to a Base Currency Amount ( ).

The Consultation (Chatbot): The user enters their current budget and expenses. Intelligent Diagnosis: The integrated AI (powered by the Gemini API) receives the user's spending data (categorized and -totaled) and a prompt to act as an expert financial advisor. Proactive Prescription: The AI generates a comprehensive, personalized consultation, including: Financial health assessment. Specific tips for reducing spending in high-impact categories (e.g., "Food" or "Shopping"). Recommendations for savings goals and emergency fund size. History Dashboard: All past consultations and underlying expense data are securely stored in Supabase and displayed on the Home Page dashboard for historical review.

How we built it

The Money Doctor application was built using a robust, cloud-native stack: Frontend: We used React with TypeScript for a reliable, type-safe, and modular user interface, bundled with Vite for a fast development experience. Backend & Database: We utilized Supabase (PostgreSQL) for our entire backend, leveraging its features for: Secure Storage: Storing consultation records in the financial_consultations table. User Authentication: Using Supabase Auth for user management. Security: Implementing Row-Level Security (RLS) to guarantee users can only access their own financial records. Intelligence Layer (The Doctor): The core intelligence comes from the Google Gemini API. We construct a detailed prompt (containing the user's budget, totals, and categorized spending) and send it to the LLM to generate the professional, conversational financial advice. Data Flow: The application features a critical data transformation step where historical consultation data (nested JSONB of expenses) is fetched, flattened, and then displayed as a single, chronological "Previous Expenditures" list on the dashboard.

Challenges we ran into

API Key Configuration: The initial integration faced a persistent TypeError: Failed to fetch due to the subtle but critical failure of loading the VITE_GEMINI_API_KEY environment variable in the development environment, which required careful debugging of the Vite and JavaScript environment variable loading mechanism. Multi-Currency Simulation: While we used a mock rate for the frontend, ensuring the backend integration correctly fetches historical exchange rates for the exact transaction date (not just the current day's rate) required detailed planning to guarantee accurate calculations. JSONB Data Transformation: Extracting and flattening the nested expenditures array (stored in a jsonb column within the financial_consultations table) into a single, cohesive list for the dashboard required a specific data processing layer on the frontend.

✅ Accomplishments that we're proud of

Successful Gemini API Integration: Achieving a working, conversational financial advisory service that provides genuinely insightful and practical advice based on structured financial data. Secure Data Architecture: Implementing strong Row-Level Security (RLS) on Supabase, ensuring the core financial data integrity and privacy from the ground up—a non-negotiable for a finance application. Seamless UX Flow: Creating a clean user experience where the core value—the accurate, converted total spending—is visible immediately upon logging a foreign expense.

🧠 What we learned Vite/TS/React Setup: We gained hands-on experience in quickly setting up a modern, type-safe application environment and managing environment variables securely. Data Modeling for LLMs: The crucial lesson was that the quality of the AI's advice is entirely dependent on the quality and structure of the prompt. We learned to structure raw data (categories, totals, currency) into a clear, concise prompt that maximizes the Gemini model's performance as an expert "Money Doctor." Supabase Security: We solidified our understanding of RLS, recognizing it as the primary defense for user-specific data in a Supabase application.

What's next for Money Doctor

Real-Time Exchange Rate Integration: Replace the current placeholder/mock logic with a dedicated, reliable, historical exchange rate API (e.g., Fixer, Open Exchange Rates). User Authentication: Fully implement Supabase Auth (Sign In/Sign Up) and ensure all database queries are linked to the currently logged-in user_id. Visual Reporting: Enhance the dashboard with bar charts and pie charts based on the category totals, giving the user a visual breakdown of where their money is going. Proactive Notifications: Implement Supabase Edge Functions or a similar service to trigger an automated consultation advice message (via push or email) when a user's spending in a specific category exceeds a set threshold.

Share this project:

Updates