examples/

directory
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2026 License: MIT

README

Hello and formatter

make dev builds two independent Go services with the operator console. Open the console at http://127.0.0.1:8081/backplane/ with the local operator token. Open Hello's module and refresh its statistics: the browser calls Hello's AdminService.GetStats through the authenticated relay. The relay cannot call the public greeting service.

curl 'http://127.0.0.1:8080/hello/?name=ann'
curl 'http://127.0.0.1:8082/formatter/?name=ann'

Hello renders its own greeting. Its greeter records the result and emits application audit through OTel. Formatter independently renders its prefix, name and suffix as a JSON string; it does not subscribe to Hello. Edit greeter.suffix or formatter.prefix under the corresponding service's Configuration page.

Code and verification

  • hello/cmd/hello: managed HTTP, gRPC and ws-proto listeners, an independently owned listener, live configuration, component health and an internal console API.
  • hello/internal/greeter: service logic, tracing, counters and audit. hello/internal/admin: the separate console contract. formatter/internal/formatter: HTTP with live settings.
  • make test checks the Go packages. With a dedicated stack from make up, make test-m1 checks config, relay and bundles; make test-replicas checks config repair and audit across a replica crash. Do not register the demo services on that stack while running conformance.
  • make test-dev exercises the running development installation. make dev-down stops it without clearing its storage.

Directories

Path Synopsis
formatter
cmd/formatter command
formatter is hello's independently compiled companion service.
formatter is hello's independently compiled companion service.
internal/formatter
Package formatter demonstrates a standalone HTTP handler with live configuration.
Package formatter demonstrates a standalone HTTP handler with live configuration.
hello
cmd/hello command
hello demonstrates listeners, service discovery, live configuration and a service-owned console module.
hello demonstrates listeners, service discovery, live configuration and a service-owned console module.
internal/admin
Package admin is hello's internal API, for its console plugin only: gRPC on the platform port behind the internal secret.
Package admin is hello's internal API, for its console plugin only: gRPC on the platform port behind the internal secret.
internal/greeter
Package greeter is the service's domain component: it serves HelloService over every public protocol with one implementation.
Package greeter is the service's domain component: it serves HelloService over every public protocol with one implementation.
internal/hellotest
Package hellotest builds hello's components under a backplanetest harness, as NewState wires them, for the component tests.
Package hellotest builds hello's components under a backplanetest harness, as NewState wires them, for the component tests.
internal/legacy
Package legacy is a listener hello serves itself, outside the SDK's public port: the service announces it with a declarative route (svc.API(api.HTTP(...))) so its API appears in the catalog.
Package legacy is a listener hello serves itself, outside the SDK's public port: the service announces it with a declarative route (svc.API(api.HTTP(...))) so its API appears in the catalog.
internal/store
Package store stands in for an infra package (pkg/backplane/infra/postgres, infra/valkey): a config section plus a deps.Provider built from it.
Package store stands in for an infra package (pkg/backplane/infra/postgres, infra/valkey): a config section plus a deps.Provider built from it.
internal/web
Package web holds hello's HTTP-facing pieces: the /hello/ handler, a tiny GraphQL endpoint, the middleware and the gRPC interceptors its routes are declared with.
Package web holds hello's HTTP-facing pieces: the /hello/ handler, a tiny GraphQL endpoint, the middleware and the gRPC interceptors its routes are declared with.

Jump to

Keyboard shortcuts

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