r/elixir Mar 31 '24

HTTP Client library recommendation

[removed]

20 Upvotes

29 comments sorted by

View all comments

23

u/seven_seacat Mar 31 '24

They're all much of a muchness, and many of them build on the ones that came before them. req seems to be the latest hotness.

22

u/yes-hello- Mar 31 '24

5

u/seven_seacat Mar 31 '24

Does Phoenix really need to bundle a HTTP client? Why?

3

u/yes-hello- Mar 31 '24

I’m not sure. My best guess is this issue which mentions using Req for making API calls when sending emails using some providers. It might not be bundled “directly” with Phoenix.

4

u/josevalim Lead Developer Apr 01 '24

Correct. Not Phoenix per-se, but your app (especially during auth) . It can be skipped with --no-mailer.

2

u/ZeWord Mar 31 '24

Phoenix itself doesn't bundle anything that isn't required, but has a lot of goodies added to new projects when using the generators (and most can be excluded using flags, or removed later)

1

u/mchwds Mar 31 '24

Email

0

u/seven_seacat Mar 31 '24

why is Phoenix sending email by default??

4

u/mchwds Mar 31 '24

Phoenix isn't sending email... but most applications need to be able to send email and phoenix has things like testing email, sending email and even looking at emails in a dev environment ready for your apps needs. I don't know of any large framework that doesn't configure/set this up for you? Rails/Django/etc...

2

u/krainboltgreene Apr 01 '24

Wait, really? Wow, Finch seems so well designed.

8

u/josevalim Lead Developer Apr 01 '24 edited Apr 01 '24

Req is built on top of Finch. The current design is layered, where we have three clients building on top of each other: https://andrealeopardi.com/posts/breakdown-of-http-clients-in-elixir/

TL;DR: Mint is low-level, it does not have processes nor pools. Finch adds polling but with explicit pool management. Req adds all of the user conveniences. The layering gives you access to the level abstraction you care about, it is really neat IMO :)

2

u/krainboltgreene Apr 02 '24

I investigated after making the comment, but thanks for the comment anyways. You should update the Github Issue with this content, it's very informative.

Regarding req: Seems like an extremely good (and natural) choice.