[phx_gen_auth] Where is the email client dependency put in a phoenix umbrella app?

For email client dependency, I mean packages such as swoosh or bamboo.

I created a phoenix umbrella application, there are two apps named myapp and myapp_web. phx_gen_auth is used to generate the authentication model, MyApp.UserNotifier module is generated to send email notifications.

Shall I put the email client dependency in myapp? As I think the email template belongs to UI part, myapp_web seems more suitable.

Any advice? Thanks

I’m not sure where I would put it but if you’re sending them directly from myapp_web maybe that would be the place but it does feel weird since it should be only responsible for the client-server interaction. But if you’re using an umbrella you could also have another app just responsible for that, on which myapp_web would depend. Then if you need to send notifications from myapp you can make it depend also on it.

Another thing to consider is if you use Oban or such to process the notifications sending, then that would live on myapp (or wherever you define your “workers”). I default to using Oban nowadays to process those kinds of things in a controlled fashion and so resort to placing the emailer dep. in whatever app defines the workers.

Thank you, very informative. I will create another app for notification and make myapp depend on it. So myapp_web always use myapp to send various kinds of emails that are rendered by Phoenix templates in the notification app.