tpt-doctor

TypeScript

A HIPAA/GDPR-compliant medical practice management platform built as a TypeScript monorepo. Covers EHR, appointments, telemedicine, billing, prescriptions, lab orders, and a patient portal — with multi-country support (AU, NZ, UK, CA) and deployable to AWS, Azure, GCP, or on-premise.

0 stars1 forks0 watchersMIT License
dockerehrfhirgdprhealthcarehipaamedicalmonoreponextjspatient-portalpnpm-workspacespostgresqlprismaself-hostedtelemedicineterraformtypescript

Languages

TypeScript92.4%HCL4.3%CSS0.9%Shell0.7%PLpgSQL0.6%JavaScript0.5%Jinja0.3%Dockerfile0.2%HTML0.1%
README

TPT Doctor — Complete Medical Practice Platform

Open-source, HIPAA-compliant, multi-country medical practice management platform.
Manage patients, appointments, EHR, billing, prescriptions, lab orders, telemedicine, and more — all in one system.

License: MIT Node pnpm PostgreSQL TypeScript


Features

ModuleWhat it does
Patient ManagementRegistration, demographics, insurance, search, merge, consent management
Electronic Health RecordsSOAP notes, vitals, medical history, problem lists, clinical timeline, document upload
Appointment SchedulingCalendar (day/week/month), booking, recurring, waitlist, reminders, check-in/out
Staff ManagementRoles, permissions, schedules, PTO, credentialing, performance metrics
Patient PortalSelf-service login, medical records, lab results, appointment requests, messaging
Secure MessagingInbox/outbox, threading, file attachments, read receipts, urgent flags
Billing & InvoicingInvoices, insurance claims, payment processing (Stripe/Airwallex), ERA/EOB, aging reports
PrescriptionsePrescribing, drug interactions, controlled substances (DEA), pharmacy directory
Lab OrdersOrder creation, specimen tracking, result entry, abnormal alerts, FHIR import
TelemedicineVideo consults (WebRTC/Jitsi), waiting room, screen sharing, in-consult chat, recording
ReportingKPIs, clinical quality, financial, demographics, ad-hoc builder, export (CSV/JSON/PDF)
ComplianceHIPAA, GDPR, Australia Privacy Act, NZ HISO, SOC2 — audit logging, encryption, breach notification
Multi-CountryAustralia (MBS/PBS/MHR), New Zealand (MOH/PHO/NHI), UK (NHS/GP Connect), Canada (provincial)
FHIR R4 APIPatient, Observation, MedicationRequest, Appointment, Encounter, Bulk FHIR export
Business IntelligenceRevenue analytics, appointment utilization, clinician productivity, demographics, referral analytics
InventoryClinic supplies, vaccine cold chain, medication samples, retail product sales

Quick Start (5 minutes)

Prerequisites

1. Clone and install

git clone https://github.com/PhillipC05/tpt-doctor.git
cd tpt-doctor
pnpm install

2. Configure authentication

  1. Go to Auth0 Dashboard → Create tenant
  2. Create an API with identifier https://api.tptdoctor.com
  3. Create a Single Page Application for the web app (note the Client ID)
  4. Create a Regular Web Application for the API (note the Client ID & Secret)

Edit .env.development:

AUTH0_DOMAIN=your-tenant.us.auth0.com
AUTH0_CLIENT_ID=your-api-client-id
AUTH0_CLIENT_SECRET=your-api-client-secret
AUTH0_AUDIENCE=https://api.tptdoctor.com

For the web app (apps/web/.env.development):

VITE_AUTH0_DOMAIN=your-tenant.us.auth0.com
VITE_AUTH0_CLIENT_ID=your-web-client-id
VITE_AUTH0_AUDIENCE=https://api.tptdoctor.com
VITE_API_URL=http://localhost:4000

3. Start the database

docker compose up -d

4. Run database migrations and seed

pnpm run db:generate
pnpm run db:migrate
pnpm run db:seed

5. Start development servers

pnpm run dev

Deployment Options

🐳 Docker Compose (Self-Hosted — Recommended)

The simplest way to deploy for any single clinic on any VPS:

cp .env.production.example .env
# Edit .env with your values
docker compose -f infrastructure/on-premise/docker-compose.production.yml up -d

Works on any Linux VPS — see guide: docs/deployment/simple-vps.md

🚀 DigitalOcean

Two options — App Platform (no server management) or Droplet (full VPS):

# App Platform: Connect your GitHub repo → auto-deploys via Dockerfile
# Droplet: Full Docker Compose stack with monitoring, storage, telemedicine

Full guide: docs/deployment/digitalocean.md

📦 Any VPS (Linode, Vultr, Hetzner, etc.)

# Works on any Ubuntu VPS — just install Docker and run:
curl -fsSL https://get.docker.com | sh
docker compose -f infrastructure/on-premise/docker-compose.production.yml up -d

