How to structure a Elixir application?

Do you have any tips or links on how to structure a Elixir application? I’m keen towards a more feature based separation instead of type based (controllers, models, …). But I never did any big project in Elixir so everything is still a question for me.

1 Like

Maybe this topic can help you How to structure a large live view app? - #19 by eahanson

1 Like

Phoenix contexts are loosely based on Bounded Contexts from Domain Driven Design. DDD is a huge topic with many concepts but you don’t actually need to learn them all, you can pick and choose. I’ve worked in a company that successfuly employed DDD—bounded contexts were the part that clicked most for me (at least of the more in depth topics), so that was a big draw of Phoenix for me.

Very loosely. I reread the docs two weeks ago and I feel like they’ve toned down some of the initial guidance. I would now summarize their main thrust as, “Don’t put business logic in your controllers.”

Yes, indeed very loosely. I wouldn’t even say this is recent. This makes me realize I should have framed my comment more like: “If you wanna check out Bounded Contexts then maybe you’ll gain some insight into Chris’ thinking which you can then take or leave.” It’s what I get for checking Elixir Forum and trying to respond in the 5 mins before my rice was done cooking.

2 Likes

Definitely. Ultimately all the stuff like “models”, “controllers”, “views” and what-have-you are just artifacts of our own imagination; artificial constructs that help us think about a problem better. But, hm, they don’t fit the brains of all of us that well though.

I’ve voiced ideas – one that I never acted on for now – that framework artifacts should live in entirely different directories even. Maybe one day I’ll try. Though with having a library like boundaries that becomes a semi-moot point.

1 Like