AI-powered medical office management system built with Next.js, Supabase, and Mistral AI.
- Patient Management: CRUD operations for patient records with medical history
- Appointment Scheduling: Calendar-based appointment system with visit templates
- AI Diagnosis Tool: Mistral AI-powered symptom analysis and diagnosis suggestions
- Visit Templates: Pre-configured templates for common visit types
- Medical History: Searchable timeline of patient visits and treatments
- Frontend: Next.js 15, TypeScript, Tailwind CSS, shadcn/ui
- Backend: Next.js API Routes
- Database: Supabase (PostgreSQL)
- AI: Mistral AI API
- State Management: TanStack Query (React Query)
git clone <repository-url>
cd medivix
npm installCopy .env.example to .env.local and fill in your values:
cp .env.example .env.localRequired environment variables:
NEXT_PUBLIC_SUPABASE_URL: Your Supabase project URLNEXT_PUBLIC_SUPABASE_ANON_KEY: Your Supabase anon public keyMISTRAL_API_KEY: Your Mistral AI API key
- Create a new Supabase project at supabase.com
- Go to the SQL editor in your Supabase dashboard
- Copy and run the SQL script from
database/schema.sql
This will create all necessary tables, indexes, and sample data.
npm run devOpen http://localhost:3000 in your browser.
medivix/
├── src/
│ ├── app/ # Next.js app router pages
│ │ ├── api/ # API routes
│ │ ├── patients/ # Patient management pages
│ │ ├── appointments/ # Appointment scheduling pages
│ │ ├── diagnose/ # AI diagnosis tool
│ │ └── templates/ # Visit templates management
│ ├── components/ # React components
│ │ ├── ui/ # shadcn/ui components
│ │ └── custom/ # Custom application components
│ └── lib/ # Utility functions
│ ├── supabase.ts # Supabase client
│ ├── mistral.ts # Mistral AI client
│ └── utils.ts # General utilities
├── database/
│ └── schema.sql # Database schema and sample data
└── public/ # Static assets
-
GET /api/patients- List all patients -
POST /api/patients- Create new patient -
GET /api/patients/[id]- Get patient details with history -
PUT /api/patients/[id]- Update patient -
DELETE /api/patients/[id]- Delete patient -
GET /api/appointments- List appointments -
POST /api/appointments- Create appointment -
PUT /api/appointments/[id]- Update appointment -
DELETE /api/appointments/[id]- Delete appointment -
GET /api/templates- List visit templates -
POST /api/templates- Create visit template -
POST /api/diagnose- AI diagnosis and follow-up suggestions
- Create component in
src/components/ - Export from
src/components/index.ts - Import and use in pages
- Update
src/lib/supabase.tstype definitions - Create migration in
database/migrations/ - Update schema documentation
The Mistral AI integration supports:
- Symptom analysis
- Diagnosis suggestions with confidence scores
- Follow-up recommendations (tests, referrals, appointments)
- Push code to GitHub
- Import project to Vercel
- Add environment variables in Vercel dashboard
- Deploy
Ensure all environment variables are set in your deployment platform:
NEXT_PUBLIC_SUPABASE_URLNEXT_PUBLIC_SUPABASE_ANON_KEYMISTRAL_API_KEY
- Row Level Security (RLS) enabled on all Supabase tables
- Environment variables for all API keys
- Input validation with Zod schemas
- HIPAA compliance considerations built-in
MIT License - see LICENSE file for details.
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request