$ show NginxProxyManager/nginx-proxy-manager
Nginx Proxy Manager is a full-stack web application that provides a graphical user interface and REST API for managing Nginx reverse proxy configurations, SSL/TLS certificates (via Let's Encrypt or custom uploads), TCP/UDP streams, access control lists, and user permissions. The system is designed to run as a Docker container and is primarily used by self-hosting enthusiasts and small-to-medium deployments to simplify the otherwise complex task of configuring Nginx and maintaining certificates. The architecture is a classic three-tier web application: a Node.js/Express backend (ES modules) with Objection.js/Knex ORM supporting SQLite, MySQL, and PostgreSQL; a React 18/19 frontend built with TypeScript, Vite, TanStack Query, and Tabler UI; and a set of s6-overlay managed services (backend, frontend, Nginx) inside a single Docker image. The backend generates Nginx configuration files from Liquid templates and reloads Nginx on any change. External dependencies include Nginx, Certbot (for Let's Encrypt), OpenSSL, and optionally a database server. Key entry points are `backend/index.js` (server startup, migration, setup, Express app) and `frontend/src/main.tsx` (React bootstrap). The primary data flow is: user creates or modifies a proxy host, redirection, stream, or certificate via the UI → API call → backend validates permissions and data → persists to database → regenerates relevant Nginx config files → tests configuration → reloads Nginx. The system also periodically checks for certificate expiration and renews via Certbot, and fetches IP ranges from Cloudflare/Cloudfront for access control. The codebase demonstrates solid engineering practices: a consistent internal service layer with access control and audit logging, a well-typed API client with automatic camelCase/decamelize conversion, a reusable table framework built on TanStack Table, and a comprehensive i18n system supporting 24+ locales. While some modules (e.g., certificate management) are large and could benefit from refactoring, the overall structure is clean and maintainable.
The LLM identified 4 files worth highlighting for reuse:
Defines a hierarchy of typed error classes (AuthError, PermissionError, ValidationError, ItemNotFoundError, etc.) with i18n support. This module is self-contained, follows a clean pattern, and can be extracted into any Node.js project to provide consistent, semantic error handling.
Implements efficient log tailing by reading files in backward chunks, supporting large log files without loading them entirely into memory. The module is isolated (only depends on Node.js built-ins) and demonstrates a non-obvious pattern for real-time log streaming that can be reused in any application needing log viewer functionality.
A well-structured API client that automatically decamelizes request parameters and camelizes responses, handles 401 responses by logging out, supports FormData for file uploads, and provides a clean interface for all backend API calls. This module is self-contained and can be extracted into any React/TypeScript project to standardize API communication.
Provides a reusable API client for Cypress end-to-end tests, encapsulating token management, request building, and response handling. It enables tests to interact with the backend API without duplicating authentication logic. This pattern can be extracted and adapted for any Cypress test suite that needs to call a REST API.