DEV Community

Amr
Amr

Posted on

I built a "Bot Factory" in Go that routes thousands of Telegram bots through a single port

Hey everyone,

I wanted to share BotForge, an open-source communication bot factory I built in Go. It allows you to host thousands of custom bots instantly without writing any code, making it possible to run a massive network of bots even on the weakest servers (like a low-spec VPS).

The main engineering challenge was avoiding the resource overhead of running a separate process or polling loop for every single bot. To solve this, I built a unified HTTP server that handles webhooks for all bots simultaneously. It uses O(1) in-memory routing to direct updates to the correct bot instance and a custom "ManualPoller" implementation to keep the child bots passive, meaning they consume almost zero resources when idle.

The stack is Telebot v3, Redis, and MySQL.
I would appreciate any feedback on the architecture.

Repo: https://github.com/Amr-9/BotForge

Top comments (0)