Full guide: docs/deployment/simple-vps.md

🤖 Automated (Ansible)

For bare metal or VM on-premise deployment with full automation:

ansible-playbook -i infrastructure/ansible/inventory/hosts.yml infrastructure/ansible/deploy.yml

☁️ Cloud Providers (AWS / Azure / GCP)

Terraform configurations also available for larger deployments:

CloudGuideTerraform
AWSdocs/deployment/cloud/deployment-guide.mdinfrastructure/cloud/aws/
AzureSame guideinfrastructure/cloud/azure/
GCPSame guideinfrastructure/cloud/gcp/

Architecture

┌──────────────────────────────────────────────────────────┐
│                    Nginx (TLS termination)                │
├────────────────────┬──────────────────┬─────────────────┤
│  Web App (React)   │ Patient Portal   │  API (NestJS)   │
│  :3000             │ :3001            │  :4000           │
├────────────────────┴──────────────────┴─────────────────┤
│  PostgreSQL 16  │  Redis 7  │  MinIO (S3)  │  Jitsi    │
│  (encrypted)     │  (cache)  │  (storage)   │  (video)  │
└──────────────────────────────────────────────────────────┘

See docs/architecture/overview.md for the full C4 model.


Project Structure

tpt-doctor/
├── apps/
│   ├── api/                    # NestJS backend (REST API)
│   ├── web/                    # React staff frontend
│   └── patient-portal/         # React patient frontend
├── packages/
│   ├── shared/                 # Types, validators, constants
│   ├── auth/                   # Authentication & RBAC
│   ├── encryption/             # PHI encryption (AES-256-GCM)
│   ├── audit-log/              # Immutable audit trail
│   ├── compliance/             # HIPAA/GDPR/Privacy compliance
│   ├── config/                 # Shared configuration
│   ├── database/               # Prisma schema + migrations
│   └── notifications/          # Notification system
├── infrastructure/
│   ├── cloud/{aws,azure,gcp}/  # Terraform configurations
│   ├── on-premise/             # Docker Compose + backups
│   ├── ansible/                # Automated deployment
│   └── monitoring/             # Prometheus + Grafana
├── docs/                       # Full documentation
├── docker/                     # Docker config files
├── LICENSE                     # MIT License
└── README.md                   # This file

Documentation

DocumentTypeDescription
Quick StartGuideGet started in 5 minutes
Architecture OverviewTechnicalC4 model diagrams and system design
Auth0 SetupGuideStep-by-step authentication setup
System RequirementsReferenceHardware, software, network requirements

User Manuals

DocumentDescription
Clinical Staff GuideDay-to-day operations for doctors, nurses, receptionists
Patient Portal GuideSelf-service guide for patients
Admin GuideSystem administration and tenant management

Deployment & Operations

DocumentDescription
Quick Start (5 min)Fastest way to get running
Self-Hosted (Docker)Full on-premise Docker Compose stack
DigitalOceanDeploy on DigitalOcean (App Platform or Droplet)
Any VPS (Linode, Vultr, etc.)Generic VPS deployment guide
Cloud (AWS/Azure/GCP)Terraform-based cloud deployment
Upgrade GuideHow to upgrade between versions

Security & Compliance

DocumentDescription
Security Hardening ChecklistPre-flight security checklist
Security PoliciesComprehensive security policies
Compliance ManualHIPAA/GDPR/AU/NZ/SOC2 compliance
Disaster RecoveryBackup and restore procedures

Configuration & Integrations

DocumentDescription
Auth0 SetupAuthentication configuration
Telemedicine SetupJitsi and Twilio Video setup
IntegrationsStripe, Twilio, SendGrid, and more
API ReferenceOpenAPI/Swagger documentation

Troubleshooting

DocumentDescription
Troubleshooting FAQCommon issues and solutions

Tech Stack

LayerTechnology
BackendNestJS, TypeScript, Prisma ORM
FrontendReact 18, Vite, TailwindCSS, Zustand
DatabasePostgreSQL 16
CacheRedis 7
AuthAuth0 (OAuth2/OIDC, JWT, MFA)
EncryptionAES-256-GCM, envelope encryption, KMS (multi-cloud)
StorageS3-compatible (MinIO for self-hosted)
TelemedicineWebRTC, Jitsi Meet, Socket.io
MonitoringPrometheus, Grafana, Sentry
InfrastructureTerraform, Ansible, Docker Compose
TestingJest, Playwright, k6

Contributing

TPT Doctor is MIT licensed — contributions are welcome!

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/my-feature
  3. Commit your changes: git commit -am 'Add my feature'
  4. Push: git push origin feature/my-feature
  5. Open a Pull Request

Please ensure tests pass: pnpm run test


License

MIT License — feel free to use, modify, and distribute.