AI-Powered Healthcare Workforce Readiness Platform for Rural India
A comprehensive learning and deployment platform designed to train, certify, and deploy healthcare workers in underserved rural areas of India. Built with Next.js 15, Supabase, and Claude AI.
- Adaptive Learning Modules: 8+ medical training modules with AI-generated content
- Smart Assessments: Practice and certification quizzes with instant feedback
- Spaced Repetition: Intelligent review system to reinforce weak areas
- Study Streaks & Gamification: Daily challenges, achievements, and leaderboards
- Bookmarking: Save important questions and concepts for later review
- Real-time Chat: Claude Sonnet 4.5 with medical expertise
- Extended Thinking: See AI's reasoning process for complex questions
- Live Web Search: Real-time searches of WHO, CDC, ICMR, NIH, and trusted medical sources
- Context-Aware: Specialized prompts for emergency, maternal, pediatric care
- Multi-turn Conversations: Maintains context across chat sessions
- Instant AI Support: Step-by-step protocols for medical emergencies
- Evidence-Based: Recommendations backed by WHO/CDC guidelines
- Offline-Ready: Critical protocols available without internet
- Blockchain-Verified: Tamper-proof certificates on Ethereum
- Instant Verification: QR codes for credential checking
- Career Advancement: Track progress toward advanced certifications
- AI Recommendations: Match healthcare workers to rural opportunities
- State-wide Coverage: Deployments across all Indian states
- Transparent Applications: Track application status in real-time
- Peer Connections: Connect with fellow healthcare workers
- Progress Sharing: Share achievements with friends or publicly
- Collaborative Learning: Learn from the community's experiences
- Node.js: v18+ (tested with v24.5.0)
- pnpm: v10.18.0+ (recommended package manager)
- Supabase Account: Sign up free
- Anthropic API Key: Get from Anthropic
- Exa API Key: For medical web search
-
Clone the repository
git clone https://github.com/DevaanshPathak/MedReady-AI.git cd MedReady-AI -
Install dependencies
pnpm install
-
Set up environment variables
Create a
.env.localfile in the root directory:# Supabase (public - exposed to client) NEXT_PUBLIC_SUPABASE_URL=https://YOUR_PROJECT_ID.supabase.co NEXT_PUBLIC_SUPABASE_ANON_KEY=your_anon_key_here # AI Providers (server-only) ANTHROPIC_API_KEY=sk-ant-your-key-here EXA_API_KEY=your_exa_key_here # Optional: Redis Cache (Upstash) UPSTASH_REDIS_REST_URL=https://your-redis.upstash.io UPSTASH_REDIS_REST_TOKEN=your_token_here # Optional: AI Gateway (Vercel) AI_GATEWAY_API_KEY=your_gateway_key
-
Set up Supabase database
Run migrations in order via Supabase SQL Editor:
# Required migrations scripts/001_create_schema.sql # Core tables scripts/003_create_profile_trigger.sql # Auto profile creation # Optional feature migrations scripts/005_create_chat_tables.sql # Enhanced chat scripts/008_add_ai_tables.sql # AI caching scripts/010_add_learning_features.sql # Spaced repetition scripts/011_add_streaks_and_gamification.sql # Gamification
-
Seed demo data (optional)
# Windows PowerShell .\scripts\seed_database.ps1 # Or with Node.js node scripts/seed_demo_data.js
-
Run development server
pnpm dev
-
Open in browser
http://localhost:3000
MedReady-AI/
βββ app/ # Next.js 15 App Router
β βββ api/ # API routes
β β βββ chat/ # AI chat endpoint
β β βββ generate-certificate/ # Blockchain certificates
β β βββ recommendations/ # Deployment matching
β β βββ ... # Other endpoints
β βββ dashboard/ # Main dashboard
β βββ learn/ # Learning modules
β βββ chat/ # AI assistant
β βββ emergency/ # Emergency protocols
β βββ certifications/ # Certificates
β βββ deployments/ # Rural deployments
β
βββ components/ # React components
β βββ chat-interface.tsx # AI chat UI
β βββ assessment-quiz-enhanced.tsx # Spaced repetition
β βββ progress-social.tsx # Social learning
β βββ ui/ # shadcn/ui components
β
βββ lib/ # Core utilities
β βββ ai-provider.ts # Claude AI setup
β βββ web-search-tool.ts # Medical web search
β βββ types.ts # TypeScript definitions
β βββ redis.ts # Caching layer
β βββ supabase/ # Auth & database
β
βββ prompts/ # AI system prompts
β βββ chat/ # Category-specific prompts
β βββ emergency-guidance.ts # Emergency protocols
β
βββ scripts/ # Database setup
β βββ 001_create_schema.sql # Core tables
β βββ ... # Migration files
β
βββ __tests__/ # Comprehensive test suite
βββ api/ # API tests
βββ components/ # Component tests
βββ lib/ # Utility tests
βββ integration/ # E2E tests
# Run all tests
pnpm test
# Watch mode (for development)
pnpm test:watch
# Coverage report
pnpm test:coverage
# Test specific category
pnpm test:components # UI components
pnpm test:lib # Library functions- API Routes: Chat streaming, certificates, recommendations, gamification
- Components: Quiz enhanced, social progress, buttons, cards
- Database: RLS policies, triggers, PostgreSQL functions
- Integration: E2E workflows, learning features, authentication
- Framework: Next.js 15 (App Router, Server Components)
- UI Library: React 19
- Styling: Tailwind CSS + shadcn/ui components
- State Management: React hooks + Supabase realtime
- Markdown: react-markdown + remark-gfm
- Charts: Recharts
- Database: Supabase (PostgreSQL with Row-Level Security)
- Authentication: Supabase Auth (email/password, OAuth)
- API: Next.js API routes (RESTful)
- Caching: Upstash Redis (optional)
- LLM: Anthropic Claude Sonnet 4.5
- Framework: Vercel AI SDK (streaming, tool calling)
- Web Search: Exa.ai (medical domain-specific)
- Embeddings: Not used (live search instead)
- Network: Ethereum (for certificate verification)
- Libraries: ethers.js (certificate hashing)
- Package Manager: pnpm
- Testing: Jest + React Testing Library
- Type Checking: TypeScript (strict mode)
- Linting: ESLint + Next.js config
- All database tables enforce RLS policies
- Users can only access their own data (
auth.uid() = user_id) - Public data (modules, assessments) is read-only
- Shared progress respects privacy settings (public/friends/specific)
- Middleware protects all
/dashboard,/learn,/chatroutes - Server components use
@/lib/supabase/serverfor auth - Client components use
@/lib/supabase/clientwith automatic token refresh
- Sensitive API keys stored in environment variables (server-only)
- No API keys exposed to client-side code
- Supabase handles password hashing and token management
-
Push to GitHub
git push origin main
-
Import to Vercel
- Go to vercel.com/new
- Import your repository
- Vercel auto-detects Next.js
-
Add environment variables
- Copy all variables from
.env.local - Add to Vercel project settings
- Mark sensitive keys as "Sensitive" (hidden in logs)
- Copy all variables from
-
Deploy
- Vercel automatically deploys on push
- Production URL:
https://your-project.vercel.app
- Railway: Supports Next.js + PostgreSQL
- Netlify: Use
next exportfor static export - AWS Amplify: Full-stack deployment
- Self-hosted: Docker + nginx
Extended Thinking: Enable to see Claude's step-by-step reasoning
// In chat header, toggle "Thinking" mode
// Purple blocks show internal reasoning processLive Web Search: Automatically searches trusted medical sources
// Blue blocks show search results from WHO, CDC, ICMR, etc.
// Click to expand and see sourcesStop Generation: Cancel long responses mid-stream
// Red "Stop" button appears during streaming
// Preserves partial responseUses SuperMemo SM-2 for optimal review scheduling:
- Quality 0-2: Review again immediately
- Quality 3-5: Increase interval (1d β 6d β 14d β 30d...)
- Ease Factor: Adjusts based on recall difficulty
- Implementation: PostgreSQL functions for efficiency
- Daily Activities: Track daily learning time, quizzes completed
- Study Streaks: Consecutive days of activity
- Achievements: Unlock badges for milestones
- Leaderboards: (Future) Compare with peers
-
Create migration (if database changes needed)
-- scripts/012_new_feature.sql CREATE TABLE new_table ( id UUID PRIMARY KEY DEFAULT gen_random_uuid(), user_id UUID REFERENCES auth.users(id) ON DELETE CASCADE, created_at TIMESTAMPTZ DEFAULT NOW() ); ALTER TABLE new_table ENABLE ROW LEVEL SECURITY; CREATE POLICY "Users can access own data" ON new_table FOR ALL USING (auth.uid() = user_id);
-
Add TypeScript types in
lib/types.tsexport interface NewFeature { id: string user_id: string created_at: string }
-
Create API route in
app/api/new-feature/route.tsimport { createClient } from "@/lib/supabase/server" export async function GET(request: Request) { const supabase = await createClient() const { data: { user } } = await supabase.auth.getUser() if (!user) { return NextResponse.json({ error: "Unauthorized" }, { status: 401 }) } const { data } = await supabase.from("new_table").select("*") return NextResponse.json(data) }
-
Write tests in
__tests__/api/new-feature.test.ts
- Check Supabase logs: Dashboard β Logs β API/Database
- Use React DevTools: Inspect component state
- Enable verbose logging: Add
console.login API routes - Test RLS policies: Use Supabase SQL Editor with different users
We welcome contributions! Here's how:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Make your changes
- Write/update tests
- Commit (
git commit -m 'Add amazing feature') - Push (
git push origin feature/amazing-feature) - Open a Pull Request
- Follow existing code style (TypeScript strict mode)
- Write tests for new features
- Update documentation (this README or AGENTS.md)
- Ensure all tests pass (
pnpm test) - Keep commits atomic and descriptive
This project is licensed under the MIT License - see the LICENSE file for details.
- Devaansh Pathak - Creator & Lead Developer
- Anthropic - Claude AI models
- Supabase - Backend infrastructure
- Vercel - AI SDK and hosting
- shadcn/ui - Beautiful UI components
- WHO, CDC, ICMR - Medical guidelines and resources
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Email: [email protected] || [email protected]
- Mobile app (React Native)
- Offline mode for emergency protocols
- Voice-based AI assistant (Hindi + regional languages)
- Video learning modules
- Telemedicine consultations
- Community forums
- Advanced analytics dashboard
- Integration with government health systems
- Multi-language support (10+ Indian languages)
- AR/VR training simulations
- Wearable device integration
- National certification program
- β Core Platform: Complete
- β AI Chat: Complete with extended thinking & web search
- β Learning System: Complete with spaced repetition
- β Gamification: Complete with streaks & achievements
- β Certifications: Complete with blockchain verification
- β Deployments: Complete with AI recommendations
- π§ Mobile App: In planning
- π§ Offline Mode: In planning
Built with β€οΈ for rural healthcare workers in India
Making healthcare accessible, one trained worker at a time.