A zero-dependency Discord API v10 driver for Go

gda is a low-level Go driver for the Discord API v10 and Gateway WebSocket protocol, implemented using only the Go standard library (net/http, crypto/ed25519, compress/zlib).

Architecture & Design

  • Zero External Dependencies: Pure Go 1.24 stdlib. Zero third-party packages in go.mod.
  • Rate Limiting: Pre-flight, route-bucketed coordination tracking Discord’s per-route header buckets and global limits in memory before request execution.
  • Interactions: Unified router for application commands and components over both persistent Gateway WebSockets and stateless HTTPS webhooks with Ed25519 verification.
  • Gateway: WebSocket state machine with heartbeat watchdog, session resume and optional zlib stream decompression.
  • State Management: Zero default in-memory caching for guilds, channels or members. Cache architecture is delegated entirely to the application layer.

Installation & Usage

go get github.com/sfossl/gda@v0.1.0
package main

import (
	"context"
	"fmt"
	"log"
	"os"

	"github.com/sfossl/gda"
	"github.com/sfossl/gda/types"
)

func main() {
	client, err := gda.New(
		os.Getenv("DISCORD_TOKEN"),
		gda.WithIntents(types.IntentGuildMessages|types.IntentMessageContent),
	)
	if err != nil {
		log.Fatal(err)
	}

	client.OnReady(func(ctx context.Context, r *types.ReadyEvent) {
		fmt.Printf("Connected as %s\n", r.User.Username)
	})

	client.OnMessageCreate(func(ctx context.Context, msg *types.Message) {
		if msg.Author.Bot {
			return
		}
		if msg.Content == "ping" {
			fmt.Printf("Ping received from %s\n", msg.Author.Username)
		}
	})

	if err := client.Start(context.Background()); err != nil {
		log.Fatal(err)
	}
}

Feedback, bug reports and benchmarks can be submitted at GitHub Issues.