Hi everyone I’m making a video on making a Twitter clone w/ phoenix 1.7, and I was wondering how’d best to structure the context here’s what I got, but I’m not too sure.
To echo @sergio, definitely call them tweets and not posts to keep the domain language aligned. I also think their suggestion is solid. I would also consider:
...
/timelines
/entry.ex
timelines.ex
...
It doesn’t have to be Entry but Timeline to me reads like the “master list of entries belonging to a user” whereas Entry would be the linking table between User and Tweet (and stuff like ordering and other metadata). If Timeline is the master list, then you still need Entry (like maybe holds info on how a timeline is managed for a specific user… I dunno… I honestly don’t know very much about twitter). It all depends on how you draw the relationships.
I would also consider making Likes its own context. If things other than tweets can be liked, this makes it more reusable as a polymorphic app-level context. Otherwise, I would do this: