Skip to content

Core#1

Merged
Jenish-1235 merged 21 commits intodevfrom
core
Dec 17, 2025
Merged

Core#1
Jenish-1235 merged 21 commits intodevfrom
core

Conversation

@Jenish-1235
Copy link
Copy Markdown
Contributor

This pull request introduces significant improvements to configuration management, infrastructure documentation, and application health monitoring for the NeroSpatial Backend. It adds a robust .env.example template, expands configuration loading logic, introduces a centralized application state container, and implements comprehensive health check endpoints for production readiness. Additionally, it refactors and organizes shared utilities and improves the project documentation for local development and deployment.

Configuration and Environment Management

  • Added a detailed .env.example template with all necessary configuration variables for local development and production bootstrap, including Azure, PostgreSQL, Redis, JWT, and telemetry settings.
  • Refactored the Settings class in config.py to support hierarchical configuration loading from Azure App Configuration, Azure Key Vault, and .env files, with new fields and validation logic for environment and connection URLs. [1] [2]

Infrastructure and Development Documentation

  • Expanded the README.md to include comprehensive instructions for local infrastructure setup using Docker Compose, database initialization, JWT key generation, Azure Key Vault setup, and a clear explanation of configuration hierarchy and validation.

Application State and Dependency Management

  • Introduced a new AppState dataclass (core/app_state.py) that centralizes application-wide resources (settings, database pool, Redis client, JWT auth, telemetry, Key Vault) and manages startup state and cleanup.

Health Monitoring Endpoints

  • Implemented production-ready health check endpoints (/health, /ready, /live) in api/health.py for use with Kubernetes and load balancers, providing detailed dependency status and metadata.

Core Utilities and API Structure

  • Refactored core/__init__.py to re-export key classes, functions, and exceptions for easier imports and better modularity. [1] [2]
  • Added a module docstring to api/__init__.py for clarity.

- Split core/models.py into domain modules
- Enhance user/auth models with production-grade features
- Update dependencies: pydantic[email] for EmailStr validation
- Update tests to match new model structure
- All imports remain backward compatible
- All 48 tests passing
…ling and OAuth provider requirements

- Changed IP address fields in models to use IPvAnyAddress for better validation.
- Made oauth_provider a required field in User and UserContext models.
- Removed deprecated OAuthTokens model and updated related tests.
- Enhanced tests to validate new model behaviors and requirements.
- Add docker-compose.infra.yml with PostgreSQL, Redis, Jaeger
- Add scripts/init-db.sql with complete database schema
- Add scripts/generate-keys.sh for JWT key generation
- Add scripts/setup-keyvault.sh for Azure Key Vault setup
- Add PostgreSQL, Redis, JWT, OpenTelemetry settings
- Add startup timeout and retry configuration
- Add pool size configuration for future use
- Create .env.example template
- Update .gitignore for secrets
- Create core/config_loader.py with retry logic
- Add environment validation (strict for prod/staging)
- Add exponential backoff retry for Azure connections
- Add azure-appconfiguration dependency
- Create core/app_state.py with AppState container
- Define DatabasePool and RedisClient protocols
- Create core/database.py with pool factory stub
- Create core/redis.py with client factory stub
- Add startup metadata tracking
- Add 7-phase startup sequence with logging
- Add configuration loading from Azure
- Add connection initialization and verification
- Add graceful shutdown with cleanup
- Add AppState dependency injection
- Add /health with detailed dependency checks
- Add /ready for Kubernetes readiness probe
- Add /live for Kubernetes liveness probe
- Update Docker health check to use /ready
- Add uptime and metadata to health response
- Add tests for environment validation
- Add tests for AppState lifecycle
- Add tests for health endpoints
- Update README with infrastructure setup
- Move all core module tests to tests/core/ directory
- Create tests/core/__init__.py
- Keep API tests (test_health_endpoints.py) in tests/ root
- Maintains test organization by module structure
…uirements

- Introduce azure-appconfiguration version 1.7.2 with its dependencies
- Update project dependencies to include azure-appconfiguration
- Ensure compatibility with existing azure-core and other related packages
@Jenish-1235 Jenish-1235 merged commit ed3bf51 into dev Dec 17, 2025
3 checks passed
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