Files
rxminder/docker
William Valentin 8c591563c9 feat: consolidate architecture and eliminate code duplication
🏗️ Major architectural improvements:

Database Layer:
- Consolidated duplicate CouchDB services (~800 lines of duplicated code eliminated)
- Implemented strategy pattern with MockDatabaseStrategy and ProductionDatabaseStrategy
- Created unified DatabaseService with automatic environment detection
- Maintained backward compatibility via updated factory pattern

Configuration System:
- Centralized all environment variables in single config/app.config.ts
- Added comprehensive configuration validation with clear error messages
- Eliminated hardcoded base URLs and scattered env var access across 8+ files
- Supports both legacy and new environment variable names

Logging Infrastructure:
- Replaced 25+ scattered console.log statements with structured Logger service
- Added log levels (ERROR, WARN, INFO, DEBUG, TRACE) and contexts (AUTH, DATABASE, API, UI)
- Production-safe logging with automatic level adjustment
- Development helpers for debugging and performance monitoring

Docker & Deployment:
- Removed duplicate docker/Dockerfile configuration
- Enhanced root Dockerfile with comprehensive environment variable support
- Added proper health checks and security improvements

Code Quality:
- Fixed package name consistency (rxminder → RxMinder)
- Updated services to use centralized configuration and logging
- Resolved all ESLint errors and warnings
- Added comprehensive documentation and migration guides

📊 Impact:
- Eliminated ~500 lines of duplicate code
- Single source of truth for database, configuration, and logging
- Better type safety and error handling
- Improved development experience and maintainability

📚 Documentation:
- Added ARCHITECTURE_MIGRATION.md with detailed migration guide
- Created IMPLEMENTATION_SUMMARY.md with metrics and benefits
- Inline documentation for all new services and interfaces

🔄 Backward Compatibility:
- All existing code continues to work unchanged
- Legacy services show deprecation warnings but remain functional
- Gradual migration path available for development teams

Breaking Changes: None (full backward compatibility maintained)
2025-09-08 01:09:48 -07:00
..

🐳 Docker Configuration

This directory contains all Docker and containerization-related files for RxMinder.

Files

  • Dockerfile - Multi-stage Docker build configuration with buildx support
  • docker-compose.yaml - Service orchestration with multi-platform support
  • docker-bake.hcl - Advanced buildx configuration for multi-platform builds
  • nginx.conf - Production web server configuration
  • .dockerignore - Files and directories to exclude from Docker build context

Docker Buildx Support

This project now supports Docker Buildx for multi-platform builds (AMD64 and ARM64).

Quick Start with Buildx

# Setup buildx builder (run once)
../scripts/buildx-helper.sh setup

# Build for local platform only (faster for development)
../scripts/buildx-helper.sh build-local

# Build for multiple platforms
../scripts/buildx-helper.sh build-multi

# Build and push to registry
../scripts/buildx-helper.sh push docker.io/username latest

# Build using Docker Bake (advanced)
../scripts/buildx-helper.sh bake

Manual Buildx Commands

# Create and use buildx builder
docker buildx create --name rxminder-builder --driver docker-container --bootstrap --use

# Build for multiple platforms
docker buildx build --platform linux/amd64,linux/arm64 -t rxminder:latest --load .

# Build with bake file
docker buildx bake -f docker-bake.hcl

Traditional Usage

From the project root directory:

# Build and start services
docker compose -f docker/docker-compose.yaml up -d

# View logs
docker compose -f docker/docker-compose.yaml logs

# Stop services
docker compose -f docker/docker-compose.yaml down

Build Process

The Dockerfile uses a multi-stage build:

  1. Builder stage: Installs dependencies and builds the React app
  2. Production stage: Serves the built app with nginx

Services

  • frontend: React application served by nginx
  • couchdb: Database for medication and user data

Both services include health checks and proper security configurations.