A comprehensive healthcare assistance platform built with Django REST API and React, featuring AI-powered health insights, ECG analysis, voice-based symptom collection, and doctor-patient portal system.
Team Project: This healthcare platform was developed as a collaborative team project, focusing on creating an accessible and intelligent healthcare solution.
- Frontend: React 19 + TypeScript + Vite
- Backend: Django 5.2 + Django REST Framework + PostgreSQL
- Authentication: Supabase Auth
- AI/ML: Google Gemini API + Scikit-learn (ECG Models)
- Maps: Google Maps API
- Voice Processing: Web Speech API
- Deployment: Railway
- A Railway account
- A Supabase project (for authentication)
- A Google Cloud account (for Gemini AI and Maps API)
git clone <your-repo-url>
cd ai-doctor- Go to Supabase and create a new project
- Go to Settings > API and copy:
- Project URL (
SUPABASE_URL) - Anon/Public key (
SUPABASE_ANON_KEY)
- Project URL (
- Go to Authentication > Providers and enable Google provider:
- Add your Google OAuth credentials
- Set redirect URL to:
https://your-frontend.railway.app
- Go to Google Cloud Console
- Create a new project or select existing
- Enable these APIs:
- Generative Language API (for Gemini)
- Maps JavaScript API
- Places API
- Go to Credentials and create an API key
- Restrict the key to the APIs above
-
Go to Railway and click New Project
-
Select Deploy from GitHub repo and choose your repository
-
Railway will detect the project. Click on the service and go to Settings:
- Set Root Directory to:
backend - Set Start Command to:
gunicorn config.wsgi --bind 0.0.0.0:$PORT
- Set Root Directory to:
-
Add a PostgreSQL database:
- Click New > Database > PostgreSQL
- Railway will automatically set
DATABASE_URL
-
Go to Variables tab and add these environment variables:
# Django
DJANGO_SECRET_KEY=<generate-a-secure-random-string>
DJANGO_DEBUG=false
DJANGO_ALLOWED_HOSTS=<your-backend>.railway.app
# Database (Railway auto-provides these, but you can also use individual vars)
POSTGRES_DB=${{Postgres.PGDATABASE}}
POSTGRES_USER=${{Postgres.PGUSER}}
POSTGRES_PASSWORD=${{Postgres.PGPASSWORD}}
POSTGRES_HOST=${{Postgres.PGHOST}}
POSTGRES_PORT=${{Postgres.PGPORT}}
# CORS (add your frontend URL after deploying it)
CORS_ALLOWED_ORIGINS=https://<your-frontend>.railway.app
CSRF_TRUSTED_ORIGINS=https://<your-frontend>.railway.app
# Supabase
SUPABASE_URL=https://<your-project>.supabase.co
SUPABASE_ANON_KEY=<your-supabase-anon-key>
# Google APIs
GEMINI_API_KEY=<your-gemini-api-key>
GOOGLE_MAPS_API_KEY=<your-google-maps-api-key>-
Click Deploy and wait for the build to complete
-
Once deployed, run migrations:
- Go to Settings > Deploy section
- The
releasecommand in Procfile will auto-run migrations
-
Note your backend URL (e.g.,
https://ai-doctor-backend.railway.app)
-
In the same Railway project, click New > GitHub Repo
-
Select the same repository
-
Go to Settings:
- Set Root Directory to:
frontend - Set Build Command to:
npm install && npm run build - Set Start Command to:
npx serve dist -s -l $PORT
- Set Root Directory to:
-
Go to Variables tab and add:
VITE_API_URL=https://<your-backend>.railway.app
VITE_SUPABASE_URL=https://<your-project>.supabase.co
VITE_SUPABASE_ANON_KEY=<your-supabase-anon-key>
VITE_GOOGLE_MAPS_API_KEY=<your-google-maps-api-key>-
Click Deploy
-
Note your frontend URL and update:
- Backend's
CORS_ALLOWED_ORIGINSandCSRF_TRUSTED_ORIGINS - Supabase's redirect URLs in Authentication settings
- Backend's
After both services are deployed, update the backend's environment variables:
CORS_ALLOWED_ORIGINS=https://<your-frontend>.railway.app
CSRF_TRUSTED_ORIGINS=https://<your-frontend>.railway.app
DJANGO_ALLOWED_HOSTS=<your-backend>.railway.appRedeploy the backend for changes to take effect.
- Go to Supabase Dashboard > Authentication > URL Configuration
- Add your frontend URL to:
- Site URL:
https://<your-frontend>.railway.app - Redirect URLs:
https://<your-frontend>.railway.app
- Site URL:
cd backend
# Create virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
# Copy env file and configure
cp .env.example .env
# Edit .env with your values
# Run migrations
python manage.py migrate
# Start server
python manage.py runservercd frontend
# Install dependencies
npm install
# Copy env file and configure
cp .env.example .env
# Edit .env with your values
# Start dev server
npm run devβββ backend/
β βββ api/ # Django app with views, models, services
β βββ config/ # Django settings and URLs
β βββ manage.py
β βββ requirements.txt
β βββ Procfile # Railway/Heroku process file
β βββ railway.json # Railway configuration
β
βββ frontend/
β βββ src/
β β βββ components/ # React components
β β βββ lib/ # Utilities and helpers
β β βββ App.tsx # Main app component
β βββ package.json
β βββ railway.json # Railway configuration
β
βββ README.md
| Variable | Description | Required |
|---|---|---|
DJANGO_SECRET_KEY |
Django secret key | Yes |
DJANGO_DEBUG |
Debug mode (false in production) | Yes |
DJANGO_ALLOWED_HOSTS |
Allowed hostnames | Yes |
POSTGRES_* |
Database credentials | Yes |
CORS_ALLOWED_ORIGINS |
Frontend URLs for CORS | Yes |
CSRF_TRUSTED_ORIGINS |
Trusted origins for CSRF | Yes |
SUPABASE_URL |
Supabase project URL | Yes |
SUPABASE_ANON_KEY |
Supabase anonymous key | Yes |
GEMINI_API_KEY |
Google Gemini API key | Yes |
GOOGLE_MAPS_API_KEY |
Google Maps API key | Optional |
TWILIO_* |
Twilio credentials for calling | Optional |
| Variable | Description | Required |
|---|---|---|
VITE_API_URL |
Backend API URL | Yes |
VITE_SUPABASE_URL |
Supabase project URL | Yes |
VITE_SUPABASE_ANON_KEY |
Supabase anonymous key | Yes |
VITE_GOOGLE_MAPS_API_KEY |
Google Maps API key | Optional |
- Check that
Root Directoryis set correctly (backendorfrontend) - Verify all required environment variables are set
- Check build logs for specific errors
- Ensure
CORS_ALLOWED_ORIGINSincludes your frontend URL withhttps:// - Make sure there are no trailing slashes in the URLs
- Redeploy backend after changing CORS settings
- Verify PostgreSQL addon is attached to your backend service
- Check that
POSTGRES_*variables reference the correct Railway variables - Try using
DATABASE_URLformat instead of individual variables
- Verify Supabase URL and anon key are correct in both frontend and backend
- Check Supabase redirect URLs include your frontend domain
- Ensure Google OAuth is properly configured in Supabase
Run this Python command to generate a secure secret key:
python -c "from django.core.management.utils import get_random_secret_key; print(get_random_secret_key())"Or use an online generator like Djecrety
MIT License