A REST/GraphQL API Framework for Golang with OpenAPI 3

A simple, modern, fast & opinionated REST API framework for Golang

  • A modern REST API backend framework for Golang developers
    • Described by OpenAPI 3 & JSON Schema
    • First-class support for middleware, JSON/CBOR, and other features
  • Documentation that can’t get out of date
  • Guard rails to prevent common mistakes
  • High-quality developer tooling

Features included in the Golang REST/GraphQL API Framework:

  • HTTP, HTTPS (TLS), and HTTP/2 built-in
  • Optional read-only GraphQL interface built-in
  • A declarative interface on top of widely used Golang Router Chi
    • Operation & model documentation
    • Request params (path, query, or header)
    • Request body
    • Responses (including errors)
    • Response headers
  • JSON Errors using RFC7807 and application/problem+json
  • Default (optional) middleware
    • RFC8631 service description & docs links
    • Automatic recovery from panics with traceback & request logging
    • Structured logging middleware using Zap
    • Automatic handling of Prefer: return=minimal from RFC 7240
    • OpenTracing for requests and errors
  • Per-operation request size limits & timeouts with sane defaults
  • Annotated Golang types for input and output modelsGenerates JSON Schema from Golang types
  • Automatic input model validation & error handling
  • Documentation generation using RapiDocReDoc, or SwaggerUI
  • CLI built-in, configured via arguments or environment variablesSet via e.g. -p 8000--port=8000, or SERVICE_PORT=8000
  • Connection timeouts & graceful shutdown built-in
  • Content negotiation between server and client
    • Support for gzip (RFC 1952) & Brotli (RFC 7932) content encoding via the Accept-Encoding header.
    • Support for JSON (RFC 8259), YAML, and CBOR (RFC 7049) content types via the Accept header.
  • Conditional requests support, e.g. If-Match or If-Unmodified-Since header utilities.
  • Generates OpenAPI JSON for access to a rich ecosystem of tools
  • Generates JSON Schema for each resource using describedby link relation headers as well as optional $schema properties in returned objects that integrate into editors for validation & completion.

This project was inspired by FastAPI. Look at the benchmarks to see how Huma compares.

Logo & branding designed by Kari Taylor.