How chaos-zhu/easynode works
Project Type & Purpose
• Full-stack web application + light agent (“client”)
• Purpose: provide webSSH & webSFTP panel + server monitoring via a browser SPA
High-Level Component Identification
a. Web UI (“web” folder)
– Vue 3 SPA, Element Plus UI, communicates via REST + WebSockets
b. Backend API Server (“server” folder)
– Node.js/Express app with:
• Controllers (SSH, SFTP, AI-shell, notifications, scripts, user, group, etc.)
• Middlewares (auth, CORS, body parsing, logging, IP filtering, static files)
• Socket handlers (real-time terminal data, monitoring streams)
• Scheduler for on-demand tasks
• Embedded DB (file under /easynode/app/db or similar)
c. Monitoring Agent (“client” folder)
– Shell/Python/Node agent installed on each target Linux host
– Collects CPU/memory/disk/network/IP data, pushes to API server over port 22022
d. External Systems
– Managed SSH targets (through server acting as a jump-host)
– Optional Docker Engine (via socket) for container-terminal features
e. Orchestration & Deployment
– docker-compose.yml orchestrates 3 containers: web, server, client (optional)
– CI/CD workflows for building images (.github/workflows)
Interactions & Data Flows
1. Browser → Web UI (HTTP/HTTPS)
2. Web UI → API Server
• REST calls for CRUD (servers, scripts, users)
• WebSocket for live terminal/SFTP & monitoring
3. API Server → SSH/SFTP targets
• spawns pty processes, streams data back over WebSocket
4. Monitoring Agent → API Server
• Periodic push of metrics (JSON over TCP/WebSocket)
5. API Server ↔ Database
• read/write persistent configs, credentials, logs
Architectural Patterns & Design Principles
• Layered MVC-ish structure in server: Routes → Controllers → Utils/DB
• Event-driven real-time I/O via Socket.IO
• Single-page app (SPA) front-end, decoupled from API
• Agent-server model for monitoring
Essential Elements
• Ports (8082 for web/API, 22022 for agent)
• Docker-Compose boundary around containers