JulienCorb
I’m about to build an Umbrella app where each app is a payment service for my end users.
each payment app makes a call to an API (like Stripe, Paypal, etc.) to process the payment.
so here is what I planned to do : create one router app that will redirect each request to the right app (depending on wether the user asked to pay through Stripe or Paypal for example). And create one phoenix app for each payment solution (no ecto, no webpack, no html, just one function for each api route).
So here are my questions:
-
Do I need to create any phoenix app ? shouldn’t any simple elixir app be enough ? as all I need is:
An app that routes the incoming requests
a module for each payment service that make api calls to the payment solution -
is it necessary to create an umbrella project ?
I feel like it’s always a good practice to create an umbrella project, no matter what the project is. am I right?
Trending in Questions
Other Trending Topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #ai
- #elixirconf-us
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #elixirconf-eu
- #metaprogramming
- #hex










Showing Posts 1 to 5- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
jkmrto
If all you need is handling HTTP requests you could try using plug_cowboy instead of Phoenix. It is a more lightweight solution that Phoenix but also grants you all the advantages of using Plug.
There is a great tutorial about this in elixir school.
idi527
I’d probably create a single app for all payments, called
:payment, which would have several “payment providers”,Payment.Provider.{PayPal, Stripe, AliPay, Bitcoin, etc...}, which would all implement thePayment.Providerbehaviour@callback pay(Payment.t) :: Payment.t, and export a single functionPayment.pay(provider, payment).Then I’d create a single http endpoint which would call that function on a request with the correct provider set.
JulienCorb
Hi @idi527 thank you for your answer ! why would you create a single app instead of an umbrella app ?
JulienCorb
hi @jkmrto ! thank you for your help
would you also only use plug_cowboy for the router app ?
idi527
I would create a single app for payments in the “umbrella” project structure, and then one app for the web interface. I wouldn’t separate the payment into several apps, since I don’t see any reason to …
I only separate an app if one of the following are “true”:
Separating code into several apps for any other reason I consider a bit superfluous … Modules can do just as good but with less ceremony.