In my last post I introduced the architecture behind GoWind — the framework that carries 20+ enterprise products on a single Go stack: a core under 500 lines, 130+ plugins, and assembly by configuration instead of code.
This post is the hands-on follow-up. We're going to assemble the kind of service you'd actually ship — HTTP and gRPC transports, PostgreSQL, Redis, MinIO, Kafka, distributed tracing, and service discovery in etcd — and almost all of it will be one YAML file.
A gRPC microservice with service discovery
Start with a service that registers itself in etcd:
app: name: user-service server: grpc: addr: ":9000" reflection: true middleware: recovery: {} logging: {} validate: {} registry: type: etcd etcd: endpoints: ["localhost:2379"] ttl: 30 database: sql: driver: mysql source: "user:pass@tcp(localhost:3306)/users?parseTime=true" The main.go only registers the gRPC service implementation and starts:
package main import ( "os" "google.golang.org/grpc" bootstrap "github.com/tx7do/go-wind-bootstrap" _ "github.com/tx7do/go-wind-bootstrap/log/zap" grpcAdapter "github.com/tx7do/go-wind-bootstrap/transport/grpc" v1 "user-service/api/gen/v1" ) func init() { // Register the gRPC service implementation grpcAdapter.RegisterServiceRegistrar(func(srv *grpc.Server) { v1.RegisterUserServiceServer(srv, &userService{}) }) } func main() { if err := bootstrap.RunAppWithFlags(bootstrap.NewCommandFlags()); err != nil { os.Exit(1) } } Notice what's missing: there is no registration code for etcd. Once registry is configured, the framework registers the service automatically after startup (with the real listening endpoints), and deregisters it during graceful shutdown before the servers stop. The two most forgotten steps in hand-rolled service discovery — unregister on crash-prone shutdown paths, and advertising the actual port instead of a hardcoded one — simply don't exist as code to get wrong.
The full declarative bundle
Now scale up. Here is a single YAML describing logging, service registry (Consul), tracing (OTLP), cache (Redis), database (PostgreSQL), object storage (MinIO), and message broker (Kafka) at once:
app: name: order-service server: http: addr: ":8080" logger: type: zap zap: level: info writer: file output_path: logs/app.log max_size_mb: 100 max_backups: 10 registry: type: consul consul: address: "localhost:8500" tracer: type: otlp otlp: endpoint: "localhost:4317" insecure: true cache: redis: addr: "localhost:6379" key_prefix: "order" database: sql: driver: postgres source: "postgres://user:pass@localhost:5432/orders?sslmode=disable" storage: minio: endpoint: "localhost:9000" access_key: minioadmin secret_key: minioadmin use_ssl: false broker: kafka: brokers: ["localhost:9092"] In the semi-sealed mode, your code retrieves the assembled instances by type key after startup:
bctx, err := bootstrap.BootstrapWithContext(nil, cfg) if err != nil { log.Fatal(err) } defer bctx.Cleanup() // Retrieve assembled instances by type key db := bctx.Database("gorm") cache := bctx.Cache("redis") oss := bctx.Storage("minio") broker := bctx.Broker("kafka") reg := bctx.Registry("consul") // GetService/Watch/Register/Deregister bctx.App().Run(bctx) Every infrastructure concern that normally takes a week of wiring — connection pools, health checks, lifecycle ordering, shutdown semantics — was assembled from the file above. What's left in the codebase is exactly the part AI (or a human) should be writing: the business logic.
How the pieces find each other: blank imports
You may have noticed the imports with no name:
_ "github.com/tx7do/go-wind-bootstrap/log/zap" httpAdapter "github.com/tx7do/go-wind-bootstrap/transport/http" This is the self-registering builder pattern. Each adapter submodule (HTTP, gRPC, zap logging, OTLP tracing...) has an init() that registers its builder into a global registry; the blank import exists purely for that side effect. When the YAML says logger.type: zap, the framework looks up the builder named zap and calls it.
The consequence is pleasant in both directions:
- Adding a capability is adding an import plus a YAML block — no central wiring file to touch.
- Dropping a capability is deleting the import and the YAML block — the binary literally gets smaller.
And because the core never references any concrete plugin, the dependency graph stays flat: plugins depend on the core, never on each other.
Ship it
CGO_ENABLED=0 gives you a static binary; multi-stage Docker is as boring as it should be:
FROM golang:1.25-alpine AS builder WORKDIR /app COPY go.mod go.sum ./ RUN go mod download COPY . . RUN CGO_ENABLED=0 go build -o /server ./cmd/server FROM alpine:3.20 RUN apk add --no-cache ca-certificates tzdata WORKDIR /app COPY --from=builder /server . COPY configs/ ./configs/ EXPOSE 8080 CMD ["./server", "-c", "configs/config.yaml"] One binary, one config file, one docker compose up. The same shape deploys to bare metal with a file copy.
Why we bet on this
At GoWind this assembly story repeats across 20+ products — ERP, WMS, IM, a zero-trust gateway, behavior analytics — all sharing the same bootstrap layer, the same middleware semantics, and the same operational model. The marginal cost of the next service is mostly its business logic, because the platform tax is paid once in the framework, not per project in wiring code.
If you want to poke at it:
- Quickstart templates live in the open-source repos'
_examples/directory: github.com/tx7do - Framework docs: gowind.cloud/en/framework/intro.html
- Live admin demo: react.admin.gowind.cloud (
admin/Abcd@1234)
Next post in the series: writing a custom plugin for the framework — what the interfaces look like when the core is under 500 lines. Follow me here on DEV if that sounds useful, and tell me in the comments which infra concern you'd most like to see assembled from YAML next.
GoWind: https://www.gowind.cloud · GitHub: https://github.com/tx7do
