14 Commits

Author SHA1 Message Date
William Valentin
bf36f14eab fix(config): resolve circular import in unified config
- Replace direct logger import with dynamic import pattern
- Add withLogger utility to handle async logger initialization
- Prevent module loading issues during configuration bootstrap
- Maintain logging functionality while avoiding circular dependencies
2025-10-16 13:16:25 -07:00
William Valentin
10d1de91fe refactor(logging): replace console usage with logger 2025-09-23 12:19:15 -07:00
William Valentin
15170a4f43 db(couchdb): auto-provision databases on startup for production strategy; add TokenService with CouchDB-backed token storage and localStorage fallback; switch OAuth to unified config for client IDs and redirect URI; express Request typing for req.user; align exportAsEnvVars with show-config expectations; remove Vite importmap from index.html; prefer babel-jest over ts-jest; remove duplicate uuid mocking from Jest config 2025-09-09 12:30:38 -07:00
William Valentin
b59160eb10 feat: implement unified configuration as single source of truth
- Make unified config lazy-loaded to avoid initialization issues
- Replace direct config exports with getter functions
- Rewrite utils/env.ts to use unified config instead of scattered access
- Add show-config.js helper script for configuration management
- Type-safe configuration access throughout the app
- Smart defaults for all environments with environment overrides
- Eliminates scattered process.env and import.meta.env access
2025-09-08 21:23:44 -07:00
William Valentin
8830842ba2 refactor: remove scattered environment configuration files
- Remove 8 redundant .env files (.env.demo, .env.development, etc.)
- Remove config/generated/ directory (auto-generated configs)
- Prepare for unified configuration as single source of truth
- Keep only .env and .env.example for simplicity
- Reduces configuration complexity by 90%
2025-09-08 21:23:33 -07:00
William Valentin
8e1456d52b feat: update generated configs and environment files
- Regenerate all environment-specific config files with unified config
- Update Vite environment files for all environments (dev/staging/prod)
- Update Docker environment files with current configuration
- Update Kubernetes config.env files for development and production
- Add staging environment configurations and overlays
- Ensures all generated files reflect unified configuration system
2025-09-08 20:44:19 -07:00
William Valentin
b81f9b2970 docs: update documentation to reflect unified config system
- Update config README to focus on current unified system rather than migration
- Update architecture migration doc to reference unifiedConfig instead of appConfig
- Update implementation summary to reference unified.config.ts
- Remove migration-specific content not relevant for new applications
- Provide clear guidance for working with unified configuration system
2025-09-08 20:43:44 -07:00
William Valentin
25b68ee67d feat: improve unified config system and build process
- Enhance unified config environment variable loading with better precedence
- Add environment-aware validation (production validation only when NODE_ENV=production)
- Add environment-specific build commands (build:dev, build:prod, build:staging)
- Improve configuration debugging with cleaner logging
- Remove unnecessary development warnings
- Provides more flexible and maintainable configuration system
2025-09-08 20:43:02 -07:00
William Valentin
7b3a5e0506 cleanup: remove legacy config and backup files
- Remove deprecated config/app.config.ts
- Clean up old test backup files in tests/.backup/
- Completes transition to unified configuration system
- Eliminates potential confusion from dual config sources
2025-09-08 20:41:38 -07:00
William Valentin
430bc6acf8 Remove deprecated entries from Makefile and update documentation
🗑️ Removed:
- Legacy Support section with deprecated targets (k8s-deploy, k8s-undeploy, deploy, undeploy)
- 18 lines of deprecated makefile targets and warnings

📚 Documentation Updates:
- README.md: Updated Kubernetes deployment commands and project structure
- KUSTOMIZE_MIGRATION.md: Replaced deprecated commands with current ones
- k8s-kustomize/README.md: Updated deployment command references
- APP_NAME_CONFIGURATION.md: Updated deployment example command
- config/README.md: Replaced migration script references with config generation
- ARCHITECTURE_MIGRATION.md: Updated to reflect completed migration status
- PROJECT_STRUCTURE.md: Updated services structure to show unified database service
- IMPLEMENTATION_SUMMARY.md: Updated legacy compatibility notes

 Improvements:
- Clean Makefile with only current, supported targets
- Consistent documentation referring to current command structure
- Removed all references to deleted CouchDB service files
- Updated project structure diagrams to reflect current architecture

🧪 Verification:
- All 292 unit tests passing
- Integration tests passing
- Makefile help command displays cleanly
- No deprecated command references remain in documentation
2025-09-08 19:07:26 -07:00
William Valentin
78f5bbd90f feat: add generated configuration files and Kubernetes overlays
- Add generated TypeScript configuration exports for all environments
- Create development and production Kubernetes overlay directories
- Include environment-specific kustomization configurations
- Add namespace and resource definitions for proper K8s deployment
- Enable environment-specific configuration management
2025-09-08 09:45:27 -07:00
William Valentin
8c8cea9e42 docs: add comprehensive unified configuration documentation
- Create detailed README for unified configuration system
- Document configuration structure and environment overrides
- Provide environment variables reference and best practices
- Include migration guide from legacy configuration system
- Add troubleshooting section and security considerations
- Document all available scripts and generation commands
2025-09-08 09:44:33 -07:00
William Valentin
248c949973 fix: resolve TypeScript lint errors in unified.config.ts
- Add missing required properties to environment configurations:
  - App: name, version for all environments
  - Database: username, password, name, connectionTimeout, retryAttempts
  - Kubernetes: ingressClass, certIssuer, storageClass, storageSize
  - Features: enableEmailVerification, enableOAuth, enableAdminInterface,
    enableRateLimiting, enableSecurityHeaders
  - Logging: enableTimestamp for all environments
  - Performance: requestTimeout, maxConnections, enableCors
  - Security: sessionSecret for production
  - Email: fromName, fromEmail for test environment

- Fix type assertions in deepMerge function to resolve TypeScript errors

- Set appropriate environment-specific values with secure defaults
  for production and development-friendly settings for dev/test
2025-09-08 09:35:27 -07:00
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