$ account Nya-Foundation
NyaProxy is a lightweight API gateway/proxy service built with FastAPI and Uvicorn that manages authentication, credential rotation, load balancing, rate limiting, and observability for HTTP APIs. It acts as an intermediary between clients and upstream services, injecting credentials, enforcing quotas, and providing features like retry logic, key quarantine, and request/response transformation. The system includes a web dashboard for monitoring traffic, metrics, and queue status, and exposes Prometheus metrics for external monitoring. The architecture follows a modular design with separate concerns: core proxy logic (queue-first request handling), traffic management (load balancing and rate limiting), configuration management (using Nacho for layered config and schema validation), services (metrics, state persistence), and a dashboard interface. Requests are processed via a priority queue with worker pools, enabling prioritization of retries and high-priority requests. State persistence saves rate limit windows and key cooldowns to disk using SHA256-hashed keys to avoid storing secrets, allowing survival across restarts. Key entry points include the CLI (`python -m nya` or `nyaproxy` script) and the main application factory in `nya/server/app.py`. The system relies on dependencies like FastAPI, Uvicorn, Pydantic, Nacho, and the Prometheus client, with explicit version pins in `pyproject.toml` and regular updates shown in the changelog. The codebase demonstrates strong engineering practices including comprehensive test coverage (unit and end-to-end), secure secret handling, and clean separation of concerns.