Skip to content

About

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

61 Commits

Folders and files

Repository files navigation

MedSync

MedSync is a full-stack healthcare AI app that helps users upload medical reports, organize their records, and ask questions about their own health data using retrieval-augmented generation.

Website: Visit the live app

What it does

  • Sign up, log in, reset your password, edit your profile, and delete your account with all its data
  • Upload medical reports (PDF, PNG, JPG, or HEIC photos converted in the browser)
  • Extract structured report data (patient, date, type, diagnoses, medications, lab values)
  • Chat about your own reports: answers stream in, cite the source files, and get an automated faithfulness check
  • Log vitals (heart rate, sleep, steps), browse your report vault, and export a health summary as PDF

Tech Stack

  • Frontend: Next.js 16 (App Router), React 19, TypeScript, Tailwind CSS
  • Backend: Next.js route handlers (TypeScript) on Vercel; no separate server
  • AI / RAG: Vercel AI SDK 7 with OpenAI (gpt-4o-mini for chat and extraction, text-embedding-3-small for embeddings), HyDE query rewriting, metadata filters
  • Data: Supabase: Auth, Postgres + pgvector (HNSW index) for report chunks, private Storage for uploaded files
  • Delivery: GitHub Actions CI (typecheck, lint, unit tests, build), Vercel hosting

How it works

  1. A signed-in user uploads a report in the Vault; the browser stores it in their private Supabase Storage folder.
  2. The app downloads it in the background, extracts structured data (text PDFs by reading their text, photos and scanned PDFs with a vision model), and reuses the result for identical files.
  3. The report is split into chunks, embedded, and stored in pgvector — tagged with the user's id.
  4. Chat retrieves only that user's most relevant chunks and answers from them, citing sources.

Run it locally

cd frontend
cp .env.example .env.local   # Supabase URL + keys, OPENAI_API_KEY
npm install
npm run dev                  # http://localhost:3000

Apply the SQL files in supabase/migrations/ (in order) to your Supabase project. In Supabase set Authentication → Providers → Email on, and keep a CAPTCHA enabled under Attack Protection because signup is open. Deploy by importing the repo into Vercel with root directory frontend and the same environment variables.

Security and limits

  • Row Level Security on every table; route handlers query as the signed-in user, and the service-role key is used only for account deletion.
  • Storage rules limit each user to their own folder; deleting a report removes the file before the database row.
  • Daily per-user limits (30 questions, 5 uploads) are enforced in a database function.

Tests

cd frontend
npm test            # unit tests
npm run smoke       # end-to-end check against real Supabase + OpenAI (set SMOKE_URL for a deployed site)

Disclaimer

MedSync is a personal project for report-based Q&A. It is not a medical device, gives no medical advice or diagnosis, and is not HIPAA-compliant. Always confirm facts against your original reports and ask a clinician about health decisions.

About

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages