Flow
ServicesTemplate Service

Template Service

The reference Go service — copy this directory to start a new service.

The template service is a real, compiled, tested service. Its domain is a throwaway Widget, but the wiring is what you copy: Postgres, Cedar authz, idempotent Command: An HTTP POST that changes state, recorded with an Idempotency-Key so retries do not double-apply; not CQRS or a command bus. handling via command.Execute, a Transactional outbox: Events are inserted into an events table in the same transaction as the state change; a publisher drains unpublished rows to RabbitMQ., and a Response envelope: The template service wraps every JSON response in {header, payload}; accounting still returns bare bodies and RFC 9457 errors until the divergence is resolved. on every JSON response.

Domain
Services
Kind
Go HTTP service
Lifecycle
Active
flowctl project
None
Stacks
Runs on its own

What it owns

  • Sample CRUD for widgets (POST / GET /v1/widgets)
  • Platform migrations (commands, events, principals, …)
  • Vendored Swagger UI and served OpenAPI spec
  • A second binary (flowstate) demonstrating multi-process deployment from one image

What it does not own

Production business logic. Replace internal/widget/ and the widget migrations when copying; keep 0001_platform.sql, internal/command/, internal/authz/, and the handler patterns.

Canonical service README: services/template/README.md.

On this page