Go with Gin or Echo — bRRAIn Docs

Using the bRRAIn Platform SDK inside a Gin or Echo extension: the SDK has no framework dependency, so the same one-client pattern applies.

Go with Gin or Echo

The Platform SDK has no framework dependency and no framework-specific package. It works the same way inside Gin, Echo, chi or the standard library:

  1. Build one client in main from BRRAIN_INTERNAL_URL and BRRAIN_INTERNAL_TOKEN, with a transport timeout sized for your slowest call (Configuration).
  2. Hand it to handlers through a closure, a struct field or your framework's dependency mechanism. Do not build a client per request.
  3. Derive each call's context from the incoming request (c.Request.Context() in Gin, c.Request().Context() in Echo) and add a deadline.
  4. Listen on 127.0.0.1 on the port the supervisor sets in the variable your manifest names in listen.port_env.
  5. Map SDK errors to responses deliberately (Error handling).

The complete standard-library version, including the manifest, is in Go with net/http; translating it to a router means changing only the route registration and the handler signature.

If you add a framework, it becomes part of your extension's binary and your supply chain; record its version in your release notes alongside the SDK commit you built against.