JoeZMar

JoeZMar

Separating the DB in an Umbrella project

I am making my first umbrella project right now and I want to separate the database into it’s own application. I am trying to understand how to appropriately break up an umbrella project.

Here is what I am thinking so far:

My app has two web interfaces: user_web & admin_web

In addition I have an app to handle the backend logic: app

Right now my two web interfaces talk to the one backend logic app that I plan on connecting the rest of the micro-service apps to.

Here is where things get dicey for me. I’ve seen a few videos where the app was broken down even further into several micro-services. I haven’t found a decent/modern example that shows how small these micro-services should be. If I was adding authentication to my app I could create a micro-service for Authorizing users and have that as a separate app. I feel like I kind of understand this concept (or can at least figure it out) until I started to introduce the concept of separating the database.

From what I’ve read it seems like creating a separate application to serve the database logic is the way to go and have that app connected to the only database in the umbrella project. Does that mean when I introduce the ability to create users within my umbrella project the schema is stored within the database logic app or the app responsible for implementing the users?

I think if I understood the layer that manipulates the database application and how it i should implement the db api I can figure out how each piece of my app should fall together.

My app is eventually going to be very large including several services for different agencies and a few different native mobile applications so I really like the idea of having well thought out applications that are small and functional so they can be easily plugged into our future apps we create.

Most Liked

mbuhot

mbuhot

One of the great features of Ecto is that the schema structs don’t need to map directly to tables. This allows each umbrella app to manage its own schemas, and the shared DB app just defines the repo module, migrations and configuration.

cohawk

cohawk

The CaptainFact API might be a good example project for what you are trying to accomplish.

mbuhot

mbuhot

Not sure if create_record is a great example, since there’s usually Changeset validations associated with record creation.

But other generic helpers like adding Pagination clauses to a Query, or multi-tenancy concerns might belong in a DB application.

I’d avoid wrapping the Repo API, since a Repo is already a fine DB abstraction layer. :slight_smile:

Where Next?

Popular in Questions Top

New
tduccuong
Hi, is there any work on GUI with Elixir, that is similar to Electron/Javascript? My idea is to bundle Phoenix and BEAM into a single se...
New
minhajuddin
I have seen a lot of code which picks the first element from a list using Enum.at(0) instead of List.first. Is there a reason why people ...
New
stefanchrobot
What’s the safe way to decode a JSON string into a struct? I want to avoid calling String.to_atom. Jason.decode can give me a map with st...
New
vrod
I am using the Starship cross-shell prompt – it seems pretty nice, but I get some errors: [WARN] - (starship::utils): Executing command ...
New
vonH
When I run the Plug and I recompile I wind up having to use Ctrl C to quit iex and start again. Witht the help of rlwrap I can use the cu...
New
freewebwithme
Using vs code and installed ElixirLS: support and debugger. And I got an error popped up on start up says Failed to run ‘elixir’ comma...
New
script
If I have a string “1000 cfu/ml” . I want to remove the characters and / and space . So the string is like this "1000" What is the ...
New
dblack
I’ve got an issue with an app and I’ve no idea of how to troubleshoot it. I’m hoping someone here might have seen something similar. I p...
New
nsuchy
Hi. I’ve noticed that Windows Powershell has it’s own IEX command and you cannot access Elixir’s IEX due to the conflict. This isn’t a cr...
New

Other popular topics Top

malloryerik
Hi, this is for people who, like me, have had some friction using .html.heex templates in VSCode. The solution seems to be, in a hyphena...
New
sorentwo
Hello! tl;dr Announcing Oban, an Ecto based job processing library with a focus on reliability and historical observability. After spen...
985 42920 311
New
Patoshizzle
After calling mix ecto.create I get this error: 17:00:32.162 [error] GenServer #PID<0.412.0> terminating ** (Postgrex.Error) FATAL...
New
minhajuddin
I have seen a lot of code which picks the first element from a list using Enum.at(0) instead of List.first. Is there a reason why people ...
New
msaraiva
Surface is an experimental library built on top of Phoenix LiveView and its new LiveComponent API that aims to provide a more declarative...
564 43622 214
New
hariharasudhan94
lets say i have a sample like a = 20; b = 10; if (a > b) do {:ok, "a"} end if (a < b) do {:ok, b} end if (a == b) do {:ok, "equa...
New
freewebwithme
Using vs code and installed ElixirLS: support and debugger. And I got an error popped up on start up says Failed to run ‘elixir’ comma...
New
ashish173
I am using Ecto timestamps with postgres, I can see the timestamps() use the :naive_dateime but for my use case I wanted to store the ti...
New
KronicDeth
Elixir plugin for JetBrain’s IntelliJ Platform (including Rubymine) This is a plugin that adds support for Elixir to JetBrains IntelliJ...
289 36128 110
New
Qqwy
Update: How to use the Blogs & Podcasts section You can post links to your blog posts or podcasts either in one of the Official Blog...
3271 126479 1222
New

We're in Beta

About us Mission Statement