Go SDK

Install the Go SDK, create a client, and find the package reference.

The Go SDK defines durable functions, sends events, and serves your functions from any net/http server. It also runs Connect workers and supports checkpointing. Some features are TypeScript-only for now; see feature support.

The full API reference for every package is on pkg.go.dev.

Install

go get github.com/inngest/inngestgo@latest

Create a client and serve functions

Create one client for your app, define functions with it, and serve them over HTTP:

main.go
package main

import (
	"context"
	"log"
	"net/http"

	"github.com/inngest/inngestgo"
	"github.com/inngest/inngestgo/step"
)

func main() {
	client, err := inngestgo.NewClient(inngestgo.ClientOpts{AppID: "my-app"})
	if err != nil {
		log.Fatal(err)
	}

	_, err = inngestgo.CreateFunction(
		client,
		inngestgo.FunctionOpts{ID: "process-task"},
		inngestgo.EventTrigger("app/task.created", nil),
		func(ctx context.Context, input inngestgo.Input[inngestgo.GenericEvent[map[string]any]]) (map[string]any, error) {
			return step.Run(ctx, "handle-task", func(ctx context.Context) (map[string]any, error) {
				return map[string]any{"processed": true}, nil
			})
		},
	)
	if err != nil {
		log.Fatal(err)
	}

	http.Handle("/api/inngest", client.Serve())
	log.Fatal(http.ListenAndServe(":8080", nil))
}

The Go quick start walks through a full example with the Dev Server.

Packages

PackageUse it for
inngestgoThe client, functions, triggers, events, Serve(), and Connect()
inngestgo/stepStep tools such as step.Run, step.Sleep, step.WaitForEvent, and step.Invoke
inngestgo/errorsRetry control, such as non-retriable errors
inngestgo/pkg/checkpointCheckpointing configuration
inngestgo/stephttpDurable Endpoints (beta)
inngestgo/realtimeRealtime publish and subscribe

Guides

Migrations

Source code

The Go SDK is open source on GitHub: inngest/inngestgo.