Mediverse is a full-stack clinical AI platform that combines a production-ready FastAPI backend with a Next.js landing experience. It orchestrates Google Gemini, OpenRouter multi-model endpoints, Redis caching, and Supabase/PostgreSQL persistence to deliver safe, auditable healthcare guidance.
- π€ Multi-model orchestration β flip between Gemini and OpenRouter without redeploying.
- π©Ί Clinical guardrails β emergency detection, medication validation, and disclaimers on every answer.
- βοΈ Operational tooling β Redis caching, Prometheus metrics, rate limiting, and Postgres logging baked in.
- π Immersive frontend β animated landing page with live demo, testimonials, modal dialogs, and working CTAs.
- οΏ½ Ready for production β Docker workflow, Supabase compatibility, and environment templates.
mediverse/
βββ backend/ # FastAPI service, tests, Docker assets
β βββ app/
β βββ scripts/
β βββ tests/
β βββ .env
β βββ Dockerfile
β βββ requirements.txt
βββ frontend/ # Next.js 14 app with Tailwind + Framer Motion
β βββ app/
β βββ components/
β βββ public/
β βββ package.json
β βββ tailwind.config.ts
βββ .gitignore
βββ .venv/ (optional local virtualenv)
The backend and frontend are intentionally decoupled so each stack can evolve independently while sharing a single repo and README.
- Python 3.11+
- Redis 7+
- PostgreSQL 15+ (or Supabase Postgres)
- Tavily and Gemini API keys (OpenRouter optional)
cd backend
python -m venv ..\.venv
..\.venv\Scripts\activate
pip install --upgrade pip
pip install -r requirements.txt
uvicorn app.main:app --reload --port 8000Populate backend/.env using the provided defaults as a starting point. Key variables:
| Variable | Description |
|---|---|
GEMINI_API_KEY |
Google Gemini API key |
TAVILY_API_KEY |
Tavily search key |
LLM_PROVIDER |
gemini (default) or openrouter |
OPENROUTER_API_KEY |
Required when using OpenRouter |
OPENROUTER_MODEL |
Desired OpenRouter model slug |
DATABASE_URL |
Primary Postgres connection (defaults to mediverse) |
SUPABASE_DB_URL |
Optional override for Supabase-hosted Postgres |
REDIS_URL |
Redis instance for caching |
-
Copy the Supabase "connection string" and place it in
SUPABASE_DB_URL(SSL enforced automatically). -
Provision tables:
cd backend python -m dotenv run -- python scripts/init_db.py -
Launch the API (see commands above).
Update the provider block in backend/.env:
LLM_PROVIDER=openrouter
OPENROUTER_API_KEY=sk-or-...
OPENROUTER_MODEL=meta-llama/llama-3.1-70b-instruct
OPENROUTER_SITE_URL=https://your-mediverse-instance
OPENROUTER_APP_NAME="Mediverse"Restart Uvicorn and Mediverse will automatically forward the required headers (HTTP-Referer, X-Title).
cd backend
..\.venv\Scripts\activate
python -m pytestcd backend
docker compose up --buildServices launched: FastAPI (web), Postgres (db), Redis (redis), and NGINX (nginx). The helper script deploy.sh demonstrates a CI-friendly flow (build β migrations β tests β health check).
The landing page lives in frontend/ and showcases Mediverse with smooth animations (Framer Motion), Tailwind styling, Headless UI dialogs, and a live demo console that talks to the backend.
cd frontend
npm install
cp .env.local.example .env.local # optional β customise API base URL
npm run devThe development server runs on http://localhost:3000 and the backend demo console defaults to http://localhost:8000 unless overridden via NEXT_PUBLIC_API_BASE_URL.
- Animated hero, metric counters, and feature reveals powered by Framer Motion.
- Modal booking flow built with Headless UI, including working CTA buttons.
- Live demo widget that posts sample prompts to the FastAPI backend and renders responses.
- Testimonial carousel with autoplay and manual navigation.
- Responsive sections for workflow, FAQ, partners, and contact form with validation states.
cd frontend
npm run build
npm run start- Start the backend (
uvicornordocker compose). - Run the frontend dev server (
npm run dev). - Visit
http://localhost:3000to explore the Mediverse experience.
Tip: For local HTTPS or edge deployments, point the frontend
.env.localat the corresponding backend URL.
GET /healthβ heartbeat returning service metadata.POST /api/v1/queryβ submit a medical question with optional source aggregation.GET /api/v1/historyβ retrieve recent questions (requires DB).GET /metricsβ Prometheus metrics endpoint.
Interactive docs remain available at /docs while the server runs.
Deploy both frontend and backend serverless on Vercel:
- Quick Deploy: See DEPLOY_QUICK.md for 3-step guide
- Full Guide: See VERCEL_DEPLOYMENT.md for complete documentation
Key Features:
- β Automatic HTTPS and CDN
- β Serverless scaling (pay per use)
- β Free tier available (100GB bandwidth, 100 hours compute)
- β Auto-deploy on git push
- β Built-in analytics and monitoring
Traditional container deployment:
cd backend
docker-compose up -d- Every AI response includes an explicit disclaimer and medication scan.
- Emergency queries are flagged and short-circuited.
- Redis-backed caching honours TTLs to prevent stale unsafe content.
- Postgres schemas are ready for analytics and audit trails.
- NGINX config + SSL assets ship with the backend for production hardening.
- Fine-tuned analytics dashboard within the frontend.
- Authentication & multi-tenant admin controls.
- Expanded integration recipes (Epic, Cerner, Salesforce Health Cloud).
Mediverse is provided as-is. Adapt the stack and configuration to meet your organisation's regulatory requirements before going live.