Medora Backend is a serverless API built for the Medora medical assistant app. It provides intelligent chat responses personalized with user medical data from Firebase Firestore, powered by OpenAI's GPT models.
- π Serverless Architecture - Deployed on Vercel for automatic scaling
- π Secure Authentication - Firebase integration for user data
- π¬ AI-Powered Chat - OpenAI GPT models with medical context
- π Personalized Responses - Uses patient medical records from Firestore
- π CORS Enabled - Ready for cross-origin requests from Expo apps
- β‘ Fast Responses - Optimized with gpt-4o-mini for quick replies
medora-backend/
βββ api/
β βββ chat.ts # working api route access firebase-admin db(main route)
β βββ chat-simple.ts # Simplified version for testing
β βββ test-simple.ts # Basic connectivity test
β
βββ lib/
β βββ config.ts # Firebase Admin initialization
β βββ user-data.ts # User data fetching utilities
β
βββ .env.example # Environment variables template
βββ package.json # Dependencies and scripts
βββ tsconfig.json # TypeScript configuration
βββ vercel.json # Vercel deployment config
βββ README.md # Project documentationRequest Body:
{
"userId": "firebase-user-id",
"messages": [
{ "role": "user", "content": "What is my blood type?" }
],
"model": "gpt-4o-mini" // optional, defaults to gpt-4o-mini
}Response:
{
"text": "Based on your medical records, your blood type is O+."
}Basic connectivity test. Request body:
{
"userId": "use_id",
"messages": [
{
"role": "user",
"content": "Hello, tell me about my medical data"
}
]
}Response:
Hello Subhro! Here's a summary of your medical data:
### π Medical Information:
- **Blood Type:** B+
- **Height:** 166 cm
- **Weight:** 90 kg
- **Allergies:** Peanuts
- **Current Medications:** None listed
- **Chronic Conditions:** None listed
- **Past Surgeries:** Nose surgery (scheduled for 2025)
### π
Insurance Details:
- **Provider:** Bajaj
- **Policy Number:** 2134
- **Type:** Employer
- **Coverage Valid Until:** December 12,
2004 (please check for an update)
### π Identification:
- **National ID Number:** 123243
- **Expiry Date:** February 11,
2023 (please ensure renewal if necessary)
### π Documents:
- Birth certificate, medical history, insurance card (front), Aadhaar card
If you need more detailed information or documents, let me know, and I can provide a PDF.
**Disclaimer:** This information is provided for your personal reference. For medical advice, please consult a healthcare professional.