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.
SimpleHub is a self-hosted API aggregation monitoring and management system designed for AI relay services. It allows users to manage multiple API sites (NewAPI, Veloera, DoneHub, VOAPI, and OpenAI-compatible) from a single dashboard. The system monitors model lists for changes, tracks account balances and usage, and supports automatic daily check-in for supported platforms. It sends email notifications via Resend when model changes are detected, either individually or aggregated in scheduled batch checks. The architecture is a monolithic Node.js application using Fastify for the backend and React (with Vite) for the frontend. The backend serves the built frontend statically and exposes a RESTful API under /api. Authentication is handled via JWT tokens. Data persistence uses SQLite via Prisma ORM. The system includes a cron-based scheduler for periodic checks, with support for per-site proxy configuration (HTTP, HTTPS, SOCKS5) and automatic BunkerWeb challenge solving through proxies. External dependencies include Fastify, Prisma, Resend, node-cron, bcryptjs, and various proxy agent libraries. Key entry points are the Fastify server (port 3000), the API routes defined in routes.js, and the scheduler that manages global and per-site cron jobs. The frontend provides a modern Ant Design-based UI for managing sites, viewing model lists, checking balances, and configuring notifications. The system is designed for easy deployment via Docker or direct installation scripts, with support for alwaysdata and systemd services.