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.
- 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
Node.js+ExpressMongoDB+MongooseNeo4jRedisHTML/CSS/JavaScript
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
src/Backend app, routes, middleware, services, models, and utilitiespublic/Frontend pages and dashboard scriptsscripts/Seed and helper scripts
Patients upload records that are encrypted before being stored. Record metadata, policy information, and encryption details are managed by the backend.
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
The system supports:
- signed e-prescriptions
- signed lab results
- artifact verification for authenticity and integrity
Doctors can request emergency access. Access is activated only after multi-admin approval and remains auditable and time-bound.
npm installCreate .env using .env.example.
Create .env using .env.example.
Required services:
- MongoDB
- Redis
- Neo4j
npm startFor development:
npm run devnpm run seednpm start- run the appnpm run dev- run in watch modenpm run seed- seed demo datanpm run check- syntax-check core project filesnpm run keygen- generate encryption key material
See .env.example for:
PORTSESSION_SECRETMONGODB_URIREDIS_URLNEO4J_URINEO4J_USERNAMENEO4J_PASSWORDNEO4J_DATABASERECORD_ENCRYPTION_KEYS_JSONRECORD_ENCRYPTION_ACTIVE_KEY_VERSION
Open:
http://localhost:3000/http://localhost:3000/doctorhttp://localhost:3000/patienthttp://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
- Local reports, PDFs, logs, and temporary files are intentionally excluded from the repository.
.env,node_modules, andstorageare not committed.



