Skip to content

Dave-code-creater/chiropractor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Chiropractor Practice Management System - Backend API

Dr. Dieu Phan D.C. - Professional Chiropractic Clinic Management System

A comprehensive, production-ready practice management system for chiropractic clinics built with a monolithic architecture for simplified deployment, reliability, and maintainability.

πŸ—οΈ Architecture Overview

Modern monolithic architecture consolidating all clinic management features into a unified, scalable application:

Core Features

  • πŸ” Authentication & Authorization: JWT-based auth with role-based access control (RBAC)
  • πŸ‘₯ Patient Management: Complete patient records, intake forms, medical history tracking
  • πŸ“… Appointment Scheduling: Doctor-patient appointment booking and management with availability checking
  • πŸ“ Clinical Documentation: Medical notes, SOAP notes, and vital signs tracking
  • πŸ’¬ Real-time Chat System: Doctor-patient communication with long-polling support
  • πŸ“° Blog & Content Management: Clinic news, articles, and educational content
  • πŸ“Š Analytics & Reporting: Practice analytics, patient reports, and insights
  • πŸ₯ Health Monitoring: Comprehensive application health checks and monitoring
  • πŸ”” Notifications: Email notifications for appointments and important updates

Security Features

  • Rate limiting and DDoS protection
  • Helmet.js security headers
  • CORS configuration with whitelist support
  • JWT token refresh mechanism
  • Password reset with secure tokens
  • Request validation and sanitization
  • Circuit breaker pattern for external services

πŸ› οΈ Technology Stack

Category Technologies
Runtime Node.js 18+
Framework Express.js 4.21+
Database PostgreSQL 15 with Kysely query builder
Caching Redis 7 (sessions, rate limiting, real-time features)
Authentication JWT with refresh tokens
Validation Joi schema validation
Logging Winston with daily log rotation
API Documentation Swagger/OpenAPI 3.0
Containerization Docker & Docker Compose
Testing Mocha, Chai, Sinon
Code Quality ESLint

πŸš€ Quick Start Guide

Prerequisites

  • Node.js: Version 18 or higher
  • npm: Version 9 or higher
  • Docker Desktop: Latest version (recommended for development)
  • PostgreSQL: Version 15+ (if running without Docker)
  • Redis: Version 7+ (optional, for caching and sessions)

Option 1: Docker Compose (⭐ Recommended)

The fastest way to get started with all services configured:

# 1. Clone the repository
git clone <repository-url>
cd chiropractor

# 2. Create your environment file
cp env.example .env

# 3. Configure your .env file (minimum required)
# Edit the following in .env:
#   - JWT_SECRET (generate with: openssl rand -base64 32)
#   - JWT_REFRESH_SECRET (generate with: openssl rand -base64 32)
#   - DB_PASS (set a secure password)

# 4. Start all services (app + PostgreSQL + Redis)
docker compose up -d

# 5. Check if services are running
docker compose ps

# 6. View application logs
docker compose logs -f app

# 7. Access the application
# API: http://localhost:3000
# Health Check: http://localhost:3000/health
# API Docs: http://localhost:3000/api-docs

Optional: Start with Admin Tools

# Start app with pgAdmin and Redis Commander
docker compose --profile admin up -d

# Access admin tools:
# - pgAdmin: http://localhost:5050 ([email protected] / admin123)
# - Redis Commander: http://localhost:8082

Useful Docker Commands

npm run docker:up        # Start all services
npm run docker:down      # Stop all services
npm run docker:clean     # Clean up everything (remove volumes)
docker compose logs -f   # View all logs in real-time
docker compose restart   # Restart all services

Option 2: Local Development (Without Docker)

For developers who prefer running services locally:

# 1. Install dependencies
npm install

# 2. Setup PostgreSQL locally
# Create database: chiropractor_clinic
# Update .env with your database credentials

# 3. Setup Redis (optional but recommended)
# Install and start Redis on default port 6379

# 4. Configure environment
cp env.example .env
# Edit .env with your local database and Redis settings

# 5. Run database migrations
npm run migrate

# 6. (Optional) Seed initial data
npm run seed

# 7. Start development server with hot-reload
npm run dev

# The API will be available at http://localhost:3000

Initial Setup Tasks

After starting the application for the first time:

# 1. Add the default doctor (Dr. Dieu Phan)
npm run add-doctor

# 2. Test the API is working
curl http://localhost:3000/health

