$ show louislam/dockge
Dockge is a self-hosted web application for managing Docker Compose stacks. It provides a graphical interface to create, edit, deploy, and manage stacks composed of multiple containers. The application supports managing multiple Docker hosts (agents) from a single interface, enabling centralized control of distributed Docker environments. Key features include a web-based terminal for container access, real-time updates via Socket.io, stack lifecycle management, and extensive customization through settings and environment variables. The architecture consists of a Node.js/Express backend with Socket.io for real-time communication and a Vue.js 3 frontend built with Vite. The backend handles Docker interactions, database operations (using SQLite or MySQL for metadata), and agent management, while the frontend delivers a responsive UI with internationalization support. Data flows involve the frontend sending user actions to the backend via Socket.io, which then interacts with the Docker daemon (local or via agents) and persists stack definitions as compose.yaml files on disk. The system emphasizes a file-based approach for stack definitions, ensuring portability and transparency. Dockge demonstrates strong engineering practices through its modular design, including isolated components for settings caching, terminal management, rate limiting, and an extensible agent system. These components exhibit low coupling and high reusability, adhering to principles of separation of concerns and maintainability. The application also incorporates modern development practices such as multi-stage Docker builds, automated CI/CD, and comprehensive test coverage (though not detailed in the provided summaries, the presence of CI workflows suggests testing efforts).
The LLM identified 4 files worth highlighting for reuse:
Implements a settings cache with automatic expiration (60s TTL) to reduce database reads. The cache is self-contained and can be extracted as a generic utility for caching configuration or other frequently read data with TTL-based invalidation.
Manages PTY-based terminal processes with keep-alive mechanisms and client tracking. Handles spawning, I/O forwarding, and cleanup of terminal sessions, preventing resource leaks. This isolated module could be reused in any application requiring web-based terminal access.
Provides Express middleware for rate limiting based on IP address, specifically designed for authentication endpoints (login, API, 2FA). Uses an in-memory store and is easily extractable to any Express application for brute-force protection.
Abstracts connections to multiple Docker instances (local and remote) through a plugin-like agent system. Manages connection lifecycle and health checks, allowing the application to interact with diverse Docker environments via a uniform interface. The agent manager and its handlers (Docker, terminal) demonstrate a reusable pattern for managing remote resources.