Go Backend Overview

Last updated: April 25, 2026

Go Backend Overview

The dLANDiscord backend is a modular, high-performance Go application designed to serve as a central "Fortress" for personal automation, infrastructure monitoring, and advanced AI-driven operations.

High-Level Purpose

The system integrates a wide array of services (Discord, WhatsApp, Telegram, IRC, SSH, MQTT, and various APIs) into a unified, agentic framework. It is not just a bot; it is a coordinated ecosystem where agents can proactively monitor servers, manage projects, and communicate across multiple platforms.

Core Technologies

  • Language: Go (Golang) 1.24+
  • Primary Frameworks:
    • discordgo: Discord integration.
    • whatsmeow: WhatsApp integration.
    • go-telegram-bot-api: Telegram integration (fully active).
    • gorilla/mux: HTTP routing.
    • robfig/cron/v3: Precise task scheduling.
    • mattn/go-sqlite3: Local persistent storage (Scheduler, Observability).
  • AI Backends (10 Providers):
    • llama-server: Local LLM inference (formerly Ollama).
    • Ollama: Legacy local model support (being replaced by llama-server).
    • OpenRouter: Gateway to 90+ models (primary/fallback provider).
    • Google Gemini: Gemini 2.5-pro, 2.5-flash, etc.
    • Anthropic: Claude 3.5 Sonnet, 3 Opus, etc.
    • Grok (xAI): grok-3, grok-4-0709, grok-4.1-fast.
    • Kimi: kimi-k2, kimi-k2-thinking.
    • DeepSeek: deepseek-chat, deepseek-coder.
    • Inception: Inception Labs API (128k context).
    • ZAI: ZAI.ai API (128k context, conditional init).
    • Perplexity: Direct search client (not in llmClients map).
  • Web Interface: Custom-built dashboard with SSE (Server-Sent Events) for real-time agent output.

Entry Point: main.go

main.go is the central orchestration file (~67k lines). It performs the following sequence during startup:

  1. Version & Update Check: Verifies the current version against a remote endpoint and triggers self-updates.
  2. Service Registration:
    • Initializes the AssistantService.
    • Sets up notifiers (WhatsApp, Discord, Telegram).
    • Starts the Heartbeat Loops (proactive maintenance).
    • Starts the Wakeup System (presence detection).
  3. Global Infrastructure Setup:
    • Initializes the Global Scheduler (scheduler.db).
    • Initializes the Observability Database (observability.db).
    • Initializes the Free Models Provider (free-models.json).
    • Initializes the CCTV Monitor (Reolink NVR).
    • Initializes the WHMCS Support Watcher.
    • Initializes the Nightly Security Audit.
  4. HTTP API Registration: Registers 65+ endpoints for dashboards, AI interaction, and system management.
  5. Service Connectivity: Connects to Discord, IRC, Telegram, and starts the WhatsApp event loop.
  6. Scheduled Crons: Sets up high-level maintenance routines (daily SSL checks, weekly summaries, security audits, etc.).

Module Interactions

The system uses a Plugin-style architecture. Each subdirectory (e.g., bitcoin/, dsysadmin/, wowcheck/) is a self-contained module. The assistant module can interact with any of these via the Tool System, which translates natural language requests into Go function calls or shell script executions.

Key Subsystems

See individual feature documentation for details:


For detailed architectural flows, see Architecture.