How stefanwerfling/flyingfish works
Project Type & Purpose
• FlyingFish is a full-stack, microservice-based reverse-proxy manager. It delivers a web UI (SPA), a central API/backend service, and several supporting services (DNS server, SSH server, DynDNS server, UPNP, VPN) orchestrated via Docker Compose. It leverages a plugin system, internal libraries (“core”, “schemas”), and communicates with external providers (Let’s Encrypt ACME, IP-location/databases, DynDNS providers).
Main Components
a. Ingress Layer
• Nginx reverse‐proxy (container “nginx”): routes “/” to the frontend static files, proxies “/api” and service endpoints to internal services.
b. User Interface
• Frontend SPA (container “frontend”): static assets, TypeScript/JavaScript, calls backend REST endpoints over HTTPS.
c. API / Control Plane
• Backend service (container “backend”): Node.js + TypeScript HTTP server (Express-like), hosts routes under “/Routes”, uses core library, plugin manager, performs business logic.
d. Supporting Microservices
• ddnsserver: Dynamic DNS HTTP API
• sshserver: SSH management API
• himhip: “How is my Public IP” service API
• vpn: VPN server management API
e. Shared Libraries
• core package: common DB layers (MariaDB, InfluxDB, Redis), plugin system, utilities
• schemas package: TypeScript schema definitions, validation
f. Data Stores
• MariaDB: primary relational DB for users, domains, credentials, settings.
• InfluxDB: time-series storage for Nginx access logs, stream requests.
• Redis: pub/sub channels, caching (e.g., UPNP).
Component Interactions & Data Flow
• Clients (browser) → Nginx (HTTPS) → Frontend assets OR → Proxy “/api/*” → Backend
• Backend ←→ MariaDB (CRUD) & InfluxDB (read/write) & Redis (cache/pub-sub)
• Backend ↔ Plugin modules (loaded at startup via PluginManager)
• Backend ↔ Supporting services (HTTP calls to ddnsserver, sshserver, himhip, vpn)
• Backend ↔ External provider APIs (Let’s Encrypt ACME, DNS providers, IP location services)
• nginx service also proxies traffic to managed upstreams (user-defined HTTP/stream routes).
Architectural Patterns & Principles
• Microservices: each service in its own container, single responsibility.
• Layered architecture in backend/core:
• Routes (API layer) → Service classes (business logic) → Data providers (Db/Cache/External API abstractions).
• Plugin System for extensibility via DI and event hooks.
• Infrastructure as code: Dockerfiles per service, docker-compose.yml for orchestration.
• Typed schema validation: ETS/VTS libraries via schemas package.