freshcrate

goa

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.

Description

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.

README

Goa

ReleaseGo DocGitHub Action: TestGo Report CardSoftware LicenseGurubaseGoa Design WizardSubstack: Design FirstSlack: GoaBluesky: Goa Design

Overview

Goa transforms how you build APIs and microservices in Go with its powerful design-first approach. Instead of writing boilerplate code, you express your API's intent through a clear, expressive DSL. Goa then automatically generates production-ready code, comprehensive documentation, and client librariesβ€”all perfectly aligned with your design.

The result? Dramatically reduced development time, consistent APIs, and the elimination of the documentation-code drift that plagues traditional development.

Sponsors

incident.io

incident.io: Bounce back stronger after every incident

Use our platform to empower your team to run incidents end-to-end. Rapidly fix and learn from incidents, so you can build more resilient products.

Learn more
Speakeasy

Speakeasy: Enterprise DevEx for your API

Our platform makes it easy to create feature-rich production ready SDKs. Speed up integrations and reduce errors by giving your API the DevEx it deserves.

Integrate with Goa

Why Goa?

Traditional API development suffers from:

  • Inconsistency: Manually maintained docs that quickly fall out of sync with code
  • Wasted effort: Writing repetitive boilerplate and transport-layer code
  • Painful integrations: Client packages that need constant updates
  • Design afterthoughts: Documentation added after implementation, missing key details

Goa solves these problems by:

  • Generating 30-50% of your codebase directly from your design
  • Ensuring perfect alignment between design, code, and documentation
  • Supporting multiple transports (HTTP, gRPC, and JSON-RPC) from a single design
  • Maintaining a clean separation between business logic and transport details

Key Features

  • Expressive Design Language: Define your API with a clear, type-safe DSL that captures your intent
  • Comprehensive Code Generation:
    • Type-safe server interfaces that enforce your design
    • Client packages with full error handling
    • Transport layer adapters (HTTP/gRPC/JSON-RPC) with routing and encoding
    • OpenAPI/Swagger documentation that's always in sync
    • CLI tools for testing your services
  • Multi-Protocol Support: Generate HTTP REST, gRPC, and JSON-RPC endpoints from a single design
  • Clean Architecture: Business logic remains separate from transport concerns
  • Enterprise Ready: Supports authentication, authorization, CORS, logging, and more
  • Comprehensive Testing: Includes extensive unit and integration test suites ensuring quality and reliability

How It Works

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Design API  │────>β”‚ Generate Code│────>β”‚ Implement Business  β”‚
β”‚ using DSL   β”‚     β”‚ & Docs       β”‚     β”‚ Logic               β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
  1. Design: Express your API's intent in Goa's DSL
  2. Generate: Run goa gen to create server interfaces, client code, and documentation
  3. Implement: Focus solely on writing your business logic in the generated interfaces
  4. Evolve: Update your design and regenerate code as your API evolves

Quick Start

# Install Goa
go install goa.design/goa/v3/cmd/goa@latest

# Create a new module
mkdir hello && cd hello
go mod init hello

# Define a service in design/design.go
mkdir design
cat > design/design.go << EOF
package design

import . "goa.design/goa/v3/dsl"

var _ = Service("hello", func() {
    Method("say_hello", func() {
        Payload(func() {
            Field(1, "name", String)
            Required("name")
        })
        Result(String)

        HTTP(func() {
            GET("/hello/{name}")
        })
    })
})
EOF

# Generate the code
goa gen hello/design
goa example hello/design

# Build and run
go mod tidy
go run cmd/hello/*.go --http-port 8000

# In another terminal
curl http://localhost:8000/hello/world

The example above:

  1. Defines a simple "hello" service with one method
  2. Generates server and client code
  3. Starts a server that logs requests server-side (without displaying any client output)

JSON-RPC Alternative

For a JSON-RPC service, simply add a JSONRPC expression to the service and method:

var _ = Service("hello" , func() {
    JSONRPC(func() {
        Path("/jsonrpc")
    })
    Method("say_hello", func() {
        Payload(func() {
            Field(1, "name", String)
            Required("name")
        })
        Result(String)

        JSONRPC(func() {})
    })
}

Then test with:

curl -X POST http://localhost:8000/jsonrpc \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","method":"hello.say_hello","params":{"name":"world"},"id":"1"}'

Documentation

Our documentation site at goa.design provides comprehensive guides and references:

Real-World Examples

The examples repository contains complete, working examples demonstrating:

  • Basic: Simple service showcasing core Goa concepts
  • Cellar: A more complete REST API example
  • Cookies: HTTP cookie management
  • Encodings: Working with different content types
  • Error: Comprehensive error handling strategies
  • Files & Upload/Download: File handling capabilities
  • HTTP Status: Custom status code handling
  • Interceptors: Request/response processing middleware
  • Multipart: Handling multipart form submissions
  • Security: Authentication and authorization examples
  • Streaming: Implementing streaming endpoints (HTTP, WebSocket, JSON-RPC SSE)
  • Tracing: Integrating with observability tools
  • TUS: Resumable file uploads implementation

Community & Support

License

MIT License - see LICENSE for details.

Release History

VersionChangesUrgencyDate
v3.26.0Goa v3.26.0 improves code generation correctness across HTTP and gRPC, adds support for cookie-backed API key inference, and reduces generator churn for downstream users. ## Highlights - Added cookie-backed API key security inference across generated HTTP code and OpenAPI output. - Fixed mixed gRPC streaming request generation by moving one-shot payloads back into the typed protobuf channel instead of implicitly rewriting them into metadata. - Improved generator stability with deterministic unHigh4/12/2026
v3.25.3## Highlights - Fixes a code generation regression where HTTP request decoders for **primitive payloads** (e.g. `string`, `bool`, numeric types) could emit invalid early returns (`return nil, err`) on validation/decode errors. - Prevents downstream build failures such as `cannot use nil as string value in return statement` for designs using primitive payloads with validations (e.g. `Format(FormatIP)` on path params). - Adds regression coverage, including a golden-backed case for `Format(FormatILow2/19/2026

Dependencies & License Audit

Loading dependencies...

Similar Packages

go-apispecGenerate OpenAPI 3.1 specs from Go source code via static analysis β€” zero annotations, automatic framework detectionv0.4.7
jzero Automatically generate server and client framework code based on descriptive files (proto/api/sql), while using built-in jzero-skills to empower AI to generate production-ready business code adheringv1.3.0
suricataType-safe AI agents for Go. Suricata combines LLM intelligence with Go’s strong typing, declarative YAML specs, and code generation to build safe, maintainable, and production-ready AI agents.0.0.0
go-orcaSelf-hosted AI workflow orchestration server. Runs multi-phase LLM pipelines (Director β†’ Architect β†’ Implementer β†’ QA) and delivers structured artifacts via PR, webhook, or bundle.main@2026-04-21
maestroThe Maestro App Factory: a highly-opinionated multi-agent orchestration tool for app development that emulates the workflow of high-functioning human development teams using AI agentsv1.5.0