How fullmetal-007/genai_health_buddy works
Project Type and Purpose
• This is a full-stack, AI-powered web application named “GenAI Health Buddy.”
• Purpose: provide prescription analysis, medicine info, symptom checking, interactive chat, and WhatsApp notifications using Google Gemini API and Meta WhatsApp Business API.
File Structure
• Top-level files:
• App.tsx, index.tsx, index.html, vite.config.ts → React / Vite frontend
• services/ (backendService.ts, geminiService.ts) → frontend API wrappers
• components/ → UI modules (cards, uploader, chat, spinner, etc.)
• backend/ → Node.js/Express server (server.js, package.json, .env)
• metadata.json, types.ts, tsconfig.json → type definitions and metadata
• No database directory—no persistent storage; logic lives in frontend, calls two external APIs.
• Environment files indicate two runtime contexts: frontend (Google API key) and backend (Meta credentials).
README for Additional Insights
• Confirms tech stack: React + TypeScript + Tailwind (frontend), Node + Express (backend); native ES modules with importmap, no heavy build step.
• Architecture sketch in text: frontend handles UI and calls AI engine directly, backend handles WhatsApp integration.
• Key external systems: Google Gemini API, Meta WhatsApp Business API.
Main Components and Their Relationships
a. Frontend Application (Browser)
• React UI Components (in /components)
• Service Layer (services/geminiService.ts calls Google Gemini; services/backendService.ts talks to Express)
• Static asset host (npx serve or similar)
b. Backend Server (Node + Express)
• Endpoint(s) for WhatsApp messages (server.js)
• Environment config for Meta API credentials
c. External Services
• Google Gemini API – generative AI tasks (prescription OCR, chat, symptom analysis)
• Meta WhatsApp Business API – sending summary via WhatsApp
d. Data Flow
1. User uploads prescription or sends a query in UI
2. Frontend → geminiService (HTTP REST to Google Gemini) → receives parsed data or text
3. Frontend displays results and optionally calls backendService to send WhatsApp
4. backendService → Express backend → Meta WhatsApp API → WhatsApp recipient
5. Responses flow back to frontend for confirmation display
Architectural Patterns & Design Principles
• Separation of concerns: UI, service wrappers, and backend integration are strictly partitioned.
• API-driven: frontend orchestrates calls to AI engine and backend rather than embedding logic.
• Environment isolation: two .env files ensure secrets do not cross boundaries.
• Modular components: reusable React components for cards, uploaders, and chat.