MediConnect is an enterprise-grade healthcare platform that enables secure appointment scheduling, doctor-patient communication, and clinical note management with HIPAA-compliant security controls, comprehensive testing, and production-ready infrastructure.
- User Management: Role-based authentication (PATIENT, DOCTOR) with JWT tokens
- Appointment Scheduling: Book, view, and manage medical appointments
- Clinical Notes: Secure doctor-to-patient clinical documentation
- Doctor Directory: Search and view available doctors by specialization
- Real-time Data: Upcoming appointments and clinical history tracking
- HIPAA Compliance: PHI masking in logs, encrypted data storage
- JWT Authentication: Stateless token-based security
- Role-Based Access Control (RBAC): Fine-grained authorization per endpoint
- Input Validation: Comprehensive validation for all user inputs
- Password Security: Bcrypt hashing with salt
- Audit Logging: Complete audit trail of user actions
- 90%+ Code Coverage: Mandatory unit + integration testing
- OpenAPI 3.0 Documentation: Auto-generated API specs with Swagger UI
- CI/CD Pipeline: GitHub Actions automation with lint, test, build, deploy
- Docker Containerization: Multi-stage builds for optimized images
- Database Migrations: Prisma ORM with version-controlled schema
- Error Handling: Structured error codes and correlation IDs for tracing
MediConnect/
βββ medi-connect-backend/ # Node.js/Express API
β βββ src/
β β βββ app.ts # Express app with Swagger UI
β β βββ server.ts # Server bootstrap
β β βββ config/ # Environment and database config
β β βββ middlewares/ # Auth and RBAC middlewares
β β βββ modules/ # Feature modules (auth, appointments, notes, doctors)
β β βββ shared/ # Utilities (validation, logging, errors, repositories)
β β βββ types/ # TypeScript interfaces and enums
β βββ prisma/
β β βββ schema.prisma # Database schema
β β βββ migrations/ # Database version history
β βββ __tests__/ # Test suites (90%+ coverage required)
β βββ openapi.yaml # OpenAPI 3.0 specification
β βββ Dockerfile # Multi-stage Docker build
β βββ package.json # Dependencies & scripts
β
βββ medi-connect-frontend/ # Next.js React frontend
β βββ src/
β β βββ app/ # Next.js app router
β β βββ lib/ # Utilities and API client
β β βββ components/ # React components
β βββ public/ # Static assets
β βββ package.json
β
βββ .github/workflows/ # CI/CD automation
βββ ci-cd.yml # GitHub Actions pipeline
Backend
- Runtime: Node.js 18+ with TypeScript
- Framework: Express.js
- Database: PostgreSQL 15+ with Prisma ORM
- Authentication: JWT with RS256 signing
- Validation: Custom validators with regex patterns
- Logging: PHI-safe logger with deep object masking
Frontend
- Framework: Next.js 14+ (React)
- Language: TypeScript
- HTTP Client: Axios with centralized configuration
- Styling: CSS Modules with PostCSS
DevOps
- Containerization: Docker with multi-stage builds
- CI/CD: GitHub Actions
- Testing: Jest with supertest for integration tests
- Code Quality: ESLint, TypeScript strict mode
- Security: Trivy vulnerability scanning
- Node.js 18.x or higher
- npm or yarn
- PostgreSQL 15+
- Docker & Docker Compose (optional)
-
Navigate to backend directory
cd medi-connect-backend -
Install dependencies
npm install
-
Configure environment
cp .env.example .env # Edit .env with your database credentials -
Setup database
npm run prisma:migrate
-
Seed test data
npm run seed
-
Start development server
npm run dev
Server runs on
http://localhost:5000API docs available athttp://localhost:5000/api-docs
-
Navigate to frontend directory
cd medi-connect-frontend -
Install dependencies
npm install
-
Start development server
npm run dev
Frontend runs on
http://localhost:3000
Full interactive API documentation is available at:
- Development:
http://localhost:5000/api-docs - Production:
https://api.mediconnect.health/api-docs
All API requests (except registration/login) require JWT token in header:
curl -H "Authorization: Bearer <token>" \
http://localhost:5000/appointments/patient/upcoming| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
| POST | /auth/register |
Register new user | β |
| POST | /auth/login |
Login and get token | β |
| POST | /appointments/patient |
Create appointment | β PATIENT |
| GET | /appointments/patient/upcoming |
Get patient appointments | β PATIENT |
| GET | /appointments/doctor/upcoming |
Get doctor appointments | β DOCTOR |
| POST | /notes |
Create clinical note | β DOCTOR |
| GET | /notes/{appointmentId} |
Get appointment notes | β |
| GET | /doctors |
List all doctors | β |
See openapi.yaml for complete API specification.
cd medi-connect-backend
npm run testnpm run test:coverageCoverage requirements:
- Minimum: 90%
- Critical paths: 100% (auth, RBAC, PHI handling)
-
Unit Tests:
src/modules/*/[module].test.ts- Auth (registration, login, validation)
- Appointments (CRUD, date validation, RBAC)
- Notes (creation, authorization, PHI handling)
-
Integration Tests: Full API endpoint testing
- End-to-end flows
- Error scenarios
- Authorization enforcement
- Data persistence
Run specific test suite:
npm run test -- auth.test.ts
npm run test -- appointments.test.ts-
Protected Health Information (PHI) Masking
- Logs automatically redact: emails, phone numbers, SSNs, credit cards, passwords
- Deep object masking prevents accidental PII leakage
- See logger.ts
-
Input Validation & Sanitization
- Email format validation
- Password strength (8-128 chars)
- Note content length limits (10-10,000 chars)
- Appointment date validation (future only)
- See validation.ts
-
Authentication & Authorization
- JWT tokens with configurable expiration
- Role-based middleware enforcement
- Password hashing with bcrypt (salt rounds: 10)
- See auth.middleware.ts
-
Audit Logging
- All user actions logged with timestamp and user ID
- Sensitive data redacted in logs
- Correlation IDs for request tracing
- See audit.service.ts
- Encrypted at-rest (PostgreSQL SSL)
- Row-level security via Prisma
- Migrations tracked in version control
- Automatic backups (production)
GitHub Actions automates:
-
Lint & Code Quality
- TypeScript strict mode compilation
- ESLint checks
-
Testing (on every PR/push)
- Unit tests with supertest
- Integration tests against test database
- Mandatory 90% coverage threshold
- Coverage reports uploaded to Codecov
-
Security Scanning
- Trivy vulnerability scanning
- npm audit for dependency vulnerabilities
-
Docker Build
- Multi-stage builds for optimized images
- Caching for faster builds
-
Integration Tests
- Full API flow testing
- Database migrations verified
View pipeline status: .github/workflows/ci-cd.yml
Trigger pipeline:
git push origin feature-branch
# or
git merge main- Strict mode enabled
- No implicit
any - Strict null checks
- ESNext target
- Minimum 90% code coverage
- All critical paths: 100% coverage
- Integration tests for all endpoints
- Error scenario validation
- Repository Pattern: Data access layer abstraction
- DTOs: Explicit request/response schemas
- Error Handling: Structured AppError with correlation IDs
- Validation: Centralized validators
git checkout -b feature/your-featurenpm run dev # Start dev server
npm run test # Run tests
npm run test:watch # Watch mode
npm run lint # Lint codegit add .
git commit -m "feat: your feature description"
git push origin feature/your-feature- CI/CD runs automatically
- Must pass all checks (lint, tests, coverage)
- Code review required
- Merge to main for deployment
# Backend
docker build -t mediconnect-backend:latest ./medi-connect-backend
# Frontend
docker build -t mediconnect-frontend:latest ./medi-connect-frontenddocker-compose up -dAccess:
- Frontend:
http://localhost:3000 - Backend API:
http://localhost:5000 - API Docs:
http://localhost:5000/api-docs
# Database
DATABASE_URL=postgresql://user:password@localhost:5432/mediconnect
# JWT
JWT_SECRET=your-secret-key-here
JWT_EXPIRY=3600
# Server
PORT=5000
NODE_ENV=development
# CORS
CORS_ORIGIN=http://localhost:3000NEXT_PUBLIC_API_URL=http://localhost:5000