How I structure Elixir projects

When I start an elixir project I structure the content in the lib directory a little differently.

lib Directory

DirectoryContent
dalThe Data Access Layer. Where the business logic all sits
dbThe Db Layer. Where all the database models and schema's sit. This is just the data formats and model validations. Any complex of multi model logic is in the dal
execBackground jobs. Jobs move between systems via RabbitMQ or scheduled using the quantum library
i13nInstrumentation & observability. Without this I would be guessing how everything is running
mailerEmail building, addressing and sending. This is for email sent from support@folioready.com. Emails can also be sent via a service
serviceExternal services that I connect
utilLibs that are all self contained. If they need logic from the databases of services then they are moved to the dal
webThe FolioReady website

lib/web Directory

DirectoryContent
componentsUI components
controllersWebsite and API endpoints
helpersWeb functions for reading parameters and writing responses
hooksEmbed logic into the socket as part of the LiveView lifecycle
liveLiveView code
plugsPhoenix middleware
routersI break the routers into smaller responsibilities
socketWe use sockets to connect to embedded html components embedded into client websites. And sockets used by LiveView