Design-first Go framework that generates API code, documentation, and clients. Define once in an elegant DSL, deploy as HTTP and gRPC services with zero drift between code and docs.
See the codeGoa is a design-first Go framework that generates HTTP, gRPC, and JSON-RPC APIs from a single contract. Describe your types, operations, and validation in Go. Goa generates the server and client code, CLI clients, and OpenAPI/protobuf specifications. You and your coding agent implement the business logic.
For a coding agent, that's less repetitive code to write, fewer representations to keep in sync, and a clear contract to reason from.
Quickstart · Documentation · Examples · Build AI agents with Goa-AI
A new field can affect a handler, a client, validation, and an API specification. With Goa, your agent changes the design and regenerates those pieces together.
design/, regenerate gen/, implement outside it. The same structure carries across services and transports.Install the Goa service designer skill in your application repository:
npx skills add goadesign/goa --skill goa-service-designer
The installer requires Node.js and npm and lets you choose your coding tool. The skill guides design changes, generation, implementation, and verification, and points the agent to relevant Goa documentation.
Then give it a real task:
Add a catalog service with a product lookup by SKU over HTTP and gRPC. Use the Goa service designer skill. Define the contract, generate the code, implement the lookup, and test successful and missing-product responses.
See the coding-agent workflow · Other skill installation options
This service exposes the same greeting over HTTP, gRPC, and JSON-RPC:
package design
import . "goa.design/goa/v3/dsl"
var _ = Service("hello", func() {
Description("Greets people by name.")
JSONRPC(func() {
POST("/rpc")
})
Method("greet", func() {
Description("Return a personal greeting.")
Payload(func() {
Field(1, "name", String, "Name to greet", func() {
MinLength(1)
})
Required("name")
})
Result(String)
HTTP(func() {
GET("/hello/{name}")
})
GRPC(func() {
})
JSONRPC(func() {
})
})
})
Goa generates the three transports, their Go clients, request validation, a CLI client, OpenAPI specifications, and Protocol Buffer definitions. They all call the same generated service interface. Your complete hello.go implementation is ordinary Go:
package helloapi
import (
"context"
genhello "hello/gen/hello"
)
type hellosrvc struct{}
// NewHello returns the greeting service.
func NewHello() genhello.Service {
return &hellosrvc{}
}
// Greet returns a greeting for the supplied name.
func (s *hellosrvc) Greet(ctx context.Context, p *genhello.GreetPayload) (string, error) {
return "Hello, " + p.Name + "!", nil
}
Here, genhello is the generated gen/hello package. The generated transports reject an empty name before calling Greet. Add a field or change a validation rule in the design, then regenerate the corresponding code and specifications.
Start with Go 1.26 or later; Go 1.27.1 is recommended:
mkdir hello && cd hello
go mod init hello
go get goa.design/goa/v3@latest
mkdir design
Save the design above as design/design.go. For all three transports, install the Protocol Buffer compiler and the Go protobuf generators. For an HTTP-only first run, omit both JSONRPC blocks and the GRPC block.
Generate the code and starter application:
go mod tidy
go run goa.design/goa/v3/cmd/goa gen hello/design
go run goa.design/goa/v3/cmd/goa example hello/design
Replace the starter hello.go with the implementation above, then run:
go mod tidy
go run ./cmd/hello --http-port=8000
In another terminal:
curl http://localhost:8000/hello/Alice
# "Hello, Alice!"
If you kept all three transports in the design, each command returns "Hello, Alice!":
go run ./cmd/hello-cli --url=http://localhost:8000 hello greet --name=Alice
go run ./cmd/hello-cli --url=grpc://127.0.0.1:8080 hello greet --message '{"name":"Alice"}'
go run ./cmd/hello-cli --jsonrpc --url=http://localhost:8000 hello greet --body '{"name":"Alice"}'
gen replaces the generated tree. example creates missing application files and leaves existing ones alone. Keep your implementation outside gen/, and use go run as above to run the generator version selected by your module.
For a guided walkthrough, follow the HTTP quickstart.
| Design in Goa | Get from the generator |
|---|---|
| Types, methods, validation, and errors | Typed service interfaces, endpoints, clients, and boundary validation |
| HTTP routes, parameters, headers, JSON and form bodies | Server handlers, encoders/decoders, Go clients, CLI commands, and OpenAPI specifications |
| gRPC messages, metadata, and status mappings | Protocol Buffer definitions, server/client adapters, serialization, and CLI commands |
| JSON-RPC methods and error mappings | Server/client code, request dispatch, batches, and notifications |
| Streaming methods | WebSocket and SSE support for HTTP, SSE for JSON-RPC, and gRPC streams |
| Result views | Named response shapes and the code to select and serialize them |
Build on these with security schemes, interceptors, and production guidance, or extend generation with plugins.
Goa-AI brings the same approach to AI applications. Reuse Goa types and bind tools to service methods, so your API and agent tools share a contract.
You implement the planner and application behavior; Goa-AI generates contracts, schemas, codecs, and integration code.
Explore Goa-AI → · Quickstart · A service and an agent sharing one design
v3.34.0 adds generated clients and servers for URL-encoded form requests, lets transport plugins reuse Goa's URL parameter validation and declare server dependencies, reports gRPC cancellation with native status codes, and fixes generation for viewed collection bodies, mapped URL parameters, explicit object bodies, and JSON-RPC bindings. Goa requires Go 1.26 or later.
Projects upgrading from v3.30.x must also account for the intentional source and transport changes introduced in v3.31. Read the upgrade guide before regenerating; it keeps the current v3.34.0 changes separate from those earlier migrations. The release notes explain the benefits and fixes.
Goa is supported by these sponsors. Thank you for helping keep the project growing.
Bounce back stronger after every incidentRun incidents end-to-end. Rapidly fix and learn from incidents, so you can build more resilient products. Explore incident.io → |
Enterprise DevEx for your APICreate feature-rich SDKs. Speed up integrations and reduce errors by giving your API the DevEx it deserves. Integrate with Goa → |
Questions, ideas, and contributions are welcome.
MIT licensed. See LICENSE · Go Report Card.
Overall
Maintained
Code review
Go module
Latest release
Releases this year
(top 24 of 56)
3,879 followers · starred Aug 2017
359 followers · starred Nov 2015
5,103 followers · starred Jan 2016
130 followers · starred Aug 2021
Design-first Go framework that generates API code, documentation, and clients. Define once in an elegant DSL, deploy as HTTP and gRPC services with zero drift between code and docs.
See the codeGoa is a design-first Go framework that generates HTTP, gRPC, and JSON-RPC APIs from a single contract. Describe your types, operations, and validation in Go. Goa generates the server and client code, CLI clients, and OpenAPI/protobuf specifications. You and your coding agent implement the business logic.
For a coding agent, that's less repetitive code to write, fewer representations to keep in sync, and a clear contract to reason from.
Quickstart · Documentation · Examples · Build AI agents with Goa-AI
A new field can affect a handler, a client, validation, and an API specification. With Goa, your agent changes the design and regenerates those pieces together.
design/, regenerate gen/, implement outside it. The same structure carries across services and transports.Install the Goa service designer skill in your application repository:
npx skills add goadesign/goa --skill goa-service-designer
The installer requires Node.js and npm and lets you choose your coding tool. The skill guides design changes, generation, implementation, and verification, and points the agent to relevant Goa documentation.
Then give it a real task:
Add a catalog service with a product lookup by SKU over HTTP and gRPC. Use the Goa service designer skill. Define the contract, generate the code, implement the lookup, and test successful and missing-product responses.
See the coding-agent workflow · Other skill installation options
This service exposes the same greeting over HTTP, gRPC, and JSON-RPC:
package design
import . "goa.design/goa/v3/dsl"
var _ = Service("hello", func() {
Description("Greets people by name.")
JSONRPC(func() {
POST("/rpc")
})
Method("greet", func() {
Description("Return a personal greeting.")
Payload(func() {
Field(1, "name", String, "Name to greet", func() {
MinLength(1)
})
Required("name")
})
Result(String)
HTTP(func() {
GET("/hello/{name}")
})
GRPC(func() {
})
JSONRPC(func() {
})
})
})
Goa generates the three transports, their Go clients, request validation, a CLI client, OpenAPI specifications, and Protocol Buffer definitions. They all call the same generated service interface. Your complete hello.go implementation is ordinary Go:
package helloapi
import (
"context"
genhello "hello/gen/hello"
)
type hellosrvc struct{}
// NewHello returns the greeting service.
func NewHello() genhello.Service {
return &hellosrvc{}
}
// Greet returns a greeting for the supplied name.
func (s *hellosrvc) Greet(ctx context.Context, p *genhello.GreetPayload) (string, error) {
return "Hello, " + p.Name + "!", nil
}
Here, genhello is the generated gen/hello package. The generated transports reject an empty name before calling Greet. Add a field or change a validation rule in the design, then regenerate the corresponding code and specifications.
Start with Go 1.26 or later; Go 1.27.1 is recommended:
mkdir hello && cd hello
go mod init hello
go get goa.design/goa/v3@latest
mkdir design
Save the design above as design/design.go. For all three transports, install the Protocol Buffer compiler and the Go protobuf generators. For an HTTP-only first run, omit both JSONRPC blocks and the GRPC block.
Generate the code and starter application:
go mod tidy
go run goa.design/goa/v3/cmd/goa gen hello/design
go run goa.design/goa/v3/cmd/goa example hello/design
Replace the starter hello.go with the implementation above, then run:
go mod tidy
go run ./cmd/hello --http-port=8000
In another terminal:
curl http://localhost:8000/hello/Alice
# "Hello, Alice!"
If you kept all three transports in the design, each command returns "Hello, Alice!":
go run ./cmd/hello-cli --url=http://localhost:8000 hello greet --name=Alice
go run ./cmd/hello-cli --url=grpc://127.0.0.1:8080 hello greet --message '{"name":"Alice"}'
go run ./cmd/hello-cli --jsonrpc --url=http://localhost:8000 hello greet --body '{"name":"Alice"}'
gen replaces the generated tree. example creates missing application files and leaves existing ones alone. Keep your implementation outside gen/, and use go run as above to run the generator version selected by your module.
For a guided walkthrough, follow the HTTP quickstart.
| Design in Goa | Get from the generator |
|---|---|
| Types, methods, validation, and errors | Typed service interfaces, endpoints, clients, and boundary validation |
| HTTP routes, parameters, headers, JSON and form bodies | Server handlers, encoders/decoders, Go clients, CLI commands, and OpenAPI specifications |
| gRPC messages, metadata, and status mappings | Protocol Buffer definitions, server/client adapters, serialization, and CLI commands |
| JSON-RPC methods and error mappings | Server/client code, request dispatch, batches, and notifications |
| Streaming methods | WebSocket and SSE support for HTTP, SSE for JSON-RPC, and gRPC streams |
| Result views | Named response shapes and the code to select and serialize them |
Build on these with security schemes, interceptors, and production guidance, or extend generation with plugins.
Goa-AI brings the same approach to AI applications. Reuse Goa types and bind tools to service methods, so your API and agent tools share a contract.
You implement the planner and application behavior; Goa-AI generates contracts, schemas, codecs, and integration code.
Explore Goa-AI → · Quickstart · A service and an agent sharing one design
v3.34.0 adds generated clients and servers for URL-encoded form requests, lets transport plugins reuse Goa's URL parameter validation and declare server dependencies, reports gRPC cancellation with native status codes, and fixes generation for viewed collection bodies, mapped URL parameters, explicit object bodies, and JSON-RPC bindings. Goa requires Go 1.26 or later.
Projects upgrading from v3.30.x must also account for the intentional source and transport changes introduced in v3.31. Read the upgrade guide before regenerating; it keeps the current v3.34.0 changes separate from those earlier migrations. The release notes explain the benefits and fixes.
Goa is supported by these sponsors. Thank you for helping keep the project growing.
Bounce back stronger after every incidentRun incidents end-to-end. Rapidly fix and learn from incidents, so you can build more resilient products. Explore incident.io → |
Enterprise DevEx for your APICreate feature-rich SDKs. Speed up integrations and reduce errors by giving your API the DevEx it deserves. Integrate with Goa → |
Questions, ideas, and contributions are welcome.
MIT licensed. See LICENSE · Go Report Card.
Overall
Maintained
Code review
Go module
Latest release
Releases this year
(top 24 of 56)
3,879 followers · starred Aug 2017
359 followers · starred Nov 2015
5,103 followers · starred Jan 2016
130 followers · starred Aug 2021