zporter

zporter

40) ElixirConf US 2018 – Breaking Down the User Monolith – Zach Porter

ElixirConf US 2018 – Breaking Down the User Monolith – Zach Porter

Coming from Ruby on Rails, the convention is to have a User model handle multiple aspects of an account such as login, logout, password reset, and email confirmation. While there is a temptation to bring that convention with us when building an Elixir application, we can do better by leveraging bounded contexts, Ecto’s embedded schemas, and Ecto.Multi to break these separate pieces of functionality into isolated chunks that are easier to maintain and extend.

Audience: Beginner, Intermediate

All talks are available in the ElixirConf US 2018 Talks List or via the elixirconf2018 tag

Most Liked

zporter

zporter

Hey! Thanks for your interest in my talk!

Quick answers to your questions:

So, for that reason I’ll ask, if somebody have a github repo of this talk.

Not yet, but I am planning on finishing one that I started to accompany this talk. I can post here when it’s ready.

The trouble that I have is with the embedded_schema. Because I was watching the video and it’s seems to be incomplete, he don’t explain how to declare the structure for the user schema, using something like embedded_one and also he don’t show how can we create the migrations for that embedded field.

The example I gave using embedded_schemas was around Registrations. I apologize if it wasn’t clear, but I’m not actually persisting that embedded schema to the database. I’m using it to provide structure to a form or a set of user inputs and to manage changes and validations for those inputs. I’m then relying on the existing User schema as well as the Credential schema to persist to the relevant tables in the database. I hope that helps to clear the example up some! The embeds_one and embeds_many functions are very useful for storing in a JSON column in the database, and I’ve certainly done that before, but not in this case.

If you have any further questions, please let me know.

Thanks!

Yamilquery

Yamilquery

Hi guys! First of all, thank you so much for this ElixirConf 2018, was really awesome!

I was watching the ElixirConf 2018, specifically a video “ElixirConf 2018 – Breaking Down the User Monolith – Zach Porter”, in which he explains how to breaking down the User monolith. But I had a couple of doubts with it, and it seems to they disable the comments section in Youtube.
So, for that reason I’ll ask, if somebody have a github repo of this talk.

I was trying to replicate the exposed approach, but I got some errors.

The trouble that I have is with the embedded_schema. Because I was watching the video and it’s seems to be incomplete, he don’t explain how to declare the structure for the user schema, using something like embedded_one and also he don’t show how can we create the migrations for that embedded field.

I found a tutorial to do that thing, but I’m not pretty sure if it’s the best practices.

https://robots.thoughtbot.com/embedding-elixir-structs-in-ecto-models

Thank you so much!

Where Next?

Popular in Talks Top

axelson
Let’s Talk Process Dictionary - @gregvaughn Well, the first rule of Fight Club, I mean: process dictionary is that we don’...
New
axelson
ElixirConf US 2018 – Meet Virtuoso: The Chatbot Orchestration Framework Built with Elixir – Justus Eapen (@justuseapen) ...
New
ShalokShalom
So, there is another Erlang VM on the way :hugs:
New
Lawrence_elixir
@keathley - Senior Engineer Bleacher Report and Elixir Outlaws presenter Talk: Building Resilient Systems with Stacking Talk in three w...
New
CodeSync
Code Sync: Keynote: The Road To LiveView 1.0 by Chris McCord | ElixirConf EU 2023 Comments welcome! View the <span class="hashtag-icon-p...
New
ElixirConf
ElixirConf: ElixirConf 2023 - Charlie Holtz - Building AI Apps with Elixir Comments welcome! View the <span class="hashtag-icon-placehol...
New
axelson
ElixirConf US 2018 – Building Video Chat with Elixir &amp; Phoenix – Anil Wadghule (@anildigital) In this t...
New
axelson
ElixirConf 2017 - Closing Keynote - @chrismccord All talks are available in the Elixir Conf 2017 Talks List o...
New
axelson
ElixirConf US 2018 – Docker and OTP: Friends or Foes? – Daniel Azuma (@dazuma) Docker is the hot deployment...
New
axelson
ElixirConf 2017 - Building Realtime Mobile Apps with React Native and Elixir - Osayame Gaius Obaseki Buildin...
New

Other popular topics Top

axelson
This post is a wiki (feel free to hit the edit button near the bottom right of this post to add your own changes!) This post collects co...
239 48475 226
New
TunkShif
This post is an instruction guide to help you setup your Neovim for Elixir development from scratch. It includes general information on h...
274 42158 114
New
Harrisonl
We have an ECS cluster with 4 services, where each task joins a single cluster, via discovery ECS discovery service. Currently when I de...
New
lastday4you
I wanted to check elixir version in phoenix because i found that my elixir is 1.5 but when i use Enum.chunk_by it said the function is un...
New
jononomo
I am trying to figure out how Mix knows whether the environment is test, dev, or prod – where is this set? Thanks.
New
josevalim
Hi everyone, One of the features added to Elixir early on to help integration with Erlang code was the idea of overridable function defi...
New
Lily
In templates/appointment/index.html.eex: &lt;%= for appointment &lt;- @appointments do %&gt; &lt;tr&gt; &lt;td&gt;&lt;%= appoi...
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
RisingFromAshes
I’ve read in another post that it may be possible with a router helper - but I couldn’t find an appropriate one, and tbh, I’m still just ...
New
bsollish-terakeet
Credo is smart enough to check for (something like) this: assert length(the_list) == 0 with this response: Checking if an enum is empt...
New

We're in Beta

About us Mission Statement