ngw

ngw

Hi, I’m trying to figure out if I should start building an umbrella app or not.
The app is going to be 90% a SPA, meaning that I don’t exclude having something (visually functionally) outside that single page but most of it will be some kind of image annotation program and a bunch of forms all built with Elm.
The app will need to authenticate against a RoR Oauth provider, the frontend will communicate with the backend through an API, everything will be backed by a PostgreSQL database.
Without writing a single line of code I see a backend to fetch and write data, an api endpoint, and a rich frontend app serving Elm + HTML.
Seems to me that it could be a Phoenix app or an umbrella app and that both approaches kinda fit, I’m looking for a recommendation.

TIA,
ngw

Showing Posts 1 to 2

amnu3387

amnu3387

I’ve used both umbrellas and regular one app settings. I’m developing a game (quite developed by now) in a phoenix only setup, serving a vue app and it has been great. I’ve done an umbrella controlling chrome headless browser bots with success and I’m now working on an application where I decided again to use an umbrella. In fact stretching it a bit more and using only phoenix as api’s apps, while the nuxt front-end is outside of the phoenix app (which allows to deploy the front-end to something like now) and then the backends to their cloud servers. I’m not sure yet if I’ll use docker to containerise the apps (building with distillery) or just use plain releases to deploy them.
Either way, this is the structure I’ve been using so far, and I’m really enjoying how it’s coming together:

It’s a single repo, ~_nuxt_frontend is the nuxt app, npm-packages-offline-cache are the tar balls for yarn dependencies and in the apps, db_main & db_msl are ecto apps, admin_api and main_api are phoenix apps (with --no-brunch --no-ecto, and only have html because I needed a way to render email templates, and didn’t find a good way of extracting that without creating another phoenix app - probably there’s a way (simple) though), csv_parser and `records_builder are --sup applications and the remaining plain apps without supervision trees. The admin_api has dependencies on both ecto apps, while the main_api only has on db_main.

I think in the end it boils down to what you need. A phoenix only app is certainly more than enough for a lot of use cases. An umbrella app is also quite a good choice for more complex situations and handles simpler situations just as fine. What I think is a plus of umbrellas is that you can sort of “package” your different parts of the “system”, even if its all to be deployed as a “single system”. If you intend to deploy multiple apps as independent systems though then an umbrella makes it much easier. And in this particular case, it makes everything (even disparate systems such as node/vues-nuxt fit in the same repo)

(and when I say umbrella I just mean independent apps, as far as I know there’s other approaches that don’t require to be declared as an umbrella and instead mimic what the umbrella does by linking the apps & dependencies in a regular way - it has been pointed here on the forum’s a lot of times pragdave’s approach, which I think that at a conceptual level matches the idea of an umbrella but is done manually without the auto-gluing of the --umbrella).

MrDoops

MrDoops

A Phoenix app can be a great way to start. The generators and pre-made configuration setup for ecto, schemas, contexts, controllers, etc. is great for productivity. That being said if you’re really want to separate concerns you might break the application up into smaller pieces; particularly the Ecto/Context and OAuth concerns in the typical Phoenix CRUD application. It will take more initial setup to break things up nicely in an Umbrella, and if you’re new to the Elixir ecosystem, you’re probably best served remaining within Phoenix’s gentle embrace.

What I’d do with the Umbrella is build a separate application for the OAuth concerns and integrate it with the Phoenix app using a plug. Then if you’re using Ecto for PostgreSQL, build another mix application for the the query and persistence logic. Ecto can sometimes be confusing to setup to the degree of convenience you have with Phoenix, so I like to use something like mix generator to help with getting the various environments setup for testing and what-not. Using the mix generator to setup an Ecto application will give you maybe 60% of the convenience Phoenix gives you as you’ll still need to hand-write schemas and migrations (no handy mix phx.gen.context/JSON commands).

Breaking things up into small applications naturally lends itself to isolated testing and decoupled components.

Depending on how separate you want your concerns you can build another application that supports the primary business logic that contains some sort of command-layer API. This is just personal preference. I like to have command and query separation; this allows having a stateful core application that doesn’t know about Ecto (it uses only the public API in the persistence application). This gives you a very natural way to build out. When you find another piece that doesn’t quite fit, just mix new my_app --sup and do your thing.

But again. It’s not that hard to rebuild into an umbrella, but there is more surface area to know up front - it will slow you down if you’re just starting. I recently refactored a Phoenix application into an Umbrella just a few days ago and it went fine. If you design your Contexts well - it’ll be a breeze. Prioritize productivity and get moving fast - Phoenix’s conventions will serve you well. Momentum shouldn’t be understated.

— All posts loaded —

Where Next? Top

Trending in Questions Top

katta
I having some trouble figuring out if I have set myself too strict of standards for my production server. Currently I can handle 75% of r...
New
achenet
Hello, I’m trying to build a basic Phoenix web-app, and I’d like to use Tailwind. However, when I launch mix phx.server, I get an error...
New
Cxx-mlr
I’m working on a small exercise involving update_in/3, and I came up with this solution: data = %{ name: "Periodic Table", category:...
New
ChrisAmelia
I’ve got trouble wrapping my head around the order in which functions are called in this snippet (from Phoenix’s authentication): toke...
New
dillonoconnor
Is there any way to avoid the Hologram compiler running when using iex? It seems like the front-end code could potentially be disregarded...
New
thiagogsr
** (ArgumentError) expected :max_attempts to be a positive integer, got: {:@, [line: 10, column: 19], [{:max_attempts, [line: 10, column:...
New
unaware8150
Hello folks! So at work, we are seeing some situations where we have to define some “fixed” strings that are used across the codebase in...
New

Other Trending Topics Top

GenericJam
Edit: 2026 May 15 - This post is archived. Mob is alive!! Main docs: mob v0.7.11 — Documentation A bit of explanation for the slightly c...
New
mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
garrison
Hobbes is a low-level distributed database for the Elixir programming language. Hobbes provides a simple, safe, and scalable storage lay...
New
budgie
A little off-topic, but I feel like people here have a good head on their shoulders. I used to be quite good at making software. Was luc...
New
KristerV
Hey. Is there anyone here who creates agents in their apps? Not talking about using agents, but creating them. I’m finding it pretty diff...
New
mcass19
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews