Development and production

Run your app against the local Dev Server, then deploy it to Inngest Cloud.

The Go SDK runs in one of two modes:

  • Dev mode connects to the local Dev Server. Use it on your machine and in CI.
  • Cloud mode connects to Inngest Cloud. This is the default, so a deployed app never trusts unsigned requests by accident.

Turn on dev mode

Set the INNGEST_DEV environment variable, then start the Dev Server:

INNGEST_DEV=1 go run .
npx --ignore-scripts=false inngest-cli@latest dev -u http://localhost:8080/api/inngest

INNGEST_DEV=1 uses the Dev Server at http://127.0.0.1:8288. To use a Dev Server at another address, set INNGEST_DEV to its URL, for example INNGEST_DEV=http://192.168.1.254:8288.

Any value turns on dev mode, including 0 and false. To use cloud mode, leave INNGEST_DEV unset.

To choose the mode in code instead, set ClientOpts.Dev. It overrides INNGEST_DEV:

client, err := inngestgo.NewClient(inngestgo.ClientOpts{
	AppID: "billing",
	// Use the Dev Server everywhere except production.  This overrides INNGEST_DEV.
	Dev: inngestgo.BoolPtr(os.Getenv("APP_ENV") != "production"),
})

Durable Endpoints read only INNGEST_DEV, because stephttp.Setup doesn't use the client. To point a provider at another Inngest API, set stephttp.SetupOpts.Optional.BaseURL.

What changes between modes

Dev modeCloud mode
Inngest API and event APIThe Dev Server, http://127.0.0.1:8288 by defaulthttps://api.inngest.com and https://inn.gs
Requests from InngestNot verifiedMust have a valid signature from your signing key
Signing keyNot neededRequired to serve functions, connect workers, and run Durable Endpoints
Event keyNot needed to send eventsRequired to send events
Unauthenticated syncsAllowedRejected unless ServeOpts.EnableUnauthedSync is set

Deploy to production

Before you deploy, set these environment variables, and make sure that INNGEST_DEV isn't set:

VariableDescription
INNGEST_SIGNING_KEYVerifies requests from Inngest and authenticates syncs. Find it in your environment's signing key settings.
INNGEST_SIGNING_KEY_FALLBACKOptional. The previous signing key, so that requests keep working while you rotate keys.
INNGEST_EVENT_KEYSends events with client.Send and step.Send. Create one in your environment's event keys.
INNGEST_ENVOptional. The branch environment to use, for example in preview deploys.

You can also set each value in inngestgo.ClientOpts, such as SigningKey and EventKey. A value set in code takes the place of its environment variable.

Then make your functions available to Inngest:

  • Serve: deploy the app and sync it with the URL of your client.Serve() endpoint.
  • Connect: start your workers. Each worker syncs itself when it connects.

See serve or connect your functions for both setups, and environment variables for every variable the SDK reads.

Self-hosting

To use a self-hosted Inngest server, run in cloud mode and set INNGEST_BASE_URL to the server's URL. To use separate hosts for the API and events, set INNGEST_API_BASE_URL and INNGEST_EVENT_API_BASE_URL, or ClientOpts.APIBaseURL and ClientOpts.EventAPIBaseURL.