What this thread does
The problem
You have chosen Elixir/Phoenix and need outbound HTTP, OpenAPI docs, isolated API tests and login. Tutorials mix generations of these tools. Choose each layer by its job.
Versions and licences, as of November 2026
Official Hex/HexDocs versions checked 2026-11-24; not compatibility-tested together. Stable releases only.
| Component | Version | Licence and official source |
|---|---|---|
| Phoenix, including phx.gen.auth | 1.8.17 | MIT; Hex |
| Req, including Req.Test | 0.7.5 | Apache-2.0; Hex |
| Finch | 0.25.0 | MIT; Hex |
| Tesla | 1.23.0 | MIT; Hex |
| HTTPoison | 3.0.1 | MIT; Hex |
| open_api_spex | 3.22.4 | MPL-2.0; docs, licence |
| Mox | 1.3.2 | Apache-2.0; Hex |
| Bypass | 2.1.0 | MIT; Hex |
| Ash Authentication | 4.15.1 | MIT; Hex |
Hosted auth prices were not verified; budget separately for hosting, email and identity providers.
When to pick which
| Decision | Default for a new conventional Phoenix app | Choose differently when |
|---|---|---|
| Outbound HTTP | Req | Finch for direct pool/transport control; Tesla for a reusable middleware and adapter interface; retain working HTTPoison integrations unless a migration has a concrete benefit |
| API documentation | open_api_spex for Plug/Phoenix controllers | AshJsonApi for an API already modelled as Ash resources; a separately maintained OpenAPI document when the contract must lead implementation |
| HTTP client tests | Req.Test with Req | Mox for your application's behaviour contract; Bypass when the real HTTP client must talk to a local socket |
| Authentication | phx.gen.auth for an Ecto/Phoenix browser app | Ash Authentication for Ash resources and strategies; Ueberauth for provider login as one piece of an existing account system |
HTTP is a layered choice
Finch's maintainers explicitly say most developers will prefer Req. Req uses Finch by default and adds request/response steps, JSON encoding/decoding, redirects and configurable retries. Direct Finch requires a named instance, usually supervised. The recommendation concerns convenience, not measured speed.
Tesla's docs describe composable middleware and replaceable adapters. They warn against the default httpc adapter in production because it does not validate SSL certificates; choose a documented Mint, Finch or Hackney adapter explicitly. HTTPoison remains a Hackney-based option; its current published docs do not justify declaring it abandoned. Check timeouts, streaming and retries before migrating; decide explicitly whether writes may retry.
OpenAPI docs must match responses
open_api_spex provides schema/operation definitions, parameter casting and validation, Swagger UI and response assertions. Define ApiSpec and one controller operation, expose the JSON document and assert the real response against its schema. Swagger UI alone does not test the contract.
As of November 2026, AshJsonApi 1.8.0's OpenAPI guide derives the document from Ash resources using open_api_spex. Use it when Ash already owns the model. With a hand-maintained spec, enforce agreement with handlers yourself. No controller generator was verified.
Mock the boundary you actually need
- Req.Test replaces the network adapter with a Plug. Inject
plug: {Req.Test, MyApp.API}into your client, stub withReq.Test.stub/2and assert requests and errors. For counted expectations, use its verification callback. A separately spawned process may needReq.Test.allow/3. - Mox requires an explicit behaviour. Mock your API module's contract and use
verify_on_exit!/1. This checks callers' decisions, not HTTP serialization. Private mocks support concurrent tests; global mode does not. Check process ownership before disabling async tests. - Bypass runs a local HTTP server. Point the real client at its assigned port and inspect the request. Use it for client/transport integration and connection failures. It does not reproduce a provider's entire service or prove production TLS works.
Authentication depends on the domain model
phx.gen.auth generates application-owned code for email confirmation, magic links, optional passwords and privileged reauthentication. Updates to Phoenix do not patch previously generated authentication code; review its changelog and port fixes. Wire email delivery and test protected routes and account scoping.
Ash Authentication supplies password, magic-link, API-key and provider strategies around Ash resources, with a separate Phoenix integration. Prefer it when Ash already owns your domain. Ueberauth handles provider request/callback strategies; your app still owns account linking, sessions and authorization. Neither provider login nor a valid token alone establishes access to another user's records.
What community evidence says
- Frank Ferreira's Req walkthrough chains public APIs and demonstrates decoded bodies, parameters and request headers. It illustrates convenience, not production performance.
- Pieter Claerhout's Req.Test example shows test-only options merged into an application client. His principle is “your tests should not” rely on external HTTP; this is not a benchmark.
- In open_api_spex issue 388, vinibrsl reports using the project for documented APIs but asks how to customize descriptions of reused schemas. This illustrates modelling friction; no resolution was verified, so it is not evidence of a current defect.
Recommendation by constraint
For a new Ecto app, start with Req, Req.Test, open_api_spex and phx.gen.auth. For Ash, use its authentication and API integrations. Add Mox at behaviour boundaries and Bypass for wire behaviour. Keep working Tesla/HTTPoison clients unless switching buys something. These are editorial recommendations, not an ecosystem vote.
A prompt to give your agent
Inspect mix.exs, mix.lock, the API client and authentication routes. Report installed versions and cite matching official docs. Propose one HTTP boundary and choose Req.Test, Mox or Bypass for the layer being tested. Implement one successful API response, malformed response and timeout test without external traffic. Add one OpenAPI response assertion and one denied-access test. Keep the existing domain model; explain any new dependency. Do not migrate or contact a production database.
Mistakes to check
- Choosing Finch and Req as if their pooling were unrelated.
- Leaving Tesla on an adapter its own docs warn against.
- Passing a mock test while the actual request encoding is wrong.
- Treating generated auth as automatically updated, or provider login as authorization.
Limits
No code, installs, migrations, auth audit or benchmarks were run. Two blogs and one issue are limited evidence; auth and OpenAPI comparisons are thin. Ueberauth and AshJsonApi received a role review, not full version/licence compatibility verification. Reddit comment fetches failed. Official pages checked 2026-11-24.
Started from a post by @Pieter Claerhout, packaged by the editor. Original post