Skip to content

refactor: Modernize environment management and backend architecture#3

Merged
eesanoble merged 9 commits intomainfrom
feat/fix-local-dev
Jul 10, 2025
Merged

refactor: Modernize environment management and backend architecture#3
eesanoble merged 9 commits intomainfrom
feat/fix-local-dev

Conversation

@eesanoble
Copy link
Collaborator

Environment & Configuration:

  • Unified env management with .env.example template and consolidated .gitignore
  • Added dev-local.sh, dev-hybrid.sh, dev-backend.sh for clear dev workflows
  • Updated package.json scripts and removed obsolete shell scripts

Frontend Improvements:

  • Enhanced API URL detection for seamless local/prod switching
  • Improved error handling and fallback configuration

Backend Architecture Refactor:

  • Refactored agents.py with DRY principles and best practices
  • Added ProductionDetector, LLMClientFactory, JSONResponseParser classes
  • Eliminated code duplication in agent initialization
  • Fixed all lint errors: removed unused imports/variables, unnecessary f-strings
  • Enhanced type hints and comprehensive docstrings
  • Centralized LLM client creation with environment-aware Helicone integration

Production Requirements:

  • Helicone monitoring REQUIRED in production, optional in development
  • Robust environment detection via VERCEL/NODE_ENV/ENVIRONMENT variables

All changes tested and verified working across local/hybrid/production modes.

Environment & Configuration:
- Unified env management with .env.example template and consolidated .gitignore
- Added dev-local.sh, dev-hybrid.sh, dev-backend.sh for clear dev workflows
- Updated package.json scripts and removed obsolete shell scripts

Frontend Improvements:
- Enhanced API URL detection for seamless local/prod switching
- Improved error handling and fallback configuration

Backend Architecture Refactor:
- Refactored agents.py with DRY principles and best practices
- Added ProductionDetector, LLMClientFactory, JSONResponseParser classes
- Eliminated code duplication in agent initialization
- Fixed all lint errors: removed unused imports/variables, unnecessary f-strings
- Enhanced type hints and comprehensive docstrings
- Centralized LLM client creation with environment-aware Helicone integration

Production Requirements:
- Helicone monitoring REQUIRED in production, optional in development
- Robust environment detection via VERCEL/NODE_ENV/ENVIRONMENT variables

All changes tested and verified working across local/hybrid/production modes.
- Added detailed logging throughout agents.py initialization
- Added environment detection and API key status logging
- Added error handling with detailed error messages in main.py
- Added try/catch blocks around GameOrchestrator creation
- Logs show exactly when/where agent initialization fails
- Will help identify root cause of Vercel 500 errors
@eesanoble eesanoble force-pushed the feat/fix-local-dev branch from 47b610e to 5a38987 Compare July 10, 2025 17:40
@eesanoble eesanoble merged commit d00865a into main Jul 10, 2025
2 checks passed
@eesanoble eesanoble deleted the feat/fix-local-dev branch July 10, 2025 17:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant