Skip to content

Go SDK overview

The Go SDK is the Go member of the SDK family. It is a separate Go module, github.com/flowcatalyst/go-sdk, and it is also what the Go application framework’s FlowCatalyst module builds on: the framework does not talk to the platform itself, it uses this module.

Current version: v0.7.0. The version is pre-1.0, so a minor or patch release can still change an API. Read the changelog before you move.

Need Where Page
One business operation that writes its data, its event and its audit row atomically usecase, usecaseop, usecasepgx Use cases
Events, dispatch jobs, audit rows and pushes written to outbox_messages outbox, outboxpgx, outboxsql Outbox
Declare everything the application owns and sync it sync Sync
Call the platform API, get tokens, validate tokens, verify field tokens, run OIDC login client, auth Client and auth
Verify signed webhook deliveries webhook Webhooks
Receive scheduled-job firings scheduledjobs Scheduled jobs
Distributed locks and a TTL cache lock, cache Locks and cache
Branch on failures all packages Errors
TSIDs with typed prefixes tsid Identifiers

The SDK imports nothing from the platform. Its wire shapes follow the platform’s OpenAPI lock, and the client tests check every method against it.

Go 1.27 or later (the module declares go 1.27).

Terminal window
go get github.com/flowcatalyst/go-sdk@v0.7.0

Breaking since v0.0.20. The SDK uses github.com/lestrrat-go/jwx/v4 (v2 is deprecated), which needs Go 1.27. The key set returned by auth.JwksCache.Get is therefore jwx v4’s jwk.Set, not v2’s. See the changelog.

Releases are the tags vX.Y.Z on github.com/flowcatalyst/go-sdk, served by the Go module proxy. Each release is a single commit whose tree is the SDK exactly as released, so the published repository carries no development history.

An application never calls the platform from inside a business transaction. It writes rows to its own database, and a relay sends them.

flowchart LR
  req["HTTP request"] --> op["usecaseop.Run<br/>Validate, Authorize, Execute"]
  op --> tx["One transaction"]
  tx --> agg[("Aggregate table")]
  tx --> ob[("outbox_messages<br/>EVENT, DISPATCH_JOB,<br/>AUDIT_LOG, PUSH")]
  ob --> relay["Outbox relay<br/>(fcdev outbox or fc-server)"]
  relay --> plat["Platform batch endpoints"]

The relay is not part of the SDK. See the outbox for how rows are claimed, ordered and retried.

Package Purpose
usecase DomainEvent, EventMetadata, ExecutionContext, the typed *Error, audit redaction, the sealed Result[E]. No I/O.
usecaseop The enforced envelope: Operation[C, E], Plan[E], Run, and TxOperation / RunTx for multi-aggregate operations.
usecasepgx The pgx unit of work: New, Persist[A], Sink, DispatchJobSink, Commit*, EmitEvent, Run, RunErr.
outbox Builds the outbox rows (event, audit, dispatch job, push) and the INSERT. No I/O.
outboxpgx The pgx Sink that writes the rows, plus the table DDL.
outboxsql A database/sql writer for Postgres or MySQL, plus the DDL for both.
sync DefinitionSet and Synchronizer.
client The platform HTTP client.
auth Access-token claims, JWKS and HS256 validators, the OAuth client, the client-credentials provider, field-token verification.
webhook HMAC-SHA256 delivery signature verification.
scheduledjobs A runner for platform-fired scheduled jobs.
tsid 13-character Crockford Base32 ids with typed prefixes.
cache, lock Pluggable cache and lock contracts, with in-memory, Postgres and Redis backends.

cache/postgrescache, cache/rediscache, lock/postgreslock and lock/redislock are separate packages so that importing the contract does not pull in a database driver.

Each example builds with go build ./... in CI.

Example Shows
examples/order-service A use case through usecaseop.Run, the pgx outbox, and a plan that carries a dispatch job.
examples/dispatch-jobs A plan that saves an aggregate and carries two dispatch jobs; validating command-derived job fields.
examples/outbox-sql The database/sql writer: event, audit row and dispatch job in one *sql.Tx.
examples/fc-sync Syncing every category of one application.
examples/list-event-types The client with a static token or a client-credentials provider.
examples/scheduled-jobs-runner scheduledjobs.Runner behind an HTTP handler.
examples/webhook-receiver Signature verification and its error switch.

Tests that need a database live in a nested module, pkg/fcsdk/tests, which boots its own embedded Postgres. That keeps the embedded-Postgres dependency out of the SDK’s own go.mod, so your build never downloads it. From the platform repository, make test-go-sdk runs the build, vet and race tests and make test-go-sdk-tests runs the database tests.

Module github.com/flowcatalyst/go-sdk
Tag vX.Y.Z on the published repository
Licence Apache-2.0 (the module carries its own LICENSE and NOTICE)
Compatibility The platform’s api/openapi.lock.json and docs/wire-contract.md

The published repository is output only. Changes are made in the platform repository and appear in the next release.