# 3. View API documentation
# Open browser: http://localhost:3000/api-docs

# 4. Create your first user via API
# See API Documentation section below

Environment Configuration

Key environment variables you must configure (see env.example for complete list):

# Security (REQUIRED - Generate unique secrets)
JWT_SECRET=your-super-secure-jwt-secret-key-here-minimum-32-chars
JWT_REFRESH_SECRET=your-super-secure-jwt-refresh-secret-key-here-minimum-32-chars

# Application
NODE_ENV=development
PORT=3000
CORS_ORIGIN=                    # Leave empty for localhost, or set specific origins

# Database
DB_HOST=localhost
DB_PORT=5432
DB_USER=postgres
DB_PASS=your-secure-password    # CHANGE THIS!
DB_NAME=chiropractor_clinic

# Redis (optional)
REDIS_HOST=localhost
REDIS_PORT=6379

# Email (for password reset)
SMTP_HOST=smtp.gmail.com
SMTP_PORT=587
SMTP_USER=[email protected]
SMTP_PASS=your-app-password

πŸ“ Project Structure

chiropractor/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ index.js                      # Application entry point
β”‚   β”œβ”€β”€ config/
β”‚   β”‚   β”œβ”€β”€ index.js                  # Environment configuration
β”‚   β”‚   └── database.js               # PostgreSQL connection with Kysely
β”‚   β”œβ”€β”€ controllers/                  # Business logic controllers
β”‚   β”‚   β”œβ”€β”€ auth.controller.js
β”‚   β”‚   β”œβ”€β”€ appointment.controller.js
β”‚   β”‚   β”œβ”€β”€ patient.controller.js
β”‚   β”‚   β”œβ”€β”€ chat.controller.js
β”‚   β”‚   └── ...
β”‚   β”œβ”€β”€ routes/                       # API route definitions
β”‚   β”‚   β”œβ”€β”€ auth.routes.js
β”‚   β”‚   β”œβ”€β”€ appointment.routes.js
β”‚   β”‚   β”œβ”€β”€ user.routes.js
β”‚   β”‚   └── ...
β”‚   β”œβ”€β”€ middleware/                   # Express middleware
β”‚   β”‚   β”œβ”€β”€ auth.middleware.js        # JWT authentication
β”‚   β”‚   β”œβ”€β”€ validation.middleware.js  # Request validation
β”‚   β”‚   β”œβ”€β”€ error.middleware.js       # Error handling
β”‚   β”‚   └── ...
β”‚   β”œβ”€β”€ repositories/                 # Database access layer
β”‚   β”‚   β”œβ”€β”€ auth.repository.js
β”‚   β”‚   β”œβ”€β”€ patient.repository.js
β”‚   β”‚   └── ...
β”‚   β”œβ”€β”€ services/                     # Business services
β”‚   β”‚   β”œβ”€β”€ auth.service.js
β”‚   β”‚   β”œβ”€β”€ email.service.js
β”‚   β”‚   └── ...
β”‚   β”œβ”€β”€ validators/                   # Joi validation schemas
β”‚   β”‚   β”œβ”€β”€ auth.validator.js
β”‚   β”‚   └── ...
β”‚   └── utils/                        # Utility functions
β”‚       β”œβ”€β”€ logger.js                 # Winston logger
β”‚       β”œβ”€β”€ errorHandler.js
β”‚       └── ...
β”œβ”€β”€ migrations/                       # Database migration files
β”‚   β”œβ”€β”€ 001_initial_schema.sql
β”‚   └── ...
β”œβ”€β”€ scripts/                          # Utility scripts
β”‚   β”œβ”€β”€ migrate.js                    # Run migrations
β”‚   β”œβ”€β”€ seed.js                       # Seed data
β”‚   └── add-doctor-dieu-phan.js      # Add default doctor
β”œβ”€β”€ test/                             # Test files
β”‚   β”œβ”€β”€ unit/
β”‚   β”œβ”€β”€ integration/
β”‚   └── e2e/
β”œβ”€β”€ logs/                             # Application logs (auto-generated)
β”œβ”€β”€ docker-compose.yml                # Docker services configuration
β”œβ”€β”€ Dockerfile                        # Application container
β”œβ”€β”€ package.json                      # Dependencies and scripts
β”œβ”€β”€ env.example                       # Environment variables template
└── openapi.json                      # API documentation

πŸ”Œ API Endpoints

Base URL: http://localhost:3000/api/v1/2025

API Documentation: http://localhost:3000/api-docs

Authentication & Authorization

Method Endpoint Description Auth Required
POST /auth/register Register new user (patient/doctor/admin) ❌
POST /auth/login User login with credentials ❌
POST /auth/logout User logout and invalidate token βœ…
POST /auth/refresh Refresh JWT access token βœ…
POST /auth/verify Verify JWT token validity βœ…
POST /auth/forgot-password Request password reset email ❌
GET /auth/verify-reset-token Verify password reset token ❌
POST /auth/reset-password Reset password with token ❌

User & Patient Management

Method Endpoint Description Auth Required
GET /users/profile Get current user profile βœ…
PUT /users/profile Update current user profile βœ…
GET /users/patients Get all patients (paginated) βœ… Admin
POST /users/patients Create new patient record βœ… Admin
GET /users/patients/:id Get patient by ID βœ…
PUT /users/patients/:id Update patient information βœ… Admin
DELETE /users/patients/:id Soft delete patient βœ… Admin
GET /users/doctors Get all doctors βœ…

Appointment Management

Method Endpoint Description Auth Required
GET /appointments Get appointments (filtered by user role) βœ…
POST /appointments Create new appointment βœ…
GET /appointments/:id Get appointment details βœ…
PUT /appointments/:id Update appointment βœ…
DELETE /appointments/:id Cancel appointment βœ…
GET /appointments/doctors Get available doctors with schedules βœ…
GET /appointments/availability/:doctorId Check doctor availability βœ…

Chat & Messaging

Method Endpoint Description Auth Required
GET /conversations Get user's conversations βœ…
POST /conversations Create new conversation βœ…
POST /conversations/doctor-patient Create doctor-patient chat βœ…
GET /conversations/:id Get conversation details βœ…
GET /conversations/:id/messages Get conversation messages βœ…
POST /messages Send new message βœ…
PUT /messages/:id Edit message βœ…
DELETE /messages/:id Delete message βœ…
POST /messages/:id/read Mark message as read βœ…

Blog & Content Management

Method Endpoint Description Auth Required
GET /blog/posts Get all blog posts (published) ❌
POST /blog/posts Create new blog post βœ… Admin
GET /blog/posts/:id Get post by ID ❌
PUT /blog/posts/:id Update blog post βœ… Admin
DELETE /blog/posts/:id Delete blog post βœ… Admin
POST /blog/posts/:id/publish Publish draft post βœ… Admin

Reports & Analytics

Method Endpoint Description Auth Required
GET /reports Get all reports βœ… Admin
POST /reports Generate new report βœ… Admin
GET /reports/:id Get report by ID βœ… Admin
PUT /reports/:id Update report βœ… Admin
DELETE /reports/:id Delete report βœ… Admin
GET /reports/patient/:patientId Get patient-specific reports βœ…

Health & Monitoring

Method Endpoint Description Auth Required
GET /health Application health check ❌
GET /health/detailed Detailed system health βœ… Admin

Legacy Endpoints (Backward Compatibility)

