service -> cmd + internal + modulesGenerate Go Microservices: Project Structure
Go generation produces small entrypoints, generated graph wiring and ordinary Go packages for business logic.
When to use
Use this reference when generating, reviewing or operating a Service Architect project.
Behavior
- cmd/service/main.go starts the generated service.
- internal/app/*generated.go materializes ServiceLib initialization, streams and connector wiring.
- internal/functions contains preserved business implementations and tests.
- internal/config separates generated configuration models from custom extensions.
- internal/types and internal/serdes contain service-local contracts.
- Every referenced Module is emitted under Module.name with its own go.mod; its actual shared type, function, protobuf and OpenAPI contents come from graph references.
Run a complete Go microservice example
Go modules, generated graph assembly and goroutine-based runtime execution.
The runnable Go example contains business implementations as well as generated infrastructure. A new Designer archive provides extension points for your own business code.
Install Git, GNU Make, Docker with Compose v2, and the host toolchain required by the repository README. Run these commands from the example workspace root; make help lists the targets available in that version.
git clone https://github.com/gorundebug/goexample.git
cd goexample
make help
make init
make docker-up- Use the service README and generated configuration for endpoint addresses and example requests.
- When finished, make docker-down stops the stack while preserving its volumes.
- Continue with the visual design guide or safe regeneration.
Go service directories
Important paths in each generated Go service.
cmd/service/main.goPreserved entrypointStarts the service with generated app/config packages.
internal/app/*.generated.goGeneratedTopology, runtime and transport initialization.
internal/app/service.goPreservedCustom service extension point.
internal/functions/PreservedBusiness stream functions, endpoint handlers and tests.
internal/config/config.generated.goGeneratedTyped runtime configuration model.
internal/config/config.goPreservedCustom configuration additions.
internal/types/ + internal/serdes/MixedService-local types and serialization.
go.mod + go.sumManagedStandalone module dependency contract.
Dockerfile + Dockerfile.localManagedProduction multi-stage and local debug image definitions.
Go service tree
<service-name>/
cmd/service/main.go
internal/app/service.generated.go
internal/functions/*.go
internal/config/
internal/types/ + internal/serdes/
config/ + graph/ + docs/
grafana/ + helm/