finds.dev← search

// the find

elixir-tesla/tesla

★ 2,078 · Elixir · MIT · updated Sep 2026

The flexible HTTP client library for Elixir, with support for middleware and multiple adapters.

Tesla is a middleware-based HTTP client for Elixir, in the same vein as Ruby's Faraday: you build a client by stacking middleware (base URL, JSON, retry, auth, circuit breaker) on top of a swappable adapter (httpc, Hackney, Mint, Finch, Gun). It's for anyone writing an API client in Elixir who wants request/response concerns separated from adapter choice, rather than calling :httpc or Hackney directly.

The adapter abstraction is genuinely useful in practice, not just theoretical — you can start on httpc and move to Finch or Mint later without rewriting call sites, which matters if you later need HTTP/2 or connection pooling. The middleware set covers real production needs out of the box: Retry, Fuse (circuit breaker), Telemetry, and Logger mean you're not reaching for three extra libraries just to get resilience and observability. Tesla.Mock gives proper request mocking for tests, which Elixir doesn't have a strong built-in story for otherwise. The OpenAPI param modules (path/query/header/cookie params, query string serialization) suggest this gets used for generated API clients, not just toy scripts.

The default adapter (httpc) doesn't validate SSL certificates, and the README is upfront that they won't fix it for backward-compatibility reasons — that's a real footgun for anyone who adds :tesla and starts making requests without reading past the install step. The adapter abstraction leaks: pool configuration, HTTP/2 support, and streaming behavior differ per adapter, so 'swap the adapter' isn't actually drop-in once you're doing anything beyond basic requests. Middleware ordering is significant and easy to get wrong (e.g., auth headers vs. JSON encoding), and debugging a misordered stack means reading macro-expanded source since there's no runtime introspection tooling. Tesla.Mock has a documented gotcha around global mode leaking state across async tests if you don't scope it correctly.

View on GitHub →

// want more like this?

We dig through GitHub every week and send a few repos picked for what you actually care about — each with an honest take like this one.

Get finds in your inbox → Search again →