SecureMed is an enterprise-grade healthcare management platform designed with a "Security First" approach. It connects patients, doctors, and administrators through a secure, role-based environment, facilitating appointment scheduling, medical record management, and telemedicine services while ensuring data privacy and compliance.
- Intro
- Architecture
- Installing and Updating
- Docker Setup
- Manual Install
- Backend Setup
- Frontend Setup
- Environment Variables
- Core Capabilities
- Identity & Access Control (RBAC)
- Patient Management & Consent
- Clinical Tools & E-Prescribing
- Telemedicine
- Security Infrastructure
- Audit Logging
- Break-Glass Protocol
- Data Anonymization
- Running Tests
- API Documentation
- Deployment
- License
SecureMed provides a decoupled, secure ecosystem for managing healthcare operations. Unlike standard hospital management systems, every interaction in SecureMed is governed by strict consent policies and audit trails.
Quick Glance:
- Frontend: Next.js 14 (App Router), Tailwind CSS, Shadcn UI.
- Backend: Django 5.0+, Django REST Framework, SimpleJWT.
- Infra: Docker, PostgreSQL 15+, Redis, Celery.
SecureMed operates as a headless system where the Django backend serves as the single source of truth for security policy enforcement.
- Authentication: JWT (JSON Web Tokens) with rotation and refresh mechanisms.
- MFA: Time-based One-Time Passwords (TOTP) via
pyotp. - Compliance: HIPAA-compliant data structures for medical records.
To install and start the entire SecureMed stack (Backend, Frontend, DB, Redis), run the following:
git clone [https://github.com/anurup-r-krishnan/securemed.git](https://github.com/anurup-r-krishnan/securemed.git)
cd securemed
docker-compose up --build
This will spin up:
* Backend: [http://localhost:8000](http://localhost:8000)
* Frontend: [http://localhost:3000](http://localhost:3000)
* PostgreSQL: Port 5432
* Redis: Port 6379
---
## π§ Manual Install
If you prefer to run services individually for development or debugging.
---
### π₯ Backend Setup
**Prerequisites:** Python 3.10+, PostgreSQL
```bash
cd securemed-backendCreate and activate virtual environment:
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activateInstall dependencies:
pip install -r requirements.txtRun migrations and seed data:
python manage.py migrate
python manage.py runscript seed_dataStart server:
python manage.py runserverPrerequisites: Node.js v18+
cd securemed-frontendInstall dependencies:
npm installConfigure environment:
cp .env.local.example .env.local
# Ensure NEXT_PUBLIC_API_URL=http://localhost:8000Start development server:
npm run devCreate a .env file inside securemed-backend/.
SECRET_KEYβ Django secret key (critical for crypto signing)DEBUGβ True (dev), False (prod)ALLOWED_HOSTSβ Comma-separated list of allowed hosts
DB_NAMEDB_USERDB_PASSWORDDB_HOSTDB_PORT
EMAIL_BACKENDEMAIL_HOSTEMAIL_PORTEMAIL_HOST_USEREMAIL_HOST_PASSWORD
FRONTEND_URLβ Used for generating password reset and invitation links
SecureMed implements strict Role-Based Access Control.
Roles:
- Patient
- Doctor
- Provider
- Admin
Security Features:
- MFA (Google Authenticator compatible TOTP)
- Rate Limiting (5 failed attempts β 15 min lock)
- HttpOnly/Secure cookies
- Automatic JWT blacklisting on logout
- Consent Dashboard (granular access control)
- Timeline View (appointments, labs, medications)
- Policy Versioning with re-consent triggers
- Digital Prescription Writer
- Locked prescriptions after signing
- Password re-entry for digital signature verification
- Lab Orders with unique Sample ID
- Medication history tracking
- Secure video rooms (UUID-based)
- Waiting room with manual admit
- Session-persistent chat sidebar
- JSON structured logs
- Logs UserID, Endpoint, Timestamp, Method
- Differentiates Read vs Write actions
- PII scrubbed before storage
Emergency access when consent cannot be obtained.
- Endpoint:
/api/medical_records/break_glass/ - Mandatory justification required
- High-priority audit alert logged
- PrivacyEngine utility
- Research export with UUID identifiers
- Right to be Forgotten (30-day grace period + PII scrubbing)
Backend tests:
cd securemed-backend
python manage.py testVerification scripts:
# Verify RBAC
python manage.py runscript verification_tests.verify_rbac
# Verify MFA
python manage.py runscript verification_tests.verify_mfaWhen backend is running:
- Swagger UI: http://localhost:8000/api/docs/
- ReDoc: http://localhost:8000/api/redoc/
The project is containerized and ready for cloud deployment (e.g., Google Cloud Run).
Build:
docker build -t securemed-backend .Deploy:
gcloud run deploy securemed-backend --source .Ensure cloudrun-service.yaml is configured with your project ID.