Gateway
One-line summary
The Gateway is the single Node.js process that runs everything — WebSocket/HTTP server, channel plugins, agent runtime, cron, memory, and the Control UI — serving as OpenClaw's central orchestration point.
Responsibilities
- Bootstrap and manage the lifecycle of all subsystems (channels, agents, cron, memory, canvas)
- Serve WebSocket connections for real-time communication with Control UI and CLI
- Handle HTTP requests: webhooks, OpenAI-compatible endpoints, canvas, Slack integration
- Manage authentication, rate limiting, and trusted proxy resolution
- Coordinate config migration, plugin loading, and health monitoring
Architecture diagram
Key source files
Key interfaces
How it connects to other modules
- Depends on: Every other module (this is the top-level orchestrator)
- Depended by: CLI (
openclaw gateway start/stop/restart), native apps (WebSocket client)
My blind spots
- Tailscale integration details —
tailnetbind mode - OpenAI-compatible endpoint implementation
- Health monitoring and discovery service
- How gateway restart preserves active sessions
Change frequency
server.impl.ts: High — new subsystem integrations and lifecycle changesserver-http.ts: Medium — new HTTP endpoints and auth features