Method Endpoint Description
POST /auth/* Legacy authentication endpoints

Note: All authenticated endpoints require Authorization: Bearer <token> header.

πŸ—„οΈ Database Schema

PostgreSQL Tables

The application uses a comprehensive PostgreSQL schema designed for chiropractic practice management:

Core User Tables

  • users - User accounts, authentication, and role management
  • doctors - Doctor profiles, specializations, and schedules
  • patients - Patient personal information and demographics

Appointment System

  • appointments - Appointment scheduling and management
  • appointment_types - Types of appointments offered

Clinical Documentation

  • clinical_notes - Medical documentation and SOAP notes
  • vitals - Patient vital signs history
  • health_conditions - Medical history and conditions
  • pain_descriptions - Pain assessment and tracking

Patient Intake & Forms

  • patient_intake_responses - Completed intake forms
  • insurance_details - Patient insurance information
  • emergency_contacts - Emergency contact information

Communication & Content

  • conversations - Chat conversations between users
  • messages - Individual chat messages
  • posts - Blog posts and clinic news

Administrative

  • reports - Analytics and generated reports
  • api_keys - JWT token management and tracking
  • password_resets - Password reset token management

Database Features

  • Full ACID Compliance: Guaranteed data consistency
  • Referential Integrity: Foreign key constraints
  • Indexing Strategy: Optimized for common queries
  • Soft Deletes: Safe deletion with recovery capability
  • Timestamps: Automatic created_at and updated_at tracking
  • Connection Pooling: Efficient resource management

Running Migrations

# Run all pending migrations
npm run migrate

# Check migration status
npm run migrate:status

# Rollback last migration
npm run migrate:rollback

πŸ”§ Development

Available NPM Scripts

# Development
npm run dev              # Start development server with nodemon (hot-reload)
npm start                # Start production server

# Database
npm run migrate          # Run database migrations
npm run seed             # Seed initial/sample data
npm run add-doctor       # Add Dr. Dieu Phan to database

# Code Quality
npm run lint             # Run ESLint checks
npm run lint:fix         # Auto-fix ESLint issues

# Testing
npm test                 # Run test suite
npm run test:coverage    # Run tests with coverage report

# Docker
npm run docker:build     # Build Docker image
npm run docker:up        # Start all Docker services
npm run docker:down      # Stop all Docker services
npm run docker:clean     # Clean up containers and volumes

Docker Compose Profiles

# Basic setup (app + database + redis)
docker compose up -d

# With admin tools (pgAdmin + Redis Commander)
docker compose --profile admin up -d

# With testing
docker compose --profile test up --build

# View logs
docker compose logs -f                    # All services
docker compose logs -f app                # App only
docker compose logs -f postgres           # Database only

# Service management
docker compose restart app                # Restart specific service
docker compose exec app sh               # Access app container shell
docker compose exec postgres psql -U postgres -d chiropractor_clinic

Admin Tools (with --profile admin)

pgAdmin - PostgreSQL Administration

  • URL: http://localhost:5050
  • Email: [email protected]
  • Password: admin123
  • Pre-configured with clinic database connection

Redis Commander - Redis Cache Management

  • URL: http://localhost:8082
  • View and manage Redis keys, sessions, and cache

Development Workflow

  1. Make code changes in src/ directory
  2. Nodemon auto-reloads the application
  3. Check logs for errors: docker compose logs -f app
  4. Test API endpoints using the Swagger UI at /api-docs
  5. Run tests before committing: npm test
  6. Lint code: npm run lint:fix

Debugging

# View application logs
docker compose logs -f app

# Check application health
curl http://localhost:3000/health

# Access database directly
docker compose exec postgres psql -U postgres -d chiropractor_clinic

# Check Redis cache
docker compose exec redis redis-cli

# View environment variables
docker compose exec app env | grep -E "DB_|REDIS_|JWT_"

Adding New Features

  1. Create route in src/routes/
  2. Add controller in src/controllers/
  3. Create repository in src/repositories/ for database operations
  4. Add validation in src/validators/
  5. Write tests in test/
  6. Update API documentation in OpenAPI spec
  7. Add migrations if database changes needed

🌍 Environment Variables

Key environment variables (see .env.monolith.example for complete list):

# Application
NODE_ENV=development
PORT=3000
# Leave blank to allow default localhost/127.0.0.1 dev origins
# Provide a comma-separated list (or `*` in trusted dev setups) for custom origins
CORS_ORIGIN=

# Database
DB_HOST=localhost
DB_PORT=5432
DB_USER=postgres
DB_PASS=password
DB_NAME=chiropractor_monolith
MONGO_URI=mongodb://localhost:27017/chiropractor_monolith

# Security
JWT_SECRET=your-super-secure-jwt-secret-key-here
BCRYPT_ROUNDS=12

# Rate Limiting
RATE_LIMIT_WINDOW_MS=900000
RATE_LIMIT_MAX_REQUESTS=1000

πŸ₯ Migration from Microservices

This monolithic version consolidates previously separate microservices into a unified application for improved development experience and simplified deployment.

Service Consolidation Map

Original Microservice Current Location Endpoints Description
Gateway Service src/index.js All routes Unified routing and middleware
Auth Service src/routes/auth.routes.js /auth/* JWT authentication & authorization
User Service src/routes/user.routes.js /users/* Patient & user management
Appointment Service src/routes/appointment.routes.js /appointments/* Scheduling & appointments
Blog Service src/routes/blog.routes.js /blog/* Content management
Chat Service src/routes/chat.routes.js /conversations/*, /messages/* Messaging system
Report Service src/routes/report.routes.js /reports/* Analytics & reporting

Architectural Benefits

Advantages of Monolithic Architecture:

  • βœ… Simplified Deployment: Single application to deploy and manage
  • βœ… Easier Development: All code in one place, faster local setup
  • βœ… Reduced Latency: No network calls between services
  • βœ… Simpler Transactions: Database transactions across all features
  • βœ… Unified Logging: Single log stream for easier debugging
  • βœ… Lower Infrastructure Costs: Fewer containers to run
  • βœ… Easier Testing: Test entire flow without service mocking

Trade-offs to Consider:

  • ⚠️ Scaling Limitations: Must scale entire application
  • ⚠️ Technology Coupling: Single tech stack for all features
  • ⚠️ Larger Deployments: Entire app redeploys for small changes
  • ⚠️ Team Coordination: Shared codebase requires coordination

Migration Timeline

The system has been successfully consolidated from:

  • 7 separate microservices β†’ 1 unified application
  • Multiple databases β†’ Single PostgreSQL database
  • Complex service mesh β†’ Simple API structure
  • Distributed logging β†’ Centralized logging

Future Scalability Path

If the application grows and requires microservices again, the modular structure makes it easy to extract services:

  1. Extract by Domain: Each route/controller is already domain-separated
  2. Database Separation: Each feature's tables can be moved to separate databases
  3. API Contracts: OpenAPI documentation provides clear service boundaries
  4. Independent Deployment: Routes can become separate services with minimal refactoring

πŸ§ͺ Testing

Running Tests

# Run all tests
npm test

# Run tests with coverage
npm run test:coverage

# Run specific test file
npm test -- test/auth.test.js

# Run tests in watch mode
npm test -- --watch

# Run tests with detailed output
npm test -- --reporter spec

Test Structure

test/
β”œβ”€β”€ unit/                    # Unit tests for individual functions
β”‚   β”œβ”€β”€ controllers/
β”‚   β”œβ”€β”€ services/
β”‚   └── utils/
β”œβ”€β”€ integration/             # API endpoint tests
β”‚   β”œβ”€β”€ auth.test.js
β”‚   β”œβ”€β”€ appointments.test.js
β”‚   └── patients.test.js
└── e2e/                     # End-to-end workflow tests
    └── patient-journey.test.js

Writing Tests

The project uses Mocha, Chai, and Sinon for testing:

const { expect } = require('chai');
const request = require('supertest');
const app = require('../src/index');

describe('Authentication', () => {
  it('should register a new user', async () => {
    const res = await request(app)
      .post('/api/v1/2025/auth/register')
      .send({
        email: '[email protected]',
        password: 'SecurePass123!',
        role: 'patient'
      });
    
    expect(res.status).to.equal(201);
    expect(res.body).to.have.property('token');
  });
});

πŸ“Š Monitoring & Logging

Application Monitoring

The application includes comprehensive health monitoring:

# Basic health check
GET /health

# Detailed system health (requires admin auth)
GET /health/detailed

Health check includes:

  • Application Status: Uptime, version
  • Database Connectivity: PostgreSQL connection status
  • Cache Status: Redis connection (if configured)
  • Memory Usage: System and process memory
  • Response Times: Average API response times

Logging System

Winston-based logging with daily rotation:

logs/
β”œβ”€β”€ app-YYYY-MM-DD.log         # General application logs
β”œβ”€β”€ api-YYYY-MM-DD.log         # API request/response logs
β”œβ”€β”€ auth-YYYY-MM-DD.log        # Authentication events
β”œβ”€β”€ chat-YYYY-MM-DD.log        # Chat system logs
β”œβ”€β”€ database-YYYY-MM-DD.log    # Database queries and errors
β”œβ”€β”€ error-YYYY-MM-DD.log       # Error logs
β”œβ”€β”€ exceptions-YYYY-MM-DD.log  # Uncaught exceptions
└── rejections-YYYY-MM-DD.log  # Unhandled promise rejections

Log Levels:

  • error: Critical errors requiring attention
  • warn: Warning messages
  • info: General information (default)
  • http: HTTP request logs
  • debug: Detailed debugging information

Configuration (in .env):

LOG_LEVEL=info              # Set logging verbosity
LOG_MAX_FILE_SIZE=20m       # Maximum log file size
LOG_MAX_FILES=30d           # Keep logs for 30 days

Monitoring Best Practices

  1. Check logs regularly:

    tail -f logs/app-$(date +%Y-%m-%d).log
  2. Monitor error logs:

    tail -f logs/error-$(date +%Y-%m-%d).log
  3. Set up alerts for critical errors

  4. Review health endpoint periodically

  5. Monitor Docker containers:

    docker stats

πŸš€ Deployment

Production Deployment Checklist

Before deploying to production:

  • Set NODE_ENV=production in environment
  • Generate secure JWT secrets (32+ characters)
  • Configure production database with SSL
  • Set up Redis for production
  • Configure CORS for your domain
  • Set up SMTP for email notifications
  • Enable rate limiting
  • Configure reverse proxy (nginx/Apache)
  • Set up SSL/TLS certificates
  • Configure log rotation
  • Set up monitoring and alerts
  • Review and harden security settings

Docker Production Deployment

# 1. Build optimized production image
docker build -t chiropractor-clinic:latest .

# 2. Create production environment file
cat > .env.production << EOF
NODE_ENV=production
PORT=3000
CORS_ORIGIN=https://your-domain.com
DB_HOST=your-db-host
DB_PASS=secure-password
DATABASE_SSL=true
JWT_SECRET=your-secure-jwt-secret
# ... other production settings
EOF

# 3. Run production container
docker run -d \
  --name chiropractor-clinic \
  -p 3000:3000 \
  --env-file .env.production \
  --restart unless-stopped \
  chiropractor-clinic:latest

# 4. Verify deployment
curl https://your-domain.com/health

Docker Compose Production

# Use production compose file
docker compose -f docker-compose.prod.yml up -d

# Scale application instances
docker compose up -d --scale app=3

# Update to new version (zero-downtime)
docker compose pull
docker compose up -d --no-deps --build app

Environment Variables for Production

# Application
NODE_ENV=production
PORT=3000
CORS_ORIGIN=https://your-domain.com
LOG_LEVEL=warn

# Database (use managed services in production)
DB_HOST=your-rds-endpoint.amazonaws.com
DB_PORT=5432
DB_NAME=chiropractor_clinic
DB_USER=chiropractor_user
DB_PASS=your-secure-password
DATABASE_SSL=true
DATABASE_POOL_MIN=5
DATABASE_POOL_MAX=20

# Redis (use managed service)
REDIS_HOST=your-elasticache-endpoint.amazonaws.com
REDIS_PORT=6379

# Security
JWT_SECRET=your-production-jwt-secret-min-32-chars
JWT_REFRESH_SECRET=your-production-refresh-secret-min-32-chars
BCRYPT_ROUNDS=12
TRUST_PROXY=true
TRUST_PROXY_HOPS=1

# Rate Limiting
RATE_LIMIT_WINDOW_MS=900000
RATE_LIMIT_MAX_REQUESTS=100

# Email
SMTP_HOST=smtp.gmail.com
SMTP_PORT=587
SMTP_USER=[email protected]
SMTP_PASS=your-app-password

Cloud Platform Deployments

AWS Elastic Beanstalk

# Initialize EB
eb init -p docker chiropractor-clinic

# Create environment
eb create chiropractor-prod --database.engine postgres

# Deploy
eb deploy

Heroku

# Create app
heroku create chiropractor-clinic

# Add PostgreSQL
heroku addons:create heroku-postgresql:standard-0

# Add Redis
heroku addons:create heroku-redis:premium-0

# Set environment variables
heroku config:set NODE_ENV=production
heroku config:set JWT_SECRET=your-secret

# Deploy
git push heroku main

DigitalOcean App Platform

# Use doctl CLI or web interface
doctl apps create --spec .do/app.yaml

Reverse Proxy Setup (Nginx)

upstream chiropractor_api {
    least_conn;
    server localhost:3000;
    server localhost:3001;
    server localhost:3002;
}

server {
    listen 80;
    listen [::]:80;
    server_name api.drdieuphanchiropractor.com;
    
    # Redirect to HTTPS
    return 301 https://$server_name$request_uri;
}

server {
    listen 443 ssl http2;
    listen [::]:443 ssl http2;
    server_name api.drdieuphanchiropractor.com;

    # SSL certificates
    ssl_certificate /etc/letsencrypt/live/domain/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/domain/privkey.pem;

    # Security headers
    add_header Strict-Transport-Security "max-age=31536000" always;
    add_header X-Frame-Options "SAMEORIGIN" always;
    add_header X-Content-Type-Options "nosniff" always;

    location / {
        proxy_pass http://chiropractor_api;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_cache_bypass $http_upgrade;
        
        # Timeouts
        proxy_connect_timeout 60s;
        proxy_send_timeout 60s;
        proxy_read_timeout 60s;
    }
}

Monitoring in Production

Set up monitoring for:

  • Application Health: /health endpoint checks
  • Error Tracking: Sentry, Rollbar, or similar
  • Performance Monitoring: New Relic, DataDog
  • Log Aggregation: ELK Stack, CloudWatch, Papertrail
  • Uptime Monitoring: UptimeRobot, Pingdom

Backup Strategy

# Automated PostgreSQL backups
# Schedule with cron: 0 2 * * * (daily at 2 AM)
docker compose exec postgres pg_dump -U postgres chiropractor_clinic > backup-$(date +%Y%m%d).sql

# Restore from backup
docker compose exec -T postgres psql -U postgres chiropractor_clinic < backup-20241002.sql

🀝 Contributing

We welcome contributions to improve the Chiropractor Practice Management System!

How to Contribute

  1. Fork the repository

    gh repo fork Dave-code-creater/chiropractor_fe
  2. Create a feature branch

    git checkout -b feature/amazing-feature
  3. Make your changes

    • Follow the existing code style
    • Add tests for new features
    • Update documentation as needed
  4. Run tests and linting

    npm run lint:fix
    npm test
  5. Commit your changes

    git commit -m "feat: add amazing feature"

    Use conventional commit messages:

    • feat: New feature
    • fix: Bug fix
    • docs: Documentation changes
    • refactor: Code refactoring
    • test: Test additions/changes
    • chore: Maintenance tasks
  6. Push to your fork

    git push origin feature/amazing-feature
  7. Open a Pull Request

    • Provide a clear description of changes
    • Reference any related issues
    • Ensure all CI checks pass

Development Guidelines

  • Code Style: Follow ESLint configuration
  • Testing: Maintain or improve test coverage
  • Documentation: Update README and code comments
  • Security: Never commit sensitive data or credentials
  • Database Changes: Always provide migration scripts

Reporting Issues

Found a bug or have a feature request?

  1. Check existing issues to avoid duplicates
  2. Create a new issue with:
    • Clear title and description
    • Steps to reproduce (for bugs)
    • Expected vs actual behavior
    • Environment details (OS, Node version, etc.)
    • Relevant logs or screenshots

Code Review Process

All contributions go through code review:

  • Automated tests must pass
  • Code follows project standards
  • Changes are well-documented
  • No security vulnerabilities introduced

πŸ“„ License

This project is licensed under the MIT License.

MIT License

Copyright (c) 2025 Dr. Dieu Phan D.C.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

See the LICENSE file for full details.

πŸ“ž Support & Contact

Getting Help

Commercial Support

For enterprise support, custom development, or consultation:

Community

  • Contributors: Thanks to all who have contributed to this project!
  • Star the repo ⭐ if you find it useful
  • Share feedback to help us improve

πŸ”„ Project Status

Current Version: 1.0.0

Status: βœ… Production Ready

Implemented Features

  • βœ… Complete authentication system with JWT
  • βœ… Patient management and records
  • βœ… Appointment scheduling
  • βœ… Doctor profiles and availability
  • βœ… Real-time chat system
  • βœ… Blog and content management
  • βœ… Reports and analytics
  • βœ… Health monitoring
  • βœ… Comprehensive logging
  • βœ… API documentation (OpenAPI/Swagger)
  • βœ… Docker deployment
  • βœ… Database migrations
  • βœ… Rate limiting and security

Upcoming Features

  • πŸ”„ Enhanced reporting dashboards
  • πŸ”„ Advanced analytics
  • πŸ”„ Mobile app integration improvements
  • πŸ”„ Automated appointment reminders
  • πŸ”„ Insurance claim management
  • πŸ”„ Telehealth video consultations
  • πŸ”„ Electronic signature support
  • πŸ”„ Multi-language support

Roadmap

Q4 2024

  • Payment processing integration
  • Advanced search capabilities
  • Performance optimizations

Q1 2025

  • Mobile app enhancements
  • AI-powered appointment scheduling
  • Enhanced reporting tools

Q2 2025

  • HIPAA compliance certification
  • Multi-clinic support
  • Advanced security features

Built with ❀️ for Dr. Dieu Phan D.C. Chiropractic Clinic

Made by Dave Code Creater

Report Bug Β· Request Feature Β· Documentation

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published