Skip to content
sudoR3DPublic

About

Self-hostable platform for running Telegram bots — token to container, kept alive.

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Repository files navigation

BotHive

Drop your bot in the hive. We keep it alive.

Self-hostable platform for running Telegram bots: paste a bot token, upload a zip or connect a GitHub repo, and BotHive builds it into a container, deploys it, restarts it when it crashes, and gives you live logs.

Features

  • Token-to-running-bot in minutes — no servers to manage per bot; each bot runs in its own hardened container (--cap-drop ALL, no-new-privileges, memory/CPU/pids caps).
  • Bring any code — Dockerfile, Procfile, or auto-detected Python/Node/Go/PHP projects; zip upload or GitHub repo.
  • Three database modes per bot — BYO external DB, managed SQLite volume, or hosted Postgres (schema-per-bot on a shared instance).
  • Polling or webhook ingress — BOT_INGRESS=polling runs bots with zero public infrastructure (no domain, TLS, or reverse proxy needed); webhook mode routes {slug}.{domain} through Traefik.
  • Multi-node ready — workers heartbeat into a nodes table; bots are pinned to nodes and jobs are claimed by eligible workers only.
  • Operator-controlled signups — BOTHIVE_SIGNUP=open|invite|closed with invite links, plus email/password, magic link, OAuth (GitHub/Google/Discord), and Telegram login.
  • Single-user mode — BOTHIVE_MODE=single skips login entirely for a personal instance.

Repo layout

bothive-api/   Go control plane API + worker + builder binaries (chi + betterauth-go)
bothive-web/   Dashboard SPA (Vite + TanStack Router + Query)
deploy/        Compose files, VPS deploy script, image build script
examples/      echo-go, echo-js, echo-py, echo-php reference bots
config/        nodes.example.yaml
DOCS/          OAuth setup checklist, image build guide

Requirements

  • Go 1.25+ (API), Node 20+ (dashboard)
  • Podman or Docker, with compose
  • A Telegram bot token from @BotFather

Local development

# API + control Postgres + tenants Postgres on :8080
./deploy/docker-dev.sh

# Dashboard on :5173 (proxies /api → :8080)
cd bothive-web && npm ci && npm run dev

Open http://localhost:5173. First run redirects to /setup — create the owner account, paste a bot token, deploy an example from examples/.

Running the API without containers instead:

cp .env.example .env   # fill secrets
cd bothive-api && go run ./cmd/server

Production install

Full runbook with Traefik/TLS details: deploy/VPS-DEPLOY.md.

git clone https://github.com/sudoR3D/Hive.git
cd Hive
cp deploy/env/prod.env.example deploy/env/prod.env   # then edit secrets/domains
./deploy/vps-deploy.sh
curl -fsS https://api.example.com/health              # → ok

Build the dashboard separately and serve bothive-web/dist from any static host:

VITE_API_URL=https://api.example.com ./deploy/build-platform.sh --web-only

Key configuration (deploy/env/prod.env)

Variable Default Purpose
BOTHIVE_MODE single single = one operator, no login. multi = real auth.
BOTHIVE_SIGNUP open multi mode signup policy: open | invite | closed
BOT_INGRESS webhook polling needs no domain/TLS; webhook needs {slug}.{WEBHOOK_BASE_DOMAIN}
WEBHOOK_BASE_DOMAIN example.com Base domain for bot webhook hostnames
API_DOMAIN — Public API hostname (Traefik route)
TRUSTED_ORIGINS — Exact dashboard origin(s) for CORS/auth cookies
BOT_RAM_MB / BOT_CPUS 256 / 0.25 Per-bot resource caps
PODMAN_SOCKET — Runtime socket mounted into the worker

OAuth, SMTP, and Telegram login variables are optional — see DOCS/OAUTH-SETUP.md. Without SMTP, magic-link and password-reset emails are disabled cleanly.

Deploying a bot

  1. Create a bot with @BotFather, copy the token.
  2. In the dashboard: paste token → name it → pick code source (zip or GitHub).
  3. Deploy. The platform builds an image (or uses the repo's Dockerfile), runs the container wired with BOT_TOKEN, DATABASE_URL, and ingress config, and reports health in the dashboard.

Reference bots live in examples/ — minimal echo bots in Go, JS, Python, and PHP that answer /start.

License

MIT — see LICENSE.

About

Self-hostable platform for running Telegram bots — token to container, kept alive.

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Contributors

Languages