embed

package module
v0.107.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 15, 2026 License: MIT Imports: 31 Imported by: 0

README

hatchet-embedded

Run a full Hatchet engine (migrations, API, and gRPC) from your application — in-process from Go, or as a sidecar process from the TypeScript and Python SDKs. By default it also starts a bundled Postgres, so you need zero external services to get running.

Full documentation: docs.hatchet.run/v1/embedded

Quickstart

Go (in-process, via a blank import):

import (
	hatchet "github.com/hatchet-dev/hatchet/sdks/go"
	_ "github.com/hatchet-dev/hatchet-embedded"
)

client, err := hatchet.NewClient(hatchet.WithEmbedded())

TypeScript (a separate entry point, so it never ends up in production bundles):

import { HatchetEmbeddedClient } from '@hatchet-dev/typescript-sdk/v1/embedded';

const hatchet = await HatchetEmbeddedClient.init();

Python:

from hatchet_sdk import Hatchet

hatchet = Hatchet.from_embedded()

Runnable examples for all three live in examples.

Releases

Release tags correspond to the publicly released Hatchet engine version baked into the sidecar: vX.Y.Z, or vX.Y.Z-N for sidecar-only fixes on the same engine. Each release ships hatchet-embedded-sidecar binaries for darwin/linux (signed and notarized on macOS), which the TypeScript and Python SDKs download on first use.

License

MIT — see LICENSE.

Documentation

Index

Constants

View Source
const DefaultAPIPort = 28243

DefaultAPIPort is the port the embedded API binds to when it is free, so tooling like 'hatchet embedded-ui' can find an instance without configuration. Additional instances fall back to a random free port. The value avoids IANA-assigned services and the OS ephemeral range.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// contains filtered or unexported fields
}

type Instance

type Instance struct {
	// contains filtered or unexported fields
}

func Start

func Start(ctx context.Context, opts ...Option) (*Instance, error)

func StartServer

func StartServer(ctx context.Context, opts ...Option) (inst *Instance, err error)

func (*Instance) APIURL

func (i *Instance) APIURL() string

func (*Instance) Client

func (i *Instance) Client() *hatchet.Client

func (*Instance) GRPCAddress

func (i *Instance) GRPCAddress() string

func (*Instance) Shutdown

func (i *Instance) Shutdown(ctx context.Context) error

func (*Instance) TenantID

func (i *Instance) TenantID() string

func (*Instance) Token

func (i *Instance) Token() string

type Option

type Option func(*Config)

func WithAPIPort

func WithAPIPort(port int) Option

func WithAdminUser

func WithAdminUser(email, password string) Option

func WithGRPCPort

func WithGRPCPort(port int) Option

func WithKeysets

func WithKeysets(master, privateJWT, publicJWT []byte) Option

func WithLogLevel

func WithLogLevel(level string) Option

func WithLogger

func WithLogger(l *zerolog.Logger) Option

WithLogger routes embed's logging (and the bundled Postgres output) through a caller-supplied logger instead of the default one derived from the log level.

func WithPostgres

func WithPostgres(url string) Option

func WithPostgresDataDir

func WithPostgresDataDir(dir string) Option

WithPostgresDataDir stores the bundled Postgres runtime and data under dir instead of the default per-project directory derived from the working directory. Two instances must not share a data dir concurrently.

func WithRabbitMQ

func WithRabbitMQ(url string) Option

func WithoutAPI

func WithoutAPI() Option

func WithoutMigrations

func WithoutMigrations() Option

Directories

Path Synopsis
cmd
sidecar command
examples
go command

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL