Skip to content
Getting started

Getting started

You need Go (version) and Docker. cgo and libfdb_c are not needed.

Build the CLI from current source

fdb is the project’s CLI for local development clusters, SQL, and Record Layer operations (fdb rl). The examples below run from a checkout, so build the CLI from it:

git clone https://github.com/birdayz/fdb-go.git &&
cd fdb-go &&
go build -o .tmpbuild/fdb ./cmd/fdb &&
export PATH="$PWD/.tmpbuild:$PATH" &&
fdb version

To install the latest released CLI without a checkout, run curl -fsSL https://fdb.dev/install.sh | sh (Linux and macOS) or go install fdb.dev/cmd/fdb@latest. A checkout build can include unreleased changes described in these docs.

Configuration lives at ~/.fdb/config.yaml (override with FDB_CONFIG); fdb config path prints the effective path. See the CLI guide for installation, connections, and commands.

To use the CLI without writing a Go application, follow the complete protobuf records and indexes or SQL and catalog discovery tutorial.

Run the Go examples

FDB_CLUSTER_FILE="$(fdb dev up)" &&
export FDB_CLUSTER_FILE &&
go run ./example/sql &&
go run ./example

fdb dev up starts a single-node FoundationDB in Docker and prints the path of its cluster file. If it fails, check that Docker is running.

The SQL example creates a schema, inserts rows, and queries them. The Record Layer example saves and loads a record. Both recreate their data on every run, so they refuse to run without FDB_CLUSTER_FILE.

Use the client directly

Import fdb.dev/pkg/fdbgo/fdb for key-value transactions without the Record Layer or SQL engine. See the connection example and API notes. Transaction functions can run more than once, so keep external side effects out of them.

Stop FoundationDB

fdb dev down

Next