terraphim / terraphim/terraphim-ai
[Research] Web Components State Management Patterns
Open
Nobody has claimed this yet.
architecture
research
web-components
- Dominant language
- Rust
- Stars
- 62
- Forks
- 5
- Avg merge
- 2h 27m
- Merged PRs (30d)
- 1
Description
Research Objective
Evaluate state management solutions for Web Components migration from Svelte stores.
Current State
- Using Svelte writable stores:
theme,role,configStore,input, etc. - Reactive data binding across 21 Svelte components
- Tauri integration for desktop app state
Research Questions
- How to replace Svelte stores with Web Components-friendly state management?
- Which state management library provides best TypeScript support?
- How to maintain reactivity without framework magic?
- Performance implications of different approaches?
Options to Evaluate
1. Custom State Manager (Proxy-based)
- Pros: Lightweight, full control, no dependencies
- Cons: Need to build observer pattern, debugging complexity
- Example: MobX-style Proxy observers
2. Redux + Web Components
- Pros: Battle-tested, great DevTools, TypeScript support
- Cons: Boilerplate overhead, learning curve
- Libraries:
@reduxjs/toolkit,redux-web-component
3. MobX
- Pros: Simple API, automatic reactivity, decorators
- Cons: Magic can be confusing, bundle size
- Libraries:
mobx,mobx-web-component
4. Lit Reactive Controllers
- Pros: Built for Web Components, lightweight
- Cons: Tied to Lit framework
- Libraries:
@lit/reactive-element
5. Zustand
- Pros: Minimal API, no Provider pattern, hooks-like
- Cons: React-focused, needs Web Components adapter
Acceptance Criteria
- Research document comparing all options
- TypeScript support evaluation
- Bundle size comparison
- Performance benchmarks (reactivity speed)
- Developer experience assessment
- Debugging tools availability
- Migration path from Svelte stores
- Recommendation with rationale
References
- Current stores.ts:
desktop/src/lib/stores.ts - Components using stores: Search, Chat, ThemeSwitcher, ConfigJsonEditor
Documentation
Findings will be documented in: .docs/research-state-management.md
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading desktop/src/lib/stores.ts and the Search, Chat, ThemeSwitcher, and ConfigJsonEditor components that use the stores. Evaluate the listed state-management options for TypeScript support, bundle size, reactivity performance, developer experience, debugging, and migration from Svelte stores, then document comparisons and a recommendation in .docs/research-state-management.md.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- tauri, typescript
- Domain
- desktop, documentation, frontend
- Issue type
- Documentation
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100