Store Architecture: Feature Modules
Organize stores into feature modules with encapsulated actions and selectors.
Why Feature Modules
Large apps benefit from organizing stores by feature: cart/, auth/, orders/.
Each Module Exports
Each module exports state, derived values, and actions for that feature.
// $lib/cart/store.js
export const items = writable([]);
export function add(item) { items.update(i => [...i, item]); }All lessons in this course
- Store Architecture: Feature Modules
- Event Bus Pattern with Stores
- Optimistic UI Updates
- Undo/Redo with Store History