Runnable examples demonstrating the OpenDecree Go SDK. Each example is a standalone Go module you can copy into your own project.
Start the decree server and seed example data:
# From this directory
make setupThis starts PostgreSQL, Redis, and the decree server via Docker Compose, then creates an example schema, tenant, and initial config values.
The tenant ID is written to .tenant-id — examples read it automatically.
| Example | What it shows | Server required |
|---|---|---|
| quickstart | Connect + read typed config values | Yes |
| feature-flags | Live feature toggles with configwatcher | Yes |
| live-config | HTTP server with hot-reloadable config | Yes |
| multi-tenant | Same schema, different tenant values | Yes |
| optimistic-concurrency | Safe concurrent updates with CAS | Yes |
| schema-lifecycle | Create, publish, and manage schemas | Yes |
| environment-bootstrap | Bootstrap from a single YAML file | Yes |
| config-validation | Offline config validation (no server) | No |
# After make setup:
cd quickstart
go run .Or run all examples as tests:
make test| File | Role |
|---|---|
seed.yaml |
Canonical full example. Rich schema with all field types, metadata, and constraints. Used by make setup to bootstrap the SDK examples. |
demo.seed.yaml |
Minimal — 3 fields in ~15 lines. Drives the assets/demo.gif terminal recording and doubles as a copy-paste quickstart snippet. |
Both are standard decree seed inputs (schema + tenant + config in one doc) — either works as a starting point.
make downEach example directory is a self-contained Go module. To use one as a starting point:
- Copy the directory to your project
- Remove the
replacedirectives fromgo.mod - Run
go mod tidy