Just read a backend architecture breakdown for image generation—the part about scaling from a Discord bot to a full system was pretty solid.

There’s this post about the Distillery backend that’s pretty upfront—it walks through the whole journey from building a basic Discord + Stable Diffusion bot from scratch to a system that can actually handle concurrent loads.

Getting started is dead simple: create an application in the Discord dev portal, enable the right intents, set up OAuth to invite it to your server, hook it up to Automatic1111’s --api, and you’re running in under 200 lines of code. But the moment you want to scale, everything falls apart: you need a dedicated machine, requests are queued and processed serially, switching models means modifying code, any component failing takes the whole thing down, plus content moderation.

Their solution is something I’d totally copy: use serverless GPU endpoints to handle concurrency and costs, swap in ComfyUI as the backend for flexible workflows, split the process into Bot, Master, and Worker—all containerized so they auto-restart on crash. Master and Worker are one-to-many, with a cache server locking requests to prevent multiple Bots from grabbing the same one. They run it on AWS Lightsail + Runpod.

I’m totally on board with picking Lightsail—AWS’s endless list of services is a headache just finding the right one, and Lightsail is basically a stripped-down version that saves you a ton of hassle.

The request to lock and prevent duplicate processing is a crucial detail—otherwise, you’re guaranteed to mess up under concurrency.

Lightsail is seriously underrated. Newbies don’t need to dive into that whole mess of services.

From setting up bots to handling concurrency, this post is way more practical than most tutorials out there.