hi I just saw this. do you ever have
hi I just saw this. do you ever have problems with circular dependencies? or are you preventing imports from other table directories?
8 Replies
Haven't had any circular dependency issues, what are you seeing?
I’m using a 3-layer setup right now (repo-service-workflow), so no circular dependency issues. But I’m open to simplifying my codebase
I’m curious with your approach. Do the read(or write) files import from each other?
No they both technically read
For example, say inside
user/read.ts I want to implement getUserWithLatestPost, which would require pulling data from post/read.ts. In cases like that, do you allow cross-imports between folders, or do you handle it differently to avoid circular dependencies?
by circular I mean in post/read.ts, I might want getPostWithAuthor, which would require pulling from user/read.tsAh I see - yes, I import from the other files in those cases. post.ts or post/*.ts would be the only files that touch the post table directly.
I have found that splitting into read/write/etc is only worthwhile when you have a lot going on, fwiw. Most of my tables are single file, with all reads, writes, etc in one file.
got it.
what about your queries and mutations (convex functions); do you keep em thin or is the orchestration/business logic going in there?
That’s where all the business logic is, yeah, they can get pretty big
Alrighty thanks for the responses I got me some ideas to try 💪