π Now featuring secure user authentication, personalized health profiles, and protected health data!
Med Genie is an intelligent AI-powered health assistant that provides instant, accurate health information and guidance. With our new authentication system, users can securely access personalized health advice, maintain their health history, and enjoy a protected experience.
- Instant health information and guidance
- Symptom analysis and recommendations
- Emergency response protocols
- Medication information lookup
- JWT-based authentication with secure token management
- Password hashing using bcrypt for maximum security
- Smart login flow with intelligent signup suggestions
- Session management with automatic token refresh
- Protected routes ensuring secure access to health data
- API route protection with middleware-based security
- Individual user accounts with secure registration
- Personalized health profiles for better recommendations
- Chat history preservation across sessions
- Seamless flow between login and signup pages
- Context-aware messaging based on user journey
- End-to-end encryption for sensitive health data
- HIPAA-compliant data handling practices
- Secure password policies with validation
- Automatic session cleanup on logout
- Protected API endpoints with authentication middleware---
- Node.js 18+ and npm
- Git for version control
- Text editor (VS Code recommended)
- 
Clone the repository: git clone https://github.com/ashutosh-engineer/med-genie.git cd med-genie
- 
Install dependencies: npm install 
- 
Environment setup: # Option 1: Use the automated setup script (recommended) npm run setup-env # Option 2: Manual setup # Copy environment template cp env.example .env # Edit .env file with your configuration: # - JWT_SECRET (required for authentication - auto-generated by setup script) # - DATABASE_URL (SQLite by default) # - Other optional settings 
- 
Database setup: # Generate Prisma client npx prisma generate # Create and migrate database npx prisma db push # (Optional) View database in Prisma Studio npx prisma studio 
- 
Start development server: npm run dev 
- 
Access the application: - Main app: http://localhost:9003
- AI development: npm run genkit:dev
 
- Main app: 
- JWT_SECRET error: Run npm run setup-envto generate environment variables
- Database connection issues: Ensure Prisma client is generated with npx prisma generate
- Port conflicts: Change port in package.jsonscripts if 9003 is occupied
- Authentication not working: Verify JWT_SECRET is set in your environment
- Database errors: Run npx prisma db pushto sync database schema
- Build failures: Clear .nextfolder and runnpm run buildagain
The application includes a complete authentication system:
- User Registration: Create accounts with email/password
- Secure Login: JWT-based authentication
- Protected Routes: Homepage requires authentication
- Session Management: Persistent login across browser sessions
- Password Security: bcrypt hashing with salt rounds
Default Environment Variables:
# Authentication (Required)
JWT_SECRET=your-super-secret-jwt-key-change-in-production
JWT_EXPIRES_IN=7d
# Database (Auto-configured for development)
DATABASE_URL="file:./dev.db"
# AI Features (Required for chat functionality)
GOOGLE_API_KEY=your_google_ai_api_key_heremed-genie/
βββ π src/
β   βββ π ai/                    # AI integration & flows
β   β   βββ genkit.ts            # Genkit AI setup
β   β   βββ flows/               # Health Q&A flows
β   βββ π app/                  # Next.js app directory
β   β   βββ page.tsx            # Main landing page
β   β   βββ homepage/           # Protected chat interface
β   β   βββ login/              # Authentication pages
β   β   βββ sign-up/            # User registration
β   β   βββ api/                # API routes
β   β       βββ auth/           # Authentication endpoints
β   β           βββ login/      # Login API
β   β           βββ register/   # Registration API
β   β           βββ logout/     # Logout API
β   βββ π components/          # React components
β   β   βββ ui/                 # Reusable UI components
β   β   βββ ProtectedRoute.tsx  # Route protection
β   β   βββ UserMenu.tsx        # User authentication menu
β   β   βββ landing_page/       # Landing page sections
β   βββ π contexts/            # React contexts
β   β   βββ AuthContext.tsx     # Authentication context
β   βββ π hooks/               # Custom React hooks
β   βββ π lib/                 # Utilities & types
β   β   βββ jwt.ts             # JWT token utilities
β   β   βββ auth-middleware.ts  # API protection middleware
β   β   βββ api-client.ts      # HTTP client with auth
β   βββ π styles/              # Global styles
βββ π public/                  # Static assets
βββ π prisma/                  # Database schema & client
β   βββ schema.prisma          # User & data models
β   βββ prisma.ts              # Database connection
βββ π AUTHENTICATION.md        # Authentication documentation
βββ π Configuration files
- Setup: Clone repository and install dependencies
- Environment: Configure .envwith API keys and JWT secret
- Database: Generate Prisma client and push schema
- Development: Run npm run devfor hot-reload development
- AI Testing: Use npm run genkit:devfor AI flow testing
- Type Safety: Run npm run typecheckfor TypeScript validation
- Code Quality: Use npm run lintfor code quality checks
- Authentication Testing: Test login/signup flows and protected routes
# Type checking
npm run typecheck
# Linting
npm run lint
# Database operations
npx prisma studio          # View database
npx prisma db push         # Apply schema changes
npx prisma generate        # Regenerate client
# Manual testing checklist
# β
 User registration and login
# β
 Authentication flow and JWT tokens
# β
 Protected route access
# β
 Chat functionality (authenticated users)
# β
 Voice input/output
# β
 Responsive design
# β
 Accessibility features
# β
 Emergency scenarios
# β
 Session persistence and logout- POST /api/auth/register- User registration
- POST /api/auth/login- User login
- POST /api/auth/logout- User logout
- POST /api/auth/check-email- Check email availability
- GET /api/user/profile- Get user profile (requires auth)
- PUT /api/user/profile- Update user profile (requires auth)
- GET /api/nearby-hospitals- Find nearby hospitals
| Feature | Description | Timeline | Priority | 
|---|---|---|---|
| π Advanced Auth Features | 2FA, OAuth providers, password reset | Q1 2025 | High | 
| π± Mobile Authentication | Biometric login, mobile-optimized flows | Q1 2025 | High | 
| π§ ML Diagnosis Engine | Advanced AI-driven health issue prediction | Q2 2025 | High | 
| π Smart Location Services | Nearby hospitals, clinics, pharmacy finder | Q1 2025 | High | 
| ποΈ Enhanced Health Profiles | Medical history, allergies, medications | Q2 2025 | Medium | 
| π¨ββοΈ Specialist AI Avatars | Cardiology, Pediatrics, etc. specialized responses | Q3 2025 | Medium | 
| π Multi-language Support | Hindi, Bengali, Tamil, Spanish, French | Q2 2025 | High | 
| β° Health Reminders | Medication, appointment, wellness alerts | Q3 2025 | Low | 
| π± Mobile App | Native iOS/Android applications | Q4 2025 | Medium | 
| π Offline Mode | Basic functionality without internet | Q3 2025 | Low | 
- β‘ Response Time: < 2 seconds for all queries
- π― Accuracy: > 90% for common health questions
- π± Mobile Performance: < 3 second load time
- βΏ Accessibility: WCAG 2.1 AA compliance
- π Security: Zero-trust authentication model
- π API Performance: < 500ms for auth endpoints
- πΎ Database: Optimized queries with proper indexing
Med Genie features a comprehensive authentication system built with modern security practices:
- JWT Authentication with secure token management
- Password Hashing using bcrypt with 10 salt rounds
- Smart Login Flow with intelligent signup suggestions
- Protected Routes ensuring secure access to health data
- Session Management with automatic cleanup
- API Route Protection with middleware-based security
- Context-Aware UI that adapts to authentication state
- Frontend: React Context for state management
- Backend: Next.js API routes with middleware protection
- Database: Prisma ORM with SQLite/PostgreSQL support
- Security: bcrypt password hashing, JWT tokens, HTTP-only patterns
- Validation: Zod schemas for input validation
For detailed authentication documentation, see AUTHENTICATION.md
We welcome contributions from developers, healthcare professionals, and anyone passionate about improving healthcare accessibility!
- π Bug Reports: Found an issue? Report it here
- π‘ Feature Requests: Have an idea? Share it with us
- π οΈ Code Contributions: Check our Contributing Guide
- π Documentation: Help improve our docs and guides
- π¨ Design: UI/UX improvements and accessibility enhancements
- Fork the repository
- Create a feature branch (git checkout -b feature/amazing-feature)
- Commit your changes (git commit -m 'Add amazing feature')
- Push to the branch (git push origin feature/amazing-feature)
- Open a Pull Request
Contributors are recognized in our Contributors Hall of Fame and receive special badges for their contributions!
Current Maintainers:
- @ashutosh-engineer - Project Lead & Architecture
- [Your Name Here] - Join our team!
MIT License
Copyright (c) 2025 Med-Genie Contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
Made with β€οΈ by the Med-Genie Team
β Star β’ π Report Bug β’ π‘ Request Feature β’ π Documentation
Part of GirlScript Summer of Code 2025 - Empowering open source healthcare innovation
A revolutionary AI-powered health companion that makes medical guidance accessible through natural conversations
π Try Med-Genie Live | π Documentation | π€ Contributing
- π― What is Med-Genie?
- β¨ Key Features
- π¬ Demo & Screenshots
- ποΈ Architecture & Tech Stack
- π Quick Start
- οΏ½ Usage Guide
- οΏ½ Development Setup
- π£οΈ Roadmap
- π€ Contributing
- οΏ½ License
Med-Genie is an intelligent AI health assistant designed to democratize access to medical information and emergency guidance. Built as part of GirlScript Summer of Code 2025 (GSSoC'25), this open-source project bridges the gap between patients and healthcare information through conversational AI.
- Instant Access: Get immediate health guidance without waiting for appointments
- Natural Conversations: Chat in plain language - no medical jargon required
- Privacy-First: Your health data stays private - we don't store or track anything
- Emergency Ready: Quick access to hospital information and emergency contacts
- Always Available: 24/7 health companion that's always ready to help
To make basic healthcare guidance accessible to everyone, everywhere, while maintaining the highest standards of privacy and encouraging professional medical consultation when needed.
Important: Med-Genie provides general health information and guidance. It is not a replacement for professional medical advice, diagnosis, or treatment. Always consult qualified healthcare professionals for medical concerns.
Chat naturally with our AI trained on health-related queries. No complex medical terminology required - just ask in plain language!
Instant access to nearby hospitals, emergency contacts, and first-aid guidance when every second counts.
Describe your symptoms and receive AI-powered condition suggestions with actionable health insights.
Speak to Med-Genie using built-in speech recognition for hands-free, accessible interaction.
Seamless dark/light mode switching for comfortable use in any environment, day or night.
Zero data storage, zero tracking. Your health conversations remain completely private and secure.
| Feature | Description | Status | 
|---|---|---|
| π¬ Natural Language Chat | Conversational AI for health queries | β Live | 
| π₯ Emergency Services | Hospital finder & emergency guidance | β Live | 
| π Symptom Analysis | AI-powered symptom assessment | β Live | 
| οΏ½ Voice Interface | Speech-to-text health queries | β Live | 
| π± Responsive Design | Mobile-first, accessible UI | β Live | 
| οΏ½ PWA Support | Installable web app | β Live | 
| οΏ½ Privacy Protection | No data collection/storage | β Live | 
Clean, intuitive design that welcomes users to start their health journey
Natural conversation flow with instant AI responses and helpful suggestions
Experience Med-Genie in action: med-genie-five.vercel.app
Sample Interactions:
- "I have a headache and feel nauseous. What could this be?"
- "Find hospitals near me"
- "What should I do for a minor burn?"
- "I'm feeling anxious about my heart rate"
βββββββββββββββββββ    βββββββββββββββββββ    βββββββββββββββββββ
β   Next.js 15    β    β   TypeScript    β    β  Tailwind CSS   β
β   React 18      β ββ β   Type Safety   β ββ β   Styling       β
βββββββββββββββββββ    βββββββββββββββββββ    βββββββββββββββββββ
βββββββββββββββββββ    βββββββββββββββββββ    βββββββββββββββββββ
β   Genkit AI     β    β  Google Gemini  β    β    Prisma       β
β   Framework     β ββ β   AI Model      β ββ β   Database      β
βββββββββββββββββββ    βββββββββββββββββββ    βββββββββββββββββββ
| Category | Technologies | Purpose | 
|---|---|---|
| Frontend | Next.js 15, React 18, TypeScript | Modern, type-safe web application | 
| UI/UX | Tailwind CSS, Radix UI, Framer Motion | Beautiful, accessible, animated interface | 
| AI Integration | Genkit, Google Gemini AI | Intelligent health conversation engine | 
| Database | Prisma, PostgreSQL | Data management and storage | 
| Deployment | Vercel | Fast, reliable hosting platform | 
| Development | ESLint, TypeScript, PostCSS | Code quality and development tools | 
| Speech | Web Speech API | Voice input functionality | 
- User Input β Voice or text health query
- AI Processing β Genkit processes with Gemini AI
- Context Analysis β Medical history & symptoms consideration
- Response Generation β Personalized health guidance
- Emergency Detection β Hospital/emergency service routing
- Privacy Protection β No data storage or tracking
- Visit: Go to med-genie-five.vercel.app
- Start Chatting: Type or speak your health question
- Get Guidance: Receive instant AI-powered health insights
- Stay Safe: Follow up with healthcare professionals when needed
- Node.js (v18 or higher)
- npm or yarn or pnpm
- Git for version control
# Clone the repository
git clone https://github.com/ashutosh-engineer/med-genie.git
cd med-genie
# Install dependencies
npm install
# Set up environment variables
cp env.example .env.local
# Add your API keys (Google AI, etc.)
# Run the development server
npm run dev# Development server with Turbopack
npm run dev
# Build for production
npm run build
# Start production server
npm start
# Run type checking
npm run typecheck
# Lint code
npm run lint
# Start Genkit AI development
npm run genkit:devCreate a .env.local file with:
# Google AI (Gemini) API Key
GOOGLE_AI_API_KEY=your_google_ai_api_key
# Database URL (if using database features)
DATABASE_URL=your_database_url
# Other optional configurations
NEXT_PUBLIC_APP_URL=http://localhost:3000- Type your health question naturally: "I have a sore throat, what should I do?"
- Ask about symptoms: "What causes headaches?"
- Request emergency help: "Find hospitals near me"
- Click the microphone icon π€
- Speak clearly in your preferred language
- Med-Genie will transcribe and respond
- Use keywords like "emergency", "hospital", "urgent"
- Med-Genie will prioritize emergency guidance
- Always call emergency services (911, etc.) for life-threatening situations
π¬ Health Consultation
User: "I've been feeling tired and having trouble sleeping"
Med-Genie: *"I understand you're experiencing fatigue and sleep difficulties. Several factors could contribute to this, such as stress, lifestyle changes, or underlying health conditions. Here are some general suggestions:
- Sleep Hygiene: Try maintaining a consistent sleep schedule
- Lifestyle: Consider your diet, exercise, and stress levels
- Medical Evaluation: If symptoms persist, consult a healthcare provider
Would you like to share more details about when these symptoms started or any other related concerns?"*
π¨ Emergency Assistance
User: "Find hospitals near me"
Med-Genie: *"I'll help you find nearby hospitals. Here are some medical facilities in your area:
π₯ General Hospital π 123 Main St, Your City π (555) 123-4567
π₯ Emergency Medical Center π 456 Health Ave, Your City π (555) 987-6543
For life-threatening emergencies, please call 911 immediately."*
- No Data Storage: Your conversations are not saved or tracked
- Local Processing: Voice recognition happens on your device
- Secure Communication: All data transmission is encrypted
- Medical Disclaimer: Always shown with health advice
π License Released under the MIT License. Youβre free to use, modify, and distribute this software with proper attribution.
Β© 2025 Med Genie β Built with β€οΈ by Aayush Raj and contributors.
β
 You can directly replace your current README.md with this content. Itβs organized, informative, and optimized for contributors, users, and open-source discoverability.
Let me know if you'd like a CONTRIBUTING.md, GitHub issue templates, or a feature roadmap.md as well!

