kuon
I have read many discussions on the forum about this topic, but I still have a few “wonderment”.
Basically, my folder structure (module name) is:
lib/my_app
├── account MyApp.Account
│ ├── access_tokens.ex MyApp.Account.AccessTokens
│ ├── roles.ex MyApp.Account.Roles
│ ├── users.ex MyApp.Account.Users
│ ├── schemas
│ │ ├── access_token.ex MyApp.Account.AccessToken
│ │ ├── role.ex MyApp.Account.Role
│ │ ├── session.ex MyApp.Account.Session
│ │ ├── user.ex MyApp.Account.User
The MyApp.Account module is mostly composed of defdelegate that forward to submodules, like MyApp.Account.Users. Code outside of account folder can only interract with the MyApp.Account module.
The files in schemas are just ecto schemas. I removed the Schema in the module name, because it’s a bit long and doesn’t bring anything.
Now, I am quite happy with this, but I have an issue with the plural names MyApp.Account.Users for example.
It is a bit hard to spot in the filesystem and when searching for the file.
I was wondering if you had suggestions for a suffix.
Like MyApp.Account.UserContext or MyApp.Account.UserManagement … (those two does not convince me).
Trending in Discussions
Other Trending Topics
Latest Phoenix Threads
Chat & Discussions>Discussions
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #blog-post
- #phoenix_html
- #ai
- #iex
- #graphql
- #elixirconf-us
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming










Showing Posts 1 to 3- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
christhekeele
I know they’re not super common in instructional material, but I find pluralized module names to be quite useful. They’re not that uncommon in Elixir projects!
stefanchrobot
I don’t have that many functions, so I keep all user and account related ones in the
Accountscontext. It makes sense to me since there is a lot of coupling between the schemas in this context. The downside is that theaccounts.exfile is getting big-ish.kuon
Yeah there is a lot of coupling beween everything is
Accountthat’s why I did split it withdefdelegatebut ideally, theAccount.Usersmodule should not exist. But I it does because otherwiseAccountbecomes way too big to manage.