Skip to content

aharon-kumar-kosetti/medivault

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

10 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ₯ MediVault

Encrypted. Consent-driven. AI-augmented. Patient-first.

React Node.js PostgreSQL Appwrite OpenAI

πŸ₯ˆ 2nd Place β€” Udhbhav 2k26 πŸ†


πŸ‘₯ Built By

πŸ₯ˆ 2nd Place β€” Udhbhav 2k26

Name GitHub
Aharon Kosetti @aharon-kumar-kosetti
Bhanu Prakash Yirri @bhanuprakashyirri
Mohith Kumar Baggu @mohithkumar64
Abishai Jogi @abishai-jogi
Saketh @reddyvenkatasaketh
Ram Sai @ramsaik3339-cloud

🩺 The Problem

Every year, patients repeat tests, face delayed diagnoses, and receive unsafe care β€” all because their records are scattered across different hospitals and providers.

Healthcare data is fragmented, inaccessible, and out of the patient's hands. In emergencies, this costs lives.

MediVault fixes this.


πŸ’‘ What is MediVault?

MediVault is a secure, role-based medical records platform that puts patients in full control of their health data. Patients own their records. Doctors request access. Hospitals stay accountable. AI makes it all understandable.

  • πŸ” Patient-owned encrypted records
  • βœ… Explicit, auditable consent flows
  • 🚨 Emergency break-glass access with guardrails
  • πŸ€– AI-powered report summaries

✨ Key Features

Feature Description
πŸ§‘β€βš•οΈ Role-Based Dashboards Separate, purpose-built flows for Patients, Doctors, and Hospitals
πŸ—„οΈ Secure Document Vault Encrypted upload/download with strict role-based authorization
🀝 Consent & Access Governance Request, approve, reject, grant, revoke β€” full lifecycle control
🚨 Emergency Access Workflow 24-hour break-glass access with full audit trail
πŸ€– AI Medical Summarization GPT-4o powered structured summaries of uploaded medical records

πŸ› οΈ Tech Stack

Frontend

  • βš›οΈ React 19 + React Router 7
  • ⚑ Vite 7
  • 🎨 Custom CSS (landing, auth, dashboards)

Backend

  • 🟒 Node.js + Express 5
  • πŸ”‘ Custom HMAC-signed bearer token auth (role-aware)
  • πŸ›‘οΈ Rate limiting, CORS controls, bcrypt password hashing

Data & Storage

  • 🐘 PostgreSQL + Drizzle ORM
  • ☁️ Appwrite Storage (document files)

AI

  • πŸ€– OpenRouter β†’ GPT-4o (medical document summarization)

Tooling

  • ESLint 9 Β· Concurrently Β· dotenv

πŸš€ Getting Started

Prerequisites

  • Node.js (LTS)
  • npm
  • PostgreSQL database
  • Appwrite project + bucket
  • OpenRouter API key (for AI summaries)

Installation

# 1. Clone the repo
git clone https://github.com/aharon-kumar-kosetti/medivault-react.git
cd medivault-react

# 2. Install dependencies
npm install

Environment Setup

Create a single .env file in the project root (you can copy from .env.example).

# Frontend (Vite)
# Keep empty to use relative paths (recommended for Vercel rewrites).
VITE_API_BASE_URL=
VITE_ENABLE_MOCK_AUTH=false

# Backend (Node/Express)
DATABASE_URL=your_postgres_url
SESSION_SECRET=your_secret_key
API_PORT=3001
API_HOST=0.0.0.0
ALLOWED_ORIGINS=http://localhost:5173
NODE_ENV=development

# Appwrite
APPWRITE_ENDPOINT=https://cloud.appwrite.io/v1
APPWRITE_PROJECT_ID=your_project_id
APPWRITE_API_KEY=your_appwrite_key
APPWRITE_BUCKET_ID=medivault-documents

# AI
GEMINI_API_KEY=your_openrouter_key

Database Setup

# Generate and run migrations
npx drizzle-kit generate
npx drizzle-kit migrate

Run the App

# Full stack (recommended)
npm run dev:all

# Frontend only
npm run dev

# Backend only
npm run dev:api

# Production build
npm run build
npm run preview

Vercel Deployment

  1. Push your repo to GitHub.
  2. Import the project in Vercel.
  3. Build settings are auto-read from vercel.json:
  • Build command: npm run build
  • Output directory: dist
  1. Add environment variables in Vercel Project Settings β†’ Environment Variables:
  • DATABASE_URL
  • SESSION_SECRET
  • APPWRITE_ENDPOINT
  • APPWRITE_PROJECT_ID
  • APPWRITE_API_KEY
  • APPWRITE_BUCKET_ID
  • GEMINI_API_KEY
  • Optional: ALLOWED_ORIGINS
  1. Redeploy.

Operational notes:

  • /api/*, /auth/*, and /health are rewritten to the Express serverless function in api/server.js.
  • The catch-all rewrite sends other routes to index.html, so React Router works on refresh/deep links.
  • Leave VITE_API_BASE_URL empty in production to use relative URLs through Vercel rewrites.

πŸ“ Architecture

See full architecture diagram: public/docs/MediVault-Architecture.pdf

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚               React Frontend                β”‚
β”‚     Patient Β· Doctor Β· Hospital Dashboards  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                   β”‚ HMAC Bearer Token Auth
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚           Express API (Node.js)             β”‚
β”‚   Auth Β· Records Β· Consent Β· Emergency Β· AI β”‚
β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
       β”‚           β”‚              β”‚
  β”Œβ”€β”€β”€β”€β–Όβ”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”
  β”‚PostgreSQLβ”‚ β”‚ Appwrite β”‚ β”‚  GPT-4o AI β”‚
  β”‚  (Data) β”‚ β”‚(Documentsβ”‚ β”‚ (Summaries)β”‚
  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ—ΊοΈ Roadmap

  • Object storage migration β€” Backfill blob payloads from DB to object storage at scale
  • Token revocation table β€” revoked_tokens for immediate session invalidation
  • Legacy path cleanup β€” Retire compatibility branches post-migration
  • Mobile app β€” React Native patient portal
  • HL7 FHIR integration β€” Interoperability with hospital systems

MediVault β€” Encrypted. Consent-driven. AI-augmented. Patient-first.

⭐ Star this repo if you found it useful!

About

Secure, role-based medical records platform with encrypted vaults, consent governance, emergency access, and GPT-4o AI summaries.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors