AI-Powered CT Scan Analysis Platform built with Next.js, Supabase, and Gemini AI.
- 🔐 User Authentication - Secure login/register with Supabase Auth
- 📤 CT Scan Upload - Upload medical images to Supabase Storage
- 🤖 AI Analysis - Powered by Gemini 2.5 Pro for accurate medical imaging analysis
- 📊 Detailed Reports - Comprehensive analysis with severity levels, abnormalities, precautions, and recommendations
- 📱 Responsive Design - Beautiful medical-themed UI with Tailwind CSS
- 🔒 Secure & Private - Row-level security with Supabase
- 📜 Scan History - View all your previous scans and analyses
- Frontend: Next.js 14, React 18, TypeScript
- Styling: Tailwind CSS with custom medical theme
- Backend: Next.js API Routes
- Database: Supabase PostgreSQL
- Storage: Supabase Storage
- Authentication: Supabase Auth
- AI: Google Gemini 2.5 Pro
- Node.js 18+ installed
- Supabase account
- Google AI (Gemini) API key
-
Clone the repository
cd c:\projects\MedScanX
-
Install dependencies
npm install
-
Set up environment variables
Create a
.env.localfile in the root directory:NEXT_PUBLIC_SUPABASE_URL=your_supabase_project_url NEXT_PUBLIC_SUPABASE_ANON_KEY=your_supabase_anon_key GEMINI_API_KEY=your_gemini_api_key
-
Set up Supabase
- Create a new Supabase project
- Run the SQL schema from
supabase/schema.sqlin the Supabase SQL Editor - This will create:
scanstable with RLS policiesscansstorage bucket- Necessary indexes and triggers
-
Run the development server
npm run dev
-
Open your browser
Navigate to http://localhost:3000
MedScanX/
├── app/
│ ├── api/ # API routes
│ │ ├── auth/ # Authentication endpoints
│ │ ├── upload/ # File upload endpoint
│ │ ├── analyze/ # AI analysis endpoint
│ │ └── scans/ # Scan retrieval endpoints
│ ├── dashboard/ # User dashboard
│ ├── login/ # Login page
│ ├── register/ # Registration page
│ ├── upload/ # Scan upload page
│ ├── scan/[id]/ # Detailed scan view
│ ├── layout.tsx # Root layout
│ ├── page.tsx # Landing page
│ └── globals.css # Global styles
├── components/
│ ├── ui/ # Reusable UI components
│ │ ├── Button.tsx
│ │ ├── Input.tsx
│ │ ├── Card.tsx
│ │ ├── SeverityBadge.tsx
│ │ └── Skeleton.tsx
│ └── medical/ # Medical-specific components
│ ├── ScanPreview.tsx
│ ├── AnalysisCard.tsx
│ ├── PrecautionList.tsx
│ ├── RecommendationsCard.tsx
│ └── Disclaimer.tsx
├── lib/
│ ├── supabase/ # Supabase client utilities
│ │ ├── client.ts # Browser client
│ │ └── server.ts # Server client
│ └── types.ts # TypeScript types
├── supabase/
│ └── schema.sql # Database schema
└── package.json
- Secure user registration and login
- Session management with Supabase Auth
- Protected routes and API endpoints
- Support for JPEG, PNG, and DICOM formats
- Automatic file validation
- Secure storage in Supabase bucket
- Public URL generation
- Integration with Gemini 2.5 Pro
- Structured JSON response parsing
- Severity classification (low, medium, high, critical)
- Detailed abnormality detection
- Personalized precautions and recommendations
- Loading states with skeleton screens
- Optimistic UI updates
- Error handling and validation
- Mobile-responsive design
- Print-friendly reports
This project is for educational and demonstration purposes.
For issues or questions, please open an issue on the repository.