I had this question for a while doing some hobby projects in Elixir.
When comes to enterprise-level applications, code organization takes a crucial place.
In a large project I would love to keep related files together(group by domain).
like for example in NestJS im doing for user module
user
- models
--- user.model.ts
- jobs
--- user-cleanup.job.ts
- user.controller.ts
- user.resolver.ts
- user.service.ts
- user.service.test.ts
- user.module.ts
Now the best part is in UserModule I can import all the related services/controllers/resolvers and let DI initialize them for me without wiring logic in multiple files. (This may be not possible with Elixir as DI heavily use OOP concepts)
I really enjoy this because previously I used MVC which did not scale when the project was getting complicated. had to look up multiple files in different locations to do some tasks. But now instead I know exactly where the files should be and I don’t need to load them in multiple places.
Does anyone follows a similar pattern or are there any alternative scalable approaches we can use in the Elixir world?
Elixir is quite flexible on the architecture, and there is no relation between the location on the File System and the name of the modules. You can use multiple…
standard context structure
poncho architecture, promoted by @pragdave in his course.
There was a recent forum topic on exactly this point. However I’m having trouble finding it from search. Does anyone have a link to it? The poster ended up with a per-feature file structure if I recall correctly.
At risk of going off on a tangent, where does the idea that architecture is related to how source code is stored on the file system come from? This is not the first time I’ve heard it. Architecture is about runtime interactions and boundaries between components, regardless of which source file defined the components.
Yes, project layout conventions are very useful, especially on large teams, and they may somewhat reflect architectural patterns used in the project. It’s a fine topic to discuss. But I see it as clearly distinct from architecture.
Great. That is a benefit for future searches on the forum. However, if someone knows some university or bootcamp or language community (or other) that uses “architecture” in this way, I’m still quite curious of the root source of it.