AI-Powered Medical Image Analysis & Healthcare Management Platform
Features • Installation • Usage • Documentation • Contributing
MediScan AI is a comprehensive healthcare management platform that leverages artificial intelligence to analyze medical images, generate prescriptions, manage medications, and facilitate healthcare workflows. Built with Next.js 15, it provides separate dashboards for administrators, doctors, patients, and pharmacists.
- 🔍 AI-Powered Medical Image Analysis - OCR and intelligent analysis of medical reports
- 💊 Smart Prescription Management - Create, scan, and manage digital prescriptions with QR codes
- 🤖 AI Medical Assistant - Chat with documents and get medication suggestions
- 👥 Multi-Role System - Separate dashboards for Admin, Doctor, Patient, and Pharmacist
- 🔐 Secure Authentication - JWT-based auth with OAuth support (Google, GitHub, Apple)
- 📊 Analytics Dashboard - Real-time insights and healthcare metrics
- Digital Prescription Creation with QR code generation
- Patient Management system with comprehensive records
- AI-Powered Medication Suggestions based on symptoms
- Medical Document Analysis using Google Gemini AI
- Prescription Tracking with scan limits and validation
- Team Collaboration tools
- QR Code Scanner for prescription verification
- Medicine Inventory Management with stock tracking
- Prescription Validation with real-time status updates
- AI Assistant for drug information and interactions
- Order Management system
- Prescription Access via secure QR codes
- Medical History tracking
- Healthcare Provider directory
- Appointment Management (coming soon)
- User Management across all roles
- System Analytics and monitoring
- Drug Database management
- Team Administration
- Activity Logs and audit trails
- Framework: Next.js 15 (App Router)
- Language: TypeScript 5.9
- Styling: Tailwind CSS 4.1
- UI Components: Radix UI, Shadcn UI
- State Management: React Hooks, SWR
- Forms: React Hook Form + Zod validation
- Animations: Framer Motion
- Runtime: Node.js
- API: Next.js API Routes
- Database: MongoDB 7.0 + Mongoose ODM
- Authentication: JWT (Jose), OAuth 2.0
- File Upload: Multer
- QR Codes: QRCode.js
- AI Platform: Google Genkit
- Models: Google Gemini (gemini-2.0-flash-exp)
- OCR: Google Cloud Vision API
- Vector DB: In-memory (development)
- Package Manager: npm
- Linting: ESLint
- Build Tool: Turbopack (Next.js)
- Environment: dotenv
Before you begin, ensure you have:
- Node.js 18.17 or later
- npm 9.0 or later
- MongoDB database (local or cloud)
- Google Cloud Account with:
- Gemini API access
- Cloud Vision API enabled
- OAuth Credentials (optional, for social login):
- Google OAuth 2.0
- GitHub OAuth App
- Apple Sign In
git clone https://github.com/Jaykumar122/MediScanAI.git
cd MediScanAinpm installCreate a .env file in the root directory:
# ─── Database ─────────────────────────────────────────────────
MONGODB_URI=mongodb+srv://username:password@cluster.mongodb.net/securerx?retryWrites=true&w=majority
# ─── JWT Authentication ───────────────────────────────────────
JWT_SECRET=your-secret-key-minimum-32-characters-long-for-security
# ─── Google AI (Gemini) ───────────────────────────────────────
GOOGLE_GENAI_API_KEY=your-google-ai-api-key
# ─── Google Cloud Vision (OCR) ────────────────────────────────
GOOGLE_APPLICATION_CREDENTIALS=path/to/service-account-key.json
GOOGLE_CLOUD_PROJECT_ID=your-project-id
# ─── OAuth Providers (Optional) ───────────────────────────────
# Google OAuth
GOOGLE_CLIENT_ID=your-google-client-id
GOOGLE_CLIENT_SECRET=your-google-client-secret
# GitHub OAuth
GITHUB_CLIENT_ID=your-github-client-id
GITHUB_CLIENT_SECRET=your-github-client-secret
# Apple Sign In
APPLE_CLIENT_ID=your-apple-client-id
APPLE_TEAM_ID=your-apple-team-id
APPLE_KEY_ID=your-apple-key-id
APPLE_PRIVATE_KEY=your-apple-private-key
# ─── Application ──────────────────────────────────────────────
NEXT_PUBLIC_APP_URL=http://localhost:3000
NODE_ENV=development- Go to Google AI Studio
- Create an API key
- Add to
.envasGOOGLE_GENAI_API_KEY
- Create a project in Google Cloud Console
- Enable Cloud Vision API
- Create a service account and download JSON key
- Set path in
.envasGOOGLE_APPLICATION_CREDENTIALS
The database will be automatically initialized on first run. To manually create an admin user:
npm run admin:create admin@mediscan.com YourSecurePassword123Verify admin creation:
npm run admin:listStart the development server:
npm run devThe application will be available at: http://localhost:3000
Build for production:
npm run buildStart production server:
npm start/login- User login (Doctor, Patient, Pharmacist)/signup- User registration/admin/login- Admin login portal/role-selection- OAuth role selection
/dashboard/admin- Overview & analytics/dashboard/admin/doctors- Doctor management/dashboard/admin/team- Team administration/dashboard/admin/drugs- Medicine database/dashboard/admin/users- User management/dashboard/admin/pharmacy- Pharmacy management
/dashboard/doctor- Doctor overview/dashboard/doctor/prescriptions- Create prescriptions/dashboard/doctor/doctors- Doctor directory/dashboard/doctor/drugs- Medicine lookup/dashboard/doctor/pharmacy- Pharmacy network
/dashboard/patient- Patient overview/dashboard/patient/prescriptions- View prescriptions/dashboard/patient/scan- Scan QR codes
/dashboard/pharmacist- Pharmacy overview/dashboard/pharmacist/scan- Scan prescriptions/dashboard/pharmacist/ai- AI assistant
POST /api/login # User login
POST /api/signup # User registration
POST /api/admin/login # Admin login
POST /api/logout # Logout
GET /api/auth/[provider]/callback # OAuth callback
GET /api/dashboard/admin # Dashboard data
GET /api/dashboard/admin/doctors # List doctors
GET /api/dashboard/admin/team # List team members
GET /api/dashboard/admin/drugs # List medicines
POST /api/dashboard/admin/drugs # Add medicine
GET /api/dashboard/admin/users # List users
PATCH /api/dashboard/admin/users # Update user status
GET /api/dashboard/admin/pharmacy # List pharmacists
GET /api/dashboard/doctor # Doctor dashboard
GET /api/dashboard/doctor/resources # Resources (doctors, drugs, pharmacy)
mediscan-ai/
├── src/
│ ├── app/ # Next.js app directory
│ │ ├── (auth)/ # Authentication pages
│ │ │ ├── login/
│ │ │ ├── signup/
│ │ │ └── admin/login/
│ │ ├── dashboard/ # Dashboard pages
│ │ │ ├── admin/
│ │ │ ├── doctor/
│ │ │ ├── patient/
│ │ │ └── pharmacist/
│ │ ├── api/ # API routes
│ │ │ ├── (auth)/
│ │ │ └── dashboard/
│ │ ├── actions.ts # Server actions
│ │ ├── layout.tsx # Root layout
│ │ └── page.tsx # Landing page
│ ├── components/ # React components
│ │ ├── ui/ # UI components
│ │ ├── app-sidebar.tsx
│ │ ├── site-header.tsx
│ │ └── ...
│ ├── lib/ # Utility libraries
│ │ ├── actions.ts # Server actions
│ │ ├── crypto.ts # JWT utilities
│ │ └── definitions.ts # Zod schemas
│ ├── models/ # MongoDB models
│ │ └── usermodels.ts
│ ├── ai/ # AI workflows
│ │ ├── genkit.ts # Genkit configuration
│ │ └── flows/ # AI flows
│ │ ├── medication-suggestion.ts
│ │ ├── ocr-and-summarize.ts
│ │ └── ...
│ ├── dbConfig/ # Database configuration
│ ├── hooks/ # Custom React hooks
│ ├── types/ # TypeScript types
│ └── scripts/ # Utility scripts
├── public/ # Static assets
├── .env # Environment variables
├── next.config.ts # Next.js configuration
├── tailwind.config.ts # Tailwind CSS config
├── tsconfig.json # TypeScript config
└── package.json # Dependencies
- User enters credentials on login page
- Server validates against MongoDB
- JWT token generated and returned
- Token stored in localStorage and cookies
- Protected routes verify token on each request
- User clicks social login button
- Redirected to OAuth provider
- User authorizes application
- Callback with authorization code
- If new user: role selection screen
- JWT token generated
- Redirected to appropriate dashboard
- Separate login portal at
/admin/login - Only users with
role: "admin"can access - Enhanced security with audit logging
// Extract text and analyze medical reports
const result = await ocrAndSummarize({
imageUrl: uploadedImageUrl
});// Get AI-powered medication suggestions
const result = await getMedicationSuggestions({
symptoms: "fever, headache, body aches"
});// Summarize medical documents
const result = await summarizeMedicalDocument({
documentText: extractedText
});// Ask questions about medical documents
const result = await chatWithDocument({
question: "What is the diagnosis?",
context: documentContent
});| Feature | Admin | Doctor | Patient | Pharmacist |
|---|---|---|---|---|
| Create Prescriptions | ✅ | ✅ | ❌ | ❌ |
| Scan Prescriptions | ✅ | ✅ | ✅ | ✅ |
| Manage Users | ✅ | ❌ | ❌ | ❌ |
| Manage Drugs | ✅ | ❌ | ❌ | ❌ |
| View Analytics | ✅ | ✅ | ❌ | ✅ |
| Access AI Features | ✅ | ✅ | ❌ | ✅ |
npm testnpm run lint- Admin Setup Guide - Create and manage admin users
- Quick Start Guide - Fast setup reference
- Implementation Summary - Technical details
- OAuth Setup - OAuth configuration
We welcome contributions! Please follow these steps:
- Fork the repository
- Create a feature branch
git checkout -b feature/amazing-feature
- Commit your changes
git commit -m 'Add some amazing feature' - Push to the branch
git push origin feature/amazing-feature
- Open a Pull Request
- Follow TypeScript best practices
- Use ESLint for code formatting
- Write descriptive commit messages
- Add comments for complex logic
- Update documentation as needed
- OpenTelemetry Jaeger exporter warning (non-breaking)
- Some OAuth providers may require additional configuration
- Real-time notifications
- Appointment scheduling system
- Video consultation integration
- Mobile app (React Native)
- Multi-language support
- Advanced analytics dashboard
- Integration with EHR systems
- Telemedicine features
This project is licensed under the MIT License - see the LICENSE file for details.
Your Name
- GitHub: https://github.com/Jaykumar122
- Next.js - The React framework
- Google AI - Gemini API
- Shadcn UI - UI components
- Vercel - Hosting platform
- MongoDB - Database