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
| Package | Use it for |
|---|---|
inngestgo | The client, functions, triggers, events, Serve(), and Connect() |
inngestgo/step | Step tools such as step.Run, step.Sleep, step.WaitForEvent, and step.Invoke |
inngestgo/errors | Retry control, such as non-retriable errors |
inngestgo/pkg/checkpoint | Checkpointing configuration |
inngestgo/stephttp | Durable Endpoints (beta) |
inngestgo/realtime | Realtime publish and subscribe |
Guides
- Serve functions and Connect workers
- Primitives and steps and flow control
- Environment variables: set
INNGEST_DEV,INNGEST_EVENT_KEY, andINNGEST_SIGNING_KEYfor local and production runs
Migrations
Source code
The Go SDK is open source on GitHub: inngest/inngestgo.