<!-- canonical: https://hostdc.xyz/host/discordgo · last updated 2026-09-06 · HostDC, Keep your Discord bot online 24/7. -->

# Host a DiscordGo bot

HostDC builds and runs DiscordGo bots with Go 1.23, online 24/7, on a free plan with a 256 MB RAM pool, 0.5 CPU and 512 MB storage. We compile your module on deploy and then run the binary, so the running bot uses very little memory.

## Three steps

**1. Bring your module.** Three files are enough:

```
go.mod
go.sum
main.go
```

```go
package main

import (
	"os"
	"os/signal"
	"syscall"

	"github.com/bwmarrin/discordgo"
)

func main() {
	s, err := discordgo.New("Bot " + os.Getenv("DISCORD_TOKEN"))
	if err != nil {
		panic(err)
	}
	s.AddHandler(func(se *discordgo.Session, m *discordgo.MessageCreate) {
		if m.Content == "!ping" {
			se.ChannelMessageSend(m.ChannelID, "pong")
		}
	})
	if err := s.Open(); err != nil {
		panic(err)
	}
	defer s.Close()
	println("Logged in as", s.State.User.Username)

	stop := make(chan os.Signal, 1)
	signal.Notify(stop, syscall.SIGINT, syscall.SIGTERM)
	<-stop
}
```

**2. Add your token** on the Secrets tab. We inject it as `DISCORD_TOKEN`. Keep it out of the source.

**3. Press Deploy.** We run `go build` against the modules in your `go.sum`, then start the binary. Build output and runtime logs both land in the console.

## Limits you should know

The free plan gives a 256 MB RAM pool, 0.5 CPU and 512 MB storage, and needs reactivating weekly. Mini, Lite, Pro and Max are the paid plans: Lite is $1.69 a month, Pro is $2.49 a month, and the [pricing page](/pricing) has the full comparison. Builds happen on deploy, not on start, so a restart is fast.

## Related

- [Host a Go bot](/host/go)
- [Deploy from GitHub](/guides/deploy-from-github)
- [Keep a Discord bot online](/guides/keep-a-discord-bot-online)

## FAQ

### Do I need a go.sum?
Yes. We fetch modules through our proxy, which verifies them against the Go checksum database, and `go.sum` pins them.

### Where does the build run?
On our build worker, never inside your bot's sandbox. We then start the compiled binary.

### How much RAM does a Go bot need?
Usually far less than the 64 MB default allocation. Lower it on the Settings tab and you can run more bots inside the same pool.
