Architecting Domain Logic vs. Just Coding UI
I was playing around with Omit and Partial to handle create and update inputs. It’s a small detail, but it’s the only way to prevent the caller from accidentally overwriting fields that the service should strictly own. Without these constraints, your data flow becomes a guessing game.
I also had to rethink my repository pattern. I realized that while my services express the actual behavior, the repositories should strictly manage data retrieval. I used generics for helpers like findById and filterByProperty, and typed everything with Promise<T> to keep the async flow predictable.
I ran into a bit of a bottleneck when trying to load data in parallel. I initially tried using Promise.all for independent requests, but I had to pivot to a staged loading approach because certain data points were dependent on earlier results. It's a subtle distinction, but getting that async logic right now prevents a massive headache when I eventually swap out my seed data for a real database.
The goal is to have a rock-solid domain layer before a single component is rendered. Next up is writing the tests to ensure this entire architecture actually holds up under pressure.