Hey everyone! π
I'm trying to establish a clean, reusable feature-based architecture for React/TypeScript apps , especially when using Zustand + TanStack Query .
I'm working on a visual editor that fetches documents from an API, initializes a Zustand editing session, and will eventually handle canvas state, selection, history, saving, etc.
I'm considering this structure:
features/editor/ βββ components/ βββ hooks/ βββ store/ β βββ editor-store.ts β βββ editor-store-provider.tsx β βββ slices/ β βββ document-slice.ts β βββ selection-slice.ts β βββ history-slice.ts βββ queries/ βββ domain/ ? βββ utils/ ? βββ lib/ ? βββ services/ ?
I'd love to know how you handle a few things in production:
API / queries: Where do raw API functions go? Do you separate them from TanStack Query options/hooks? Do you organize queries by feature or shared domain?
Zustand: Do you keep providers alongside stores?β¦