Skip to content

Repository files navigation

MedNexus

MedNexus is a secure healthcare coordination system built for a Cryptography and Network Security project. It combines encrypted medical record storage, graph-based authorization, signed clinical documents, emergency access control, and auditability in one application.

What It Does

  • Encrypts uploaded medical records with AES-256-GCM
  • Uses Neo4j relationships for dynamic access control
  • Supports normal treatment access, referrals, and break-glass emergency access
  • Signs prescriptions and lab results with Ed25519
  • Tracks failed decrypt attempts with Redis
  • Maintains audit logs and verification flows
  • Provides separate interfaces for gateway, doctor, patient, and admin roles

Stack

  • Node.js + Express
  • MongoDB + Mongoose
  • Neo4j
  • Redis
  • HTML / CSS / JavaScript

System Architecture

graph TD
    subgraph Frontend
        PatientUI[Patient Dashboard]
        DoctorUI[Doctor Portal]
        AdminUI[Admin Dashboard]
    end

    subgraph Backend - Node.js
        API[Express API]
        SecurityGate[SecurityGate Middleware]
        Crypto[AES-256-GCM / Ed25519 Service]
        Audit[SHA-256 Audit Logger]
    end

    subgraph Data Stores
        MongoDB[(MongoDB)]
        Neo4j[(Neo4j Graph DB)]
        Redis[(Redis Cache)]
    end

    PatientUI --> API
    DoctorUI --> API
    AdminUI --> API

    API --> SecurityGate
    SecurityGate --> Crypto
    API --> Audit

    SecurityGate -->|Check Attributes & Policy| MongoDB
    SecurityGate -->|Verify TREATS Edge| Neo4j
    SecurityGate -->|Rate Limiting & IDS| Redis
    Audit -->|Write Chained Log| MongoDB
Loading

Screenshots

Home / Login Patient Dashboard Doctor Portal Admin Dashboard

Project Structure

  • src/ Backend app, routes, middleware, services, models, and utilities
  • public/ Frontend pages and dashboard scripts
  • scripts/ Seed and helper scripts

Main Features

Encrypted Record Storage

Patients upload records that are encrypted before being stored. Record metadata, policy information, and encryption details are managed by the backend.

Graph-Based Authorization

Doctors do not get access by role alone. Decrypt authorization depends on:

  • attribute-policy match
  • a live Neo4j relationship to the patient
  • emergency or referral state when applicable

Signed Clinical Workflows

The system supports:

  • signed e-prescriptions
  • signed lab results
  • artifact verification for authenticity and integrity

Emergency Access

Doctors can request emergency access. Access is activated only after multi-admin approval and remains auditable and time-bound.

Setup

1. Install dependencies

npm install

2. Configure environment

Create .env using .env.example. Create .env using .env.example.

Required services:

  • MongoDB
  • Redis
  • Neo4j

3. Start the app

npm start

For development:

npm run dev

4. Seed demo data

npm run seed

Available Scripts

  • npm start - run the app
  • npm run dev - run in watch mode
  • npm run seed - seed demo data
  • npm run check - syntax-check core project files
  • npm run keygen - generate encryption key material

Environment Variables

See .env.example for:

  • PORT
  • SESSION_SECRET
  • MONGODB_URI
  • REDIS_URL
  • NEO4J_URI
  • NEO4J_USERNAME
  • NEO4J_PASSWORD
  • NEO4J_DATABASE
  • RECORD_ENCRYPTION_KEYS_JSON
  • RECORD_ENCRYPTION_ACTIVE_KEY_VERSION

Running the Demo

Open:

  • http://localhost:3000/
  • http://localhost:3000/doctor
  • http://localhost:3000/patient
  • http://localhost:3000/admin

The app exposes:

  • doctor decrypt queues with locked/decryptable separation
  • referral and emergency access workflows
  • signed artifact creation and verification
  • admin graph and audit views

Notes

  • Local reports, PDFs, logs, and temporary files are intentionally excluded from the repository.
  • .env, node_modules, and storage are not committed.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages