Go SDK

Embedded

Embedded mode runs a full Hatchet engine and Postgres instance in-process for local development, with no account, API token, or Docker. It requires a blank import of github.com/hatchet-dev/hatchet-embedded, which registers the engine backend. See Embedded Mode for a guide.

WithEmbedded

WithEmbedded runs a full Hatchet engine in-process for local development, with no API token or Docker required. By default it starts a bundled Postgres; pass WithEmbeddedDatabaseURL to point it at your own instead.

Requires a blank import of the hatchet-embedded package (github.com/hatchet-dev/hatchet-embedded), which registers the engine backend. See the embedded mode guide for usage.

func WithEmbedded(opts ...EmbeddedOption) client.ClientOpt

Parameters:

NameType
opts...EmbeddedOption

Returns:

Type
client.ClientOpt

Embedded options

Options for WithEmbedded:

NameSignatureDescription
WithEmbeddedAPIPortWithEmbeddedAPIPort(port int)WithEmbeddedAPIPort overrides the port the embedded API server listens on.
WithEmbeddedDatabaseURLWithEmbeddedDatabaseURL(url string)WithEmbeddedDatabaseURL points embedded mode at an existing Postgres instead of the bundled one.
WithEmbeddedGRPCPortWithEmbeddedGRPCPort(port int)WithEmbeddedGRPCPort overrides the port the embedded engine's gRPC server listens on.
WithEmbeddedLogLevelWithEmbeddedLogLevel(level string)WithEmbeddedLogLevel sets the embedded engine's log level.
WithEmbeddedRabbitMQWithEmbeddedRabbitMQ(url string)WithEmbeddedRabbitMQ points the engine at a RabbitMQ instance for its message queue.
WithoutEmbeddedAPIWithoutEmbeddedAPI()WithoutEmbeddedAPI disables the embedded API server.
WithoutEmbeddedMigrationsWithoutEmbeddedMigrations()WithoutEmbeddedMigrations disables database migrations at engine startup.

EmbeddedConfig

EmbeddedConfig configures the embedded engine started by WithEmbedded. The WithEmbedded* options set these fields.

Fields:

NameTypeDescription
GRPCPort*intGRPCPort overrides the port the embedded engine's gRPC server listens on.
APIPort*intAPIPort overrides the port the embedded API server listens on.
StartAPI*boolStartAPI controls whether the embedded API server starts. Defaults to true.
RunMigrations*boolRunMigrations controls whether the engine applies database migrations at startup. Defaults to true.
RabbitMQURL*stringRabbitMQURL points the engine at a RabbitMQ instance for its message queue.
LogLevel*stringLogLevel sets the embedded engine's log level.
DatabaseURLstringDatabaseURL points the engine at an existing Postgres database instead of the bundled one.

EmbeddedBackend

EmbeddedBackend boots the embedded engine and returns a shutdown function. The hatchet-embedded package provides the implementation and registers it via RegisterEmbeddedBackend when imported.

RegisterEmbeddedBackend

RegisterEmbeddedBackend registers the function that boots the embedded engine. The hatchet-embedded package calls it from an init function, so a blank import of that package is all an application needs.

func RegisterEmbeddedBackend(b EmbeddedBackend)

Parameters:

NameType
bEmbeddedBackend

Last updated on September 1, 2026

On this page