AstonJ
June 10, 2017, 3:44pm
1
Wonder if we can compile a list of learning resources, blog posts, talks, threads etc to help those who are just learning about Contexts.
This is a wiki - so please add anything you feel is missing…
What are Phoenix Contexts?
In short:
Phoenix Contexts are just dedicated modules that expose and group functionality.
In depth:
Books
Programming Phoenix - due to be updated for Phoenix 1.3.
Screencasts
Talks
Blog Posts
The recent changes around Phoenix 1.3, especially the introduction of contexts, seem to be confusing for many - I decided to write a bit more about my perspective on this, and hopefully, remove a bit of the confusion.
The initial draft of this post...
https://panache.nu/blog/giving-phoenix-contexts-some-context
https://blog.jakewilkins.com/2017/06/23/working-with-phoenix-1-3-directory-structure-a-love-story/?utm_content=buffer4c74b&utm_medium=social&utm_source=twitter.com&utm_campaign=buffer
http://www.resurgens.io/2017/06/26/phoenix-1-3.html by @dlively (thread )
Understanding the concept of a context in Phoenix (2017-08-16)
Threads
As promised, the first release candidate of Phoenix 1.3.0 is out! This release focuses on code generators with improved project structure, first class umbrella project support, and scaffolding that re-enforces phoenix as a web-interface to your greater Elixir application. We have also included a new action_fallback feature in Phoenix.Controller that allows you to translate common datastructures in your domain to valid responses. In practice, this cleans up your controller code and gives you a si…
I am just trying to migrate my project to Phoenix 1.3 with new contexts mechanism. But I am not sure how I should split my schemas into this contexts. I read a lot about DDD and UL/Bounded Contexts in last few days, but all examples using something like large ERP systems. Also in DDD contexts used to “namespace” UL (ubiquitous language) within this contexts like Sales/Support/Analytics, etc. where Product will be used.
At other side @chrismccord used blog (post, comments) example in his ElixirC…
Hi,
I have trouble understand how context should be used.
Let say that I run :
> mix phx.gen.html Accounts User users email:string:unique password_hash:string is_admin:boolean
This will create the User structure under the Accounts context, which means that it will create 2 files, accounts.ex and user.ex.
My question is what kind of function should be put respectively in account.ex, and in user.ex ?
Let say for exemple that I want to hash the password while registration. With the previous v…
Hi everyone
As all of you might know, Phoenix 1.3 comes with a new folder structure and introduces contexts/ API boundaries. I’m now trying to move my application to 1.3.0-rc.0, but I have some problems to find my contexts. I can see how it works for simple things like a blog, but as soon as things get more complicated, I’m lost. I’ve searched the web a bit, but couldn’t find anything helpful.
My application will be used by two groups of users, and I might eventually split it in…
I think the new structure and general advise around contexts in 1.3 is excellent. Putting persistence behind functional interfaces really makes sense to me. I’d like to understand contexts a little more for this use case:
In 1.2 I had three models (as well as other standard account/user type functionality).
App.Competition # has_many :games
App.Team # has_many :games
App.Game # belongs_to :team, :competition
Now thinking in terms of contexts I was going to go with a kind of top level context …
I’m building an app in Phoenix 1.3 and I’m struggling with decisions related to contexts. Specifically, I don’t understand how user schemas in multiple contexts should interact with auth.
I’m using Guardian for authentication and overriding controller __action__ to pipe around my current_user to my controller actions as an additional argument.
def new(conn, params, current_user) do
end
Above, current_user is fetched from Guardian and loaded into assigns using a router plug.
When I started wr…
And more:
https://elixirforum.com/search?q=contexts
Misc
16 Likes
Linuus
June 10, 2017, 3:51pm
2
Added a blog post by @michalmuskala
1 Like
There is an example phoenix 1.3 application, with contexts and absinthe here
https://seanclayton.me/post/phoenix-1-3-and-graphql-with-absinthe/?utm_source=hashnode.com
Which obviously is inspired by this one
It is a full example, easy to follow on how contexts can interact.
2 Likes
AstonJ
June 10, 2017, 5:19pm
4
I added a link to your post in the wiki
AstonJ
June 12, 2017, 10:49pm
5
Added a blog post by @Qqwy
2 Likes
AstonJ
June 14, 2017, 1:04pm
6
Added @chrismccord ’s ElixirConf EU Keynote talk
1 Like
AstonJ
July 3, 2017, 1:56pm
10
http://www.resurgens.io/2017/06/26/phoenix-1-3.html
by @dlively (EF thread )
Since this is an app I built in order to further my education, I opted to venture out on the bleeding edge and use Phoenix 1.3.0-rc. Don’t let the what seems like a minor version change fool you. While there are no real breaking changes or significant new features being introduced in 1.3, alterations to the directory structure and new code generators introduce a seismic shift in how a developer approaches a Phoenix project. Chris McCord provides an overview of these changes in the Lonestar Elixir keynote address, his Elixir Forum post, and his more recent ElixirConf EU keynote. Those were all essential for me to getting started, but I found the concepts easier to grasp once I began building my project…
1 Like
Building beautiful systems with Phoenix contexts. Andrew Hao - ElixirDaze 2018 (March 1,2)
Worth watching. 'nuff said.
8 Likes
thanks @peerreynders really nice video. I was feeling overwhelming about modules, functions… Looking a app from big picture really opened my mind. I feel like i found missing puzzle. Especially User in different contexts section. Since long time i was searching informations for designing apps.
Great article by @devonestes suggesting some rules to guide the design of Contexts:
http://devonestes.herokuapp.com/a-proposal-for-context-rules
Recommended to me by João Brito of @Plataformatec .
3 Likes