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:
- Build one client in
mainfromBRRAIN_INTERNAL_URLandBRRAIN_INTERNAL_TOKEN, with a transport timeout sized for your slowest call (Configuration). - Hand it to handlers through a closure, a struct field or your framework's dependency mechanism. Do not build a client per request.
- Derive each call's context from the incoming request (
c.Request.Context()in Gin,c.Request().Context()in Echo) and add a deadline. - Listen on
127.0.0.1on the port the supervisor sets in the variable your manifest names inlisten.port_env. - 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.