Skip to content

Darminha detonando na ia - #1

Merged
pedrodarma merged 6 commits into
mainfrom
darminha-detonando-na-ia
Nov 21, 2025
Merged

pedrodarma merged 6 commits into
mainfrom
darminha-detonando-na-ia

Conversation

@LeandroParisi

Copy link
Copy Markdown
Collaborator

Summary

This PR introduces centralized configuration management and comprehensive documentation for the Games API.

Changes

✨ New Features

  • Centralized Configuration System: Created AppConfig with environment variable validation
    • Validates required variables (MONGODB, BROKER_URL) at startup
    • Provides type-safe access to all configuration values
    • Includes helper functions for environment checks (isProduction(), isDevelopment(), isTest())

📝 Documentation

  • Comprehensive README: Added detailed documentation covering:

    • Project overview and features
    • API endpoints with examples
    • WebSocket integration details
    • Installation and configuration guides
    • Docker setup instructions
    • Project structure
  • Environment Template: Created env.example with all required and optional variables

🔧 Refactoring

  • Replaced all process.env usage with AppConfig throughout the codebase:

    • index.ts: Uses AppConfig.server.port
    • mongodb.ts: Uses AppConfig.database.mongodb.uri
    • websocket.ts: Uses AppConfig.websocket.brokerUrl
  • TypeScript Configuration: Added @config path alias for easier imports

Benefits

  • Better Developer Experience: Type-safe configuration with autocomplete
  • Early Error Detection: Missing required env vars are caught at startup
  • Improved Maintainability: Single source of truth for configuration
  • Better Documentation: Comprehensive README for onboarding

Breaking Changes

⚠️ None - This is a refactoring that maintains backward compatibility. However, ensure your .env file includes the required variables (MONGODB and BROKER_URL).

Testing

  • Configuration validation tested with missing required variables
  • All existing functionality verified with new configuration system
  • TypeScript compilation successful

…or improved module resolution and path configuration.
…e README.md with detailed project documentation
…tion and export functions for environment checks
…eplacing direct environment variable access in index.ts, mongodb.ts, and websocket.ts.

@pedrodarma pedrodarma left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

=]

@pedrodarma
pedrodarma merged commit b0ed282 into main Nov 21, 2025
2 checks passed
@pedrodarma
pedrodarma deleted the darminha-detonando-na-ia branch November 21, 2025 15:44
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.

2 participants