Architecture

Discover the technical architecture of tug.sh and the role of its components.

System Architecture

The tug.sh platform is divided into three main components that work together to create a distributed and highly scalable container management ecosystem.

1. Dashboard (Next.js)

The primary user interface, built with React and Next.js (App Router). It enables you to conveniently manage your servers, monitor statuses, view logs, and launch pre-configured apps from the marketplace. It communicates directly with our REST API.

2. API Server (Go)

The heart of the entire system is our high-performance API written in Go, which:

  • Manages application states and users (PostgreSQL / MemoryStore).
  • Maintains persistent, bidirectional WebSocket connections with running Agents.
  • Routes requests (e.g., start container, delete, stream logs) directly to the appropriate Agent via WSS.

3. Agent (Go)

The Agent is a tiny daemon that runs on your VPS server. After authenticating with an HMAC token, it establishes a secure tunnel to the API Server. The Agent acts as the executor:

  • Translates JSON requests into native Docker commands (e.g., docker run, docker inspect, docker logs).
  • Configures networking and manages images.
  • Sends machine state and telemetry notifications back to the API.

Why this architecture?

You don't need to open any ports (neither for Docker nor the Agent) – the Agent "calls home" by establishing an outbound persistent connection, allowing it to work seamlessly even behind aggressive NAT firewalls. You gain 100% flexibility without burdening your server with heavyweight orchestration processes like Kubelet or etcd.