AndyL
Phoenix Contexts and Umbrella Apps seem to serve a similar purpose.
Can anyone give guidelines on when to use one vs the other?
Trending in Questions
Hey guys,
I’ve got a huge CSV ( around 10 GB ) that needs to be processed hourly
Do you guys have any suggestions what is the best prac...
New
Hello!
Could someone please give me a help/sample code, how to delete a file from s3 using waffle/waffle_ecto from Phoenix app.
I creat...
New
I have what I’ve heard referred to as a “lookup table” in my database. This is a way of assigning codes to common values. One common lo...
New
What approach to take when sending live updates to “random” users Hi! I have a question, I have a little chat app, and when I create a DM...
New
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
Anyone here using Honeybadger?
My Honeybadger account is being overwhelmed with noise from some bots. Seeing a lot of
Bandit.HTTPError...
New
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
Other Trending Topics
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
Hobbes is a low-level distributed database for the Elixir programming language.
Hobbes provides a simple, safe, and scalable storage lay...
New
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve.
They are GUI (Emerge) and State management (S...
New
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
There are three potential reasons for members of this forum to have a look at https://vutuv.de
You are tired or annoyed of LinkedIn.
Yo...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #blog-post
- #elixir-ls
- #ai
- #elixirconf-us
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming











Showing Posts 1 to 2- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
cmkarlsson
Umbrella apps is just a way to write OTP applications but in the same project. The alternative to umbrella apps is to have a regular OTP application but in a stand-alone repository. The other difference between a stand-alone OTP application and umbrella OTP application is that the umbrella applications are usually more coupled and depend on other applications in the umbrella. Therefore it is easier (according to some) from a project management point of view to have them all in the same project.
An OTP application is generally the same as a software library in another language, so they should have a clearly defined boundary to hide implementation. For erlang they also have their own supervision tree and can be started and stopped and upgraded as a unit (they don’t have to have a supervision tree, they can be a library as well).
Contexts are also a way to define clear boundaries between your code components. It is however orthogonal if they are in a separate OTP application or in the same.
Hence, a Context can be “moved” from one place or another if it makes sense from an OTP point of view. For example, initially you may have a module doing something like.
Event.schedule_event(...). Event is a context. Then you grow your application and you add caching, notifications and other fancy stuff inside the Event context, so much that it warrants its own supervision tree. Then you can “move” this context to another OTP application, which can be an umbrella application.hubertlepicki
Just a note for both of you: these are called umbrella projects. It still consists of multiple apps, that are sorta separated.
In fact, umbrella project is just a shared configuration + some sugar to allow running mix teasks from the top directory.
For the guidelines, I would say that if you have a Phoenix project, you want to have at least 2
appsin it (wrapped in an umbrella project or manually connected). One app is for the web UI, another one is for business logic, all your services etc. You might have another app for administrator panel UI too, so you end up with 2 UI apps (Phoenix) + one pure Elixir app (that has Ecto). You might also want to extract the database access layer to own app and move ecto there, but I do not think it’s required in most cases.Then, whenever you have a fairly stand-alone part of the system, for example a set of functionality that handles file uploads and processing: it makes sense to make it another app.
The rule of thumb when asking “if this should be an app or a module/namespace/context”, is this for me: “is it possible I will need to replace this thing as a whole in the future”? For UI front-end that might be “yes”, as the big re-design might happen. I might want to run 2 of UI interfaces in parallel in fact for some time, so it makes a lot of sense to make it an app. I might want to migrate from AWS to Google Cloud, so my file uploads app might also need to be replaced. I might have more than one admin panels, or replace it with something else like an API etc.
BTW, an API app might be a good idea to have too. It’s likely the API and UI will live their lives in parallel, and you might do very well with having an
ui,core,admin,uploadsandapiapps, for example.