RespKit

RespKit documentation

RespKit provides consistent HTTP responses for Go applications. Format responses, map errors to safe HTTP statuses, and return localized messages for each request. Its core module uses only the standard library, so applications can adopt the response API without adding a framework dependency.

resp.OK(ctx, data)
resp.Created(ctx, data, resp.Location("/users/123"))
resp.NoContent(ctx)
resp.Fail(ctx, err)
resp.NotFound(ctx)

Use the same response API with net/http, Gin, Echo v4/v5, Fiber v2/v3, Chi, Gorilla/mux, and Beego v2.

Start here

What RespKit provides

  • Ready-to-use helpers for common HTTP responses.
  • Stable public error codes that do not change with the selected language.
  • JSON translation catalogs, with Indonesian and English included. Applications can add other languages.
  • Safe error handling that hides raw internal messages from clients by default.
  • An optional RFC 9457 Problem Details format for errors.
  • A small core module that supports Go 1.22 and later and has no third-party runtime dependencies.
  • Separate optional integration modules for framework tests and database-specific error mapping.

How a response is formed

RespKit inspects the framework context, maps any error to a public code and status, selects a language from the request or response options, and formats the response body. Application data is returned as provided; the naming option applies only to RespKit's own envelope keys.

Version and support

Published versions are available on GitHub Releases. The compatibility guide explains module requirements and the scope of CI checks. The release process describes how versions are verified and published.

On this page