bunnyx - a bunny.net client library

bunnyx is a feature-complete Elixir client for the bunny.net API. bunny.net is an EU-based CDN service with a ton of features and global infrastructure. I had been creating ad-hoc clients for a few projects and I figured it was worth splitting it out into its own library.

Design goals:

  • Built on Req, following the same conventions as Req itself (where it makes sense).
  • No Application config, no compile-time setup, no global state. Every function takes a client struct, so multi-account setups and tests without stubs just work.
  • Four client types for the four auth schemes bunny.net uses: account API key, edge storage password, S3 SigV4, and Stream library key. Recently got S3 preview access so was able to validate the code.
  • Typed structs with @spec on every public function. Snake_case attrs validated at call time, unknown keys raise ArgumentError with the valid set listed.
  • Credentials hidden via Inspect derivation on every struct that holds them. API keys scrubbed from error messages.
  • Telemetry start/stop/exception on every request.

The full bunny API is covered: CDN, DNS, edge and S3 storage, video streaming, Shield/WAF, Edge Scripting, Magic Containers, billing, account, logging. Integration tests live as Livebooks under livebooks/ that you can run against the real API with your own key. More information in the blog post.

Feedback, feature requests, bug reports etc very welcome!

16 Likes