The tiniest, fastest reactive state library with auto-tracking magic
2.49 KB β’ 2.97x vs Solid β’ Auto-tracking β’ Zero config
Core Package β’ Framework Integrations β’ Utilities β’ Quick Start
Zen is a revolutionary reactive state management library that combines extreme minimalism with magical auto-tracking. Built for modern applications, Zen provides the smallest bundle size without sacrificing performance or developer experience.
The Problem:
Traditional state libraries:
- Large bundle sizes β
- Manual dependency tracking β
- Verbose APIs β
- Poor performance β
The Solution:
Zen:
- 2.49 KB gzipped β
- Automatic dependency tracking β
- Clean, unified API β
- Blazing fast performance β
Result: Minimal footprint, maximum performance, zero configuration.
| Feature | Description | Benefit |
|---|---|---|
| Ultra-tiny | Only 2.49 KB gzipped (v3.8) | Minimal bundle impact |
| Lightning fast | 2.97x slower vs Solid.js | Competitive performance |
| Zero overhead | Auto-tracking with minimal runtime cost | Optimal performance |
.value everywhere, no get()/set()npm install @sylphx/zen
# Install framework integration
npm install @sylphx/zen-react
# or
npm install @sylphx/zen-vue
# or
npm install @sylphx/zen-svelte
@sylphx/zen-patterns - NEW v2.0 π
@sylphx/zen-router & @sylphx/zen-router-react & @sylphx/zen-router-preact
# Install utilities
npm install @sylphx/zen-patterns # NEW! Useful patterns
npm install @sylphx/zen-craft
npm install @sylphx/zen-persistent
npm install @sylphx/zen-router-react
import { zen, computed } from '@sylphx/zen';
// Create reactive state
const count = zen(0);
// Auto-tracked computed value (no manual dependencies!)
const double = computed(() => count.value * 2);
// Update state
count.value++;
console.log(double.value); // 2
import { useZen } from '@sylphx/zen-react';
import { zen } from '@sylphx/zen';
const counter = zen(0);
function Counter() {
const count = useZen(counter);
return (
<div>
<p>Count: {count}</p>
<button onClick={() => counter.value++}>Increment</button>
</div>
);
}
import { store, computedAsync, map } from '@sylphx/zen-patterns';
// Zustand-style store pattern
const counter = store(() => {
const count = zen(0);
return {
count,
increase: () => count.value++,
decrease: () => count.value--
};
});
// Async state management
const user = computedAsync(async () => {
const res = await fetch('/api/user');
return res.json();
});
// Key-level reactivity for objects
const form = map({
name: '',
email: '',
age: 0
});
import { persistent } from '@sylphx/zen-persistent';
// Automatically synced with localStorage
const settings = persistent('user-settings', {
theme: 'dark',
language: 'en'
});
// Changes are automatically persisted
settings.value.theme = 'light';
| Library | Size (gzipped) | Difference |
|---|---|---|
| Zustand | 1.2 KB | Baseline |
| Zen v3.8 | 2.49 KB | +108% |
| Jotai | 3.0 KB | +150% |
| Valtio | 5.5 KB | +358% |
| Redux Toolkit | 12+ KB | +900% |
| Library | Performance | Auto-tracking | Computed |
|---|---|---|---|
| Solid.js | 1x (baseline) | β Yes | β Yes |
| Zen v3.8 | 2.97x slower | β Yes | β Yes |
| Zustand | Manual tracking | β No | β No |
| Valtio | Auto (Proxy) | β Proxy | β No |
| Redux | Manual tracking | β No | β No |
zen/
βββ packages/
β βββ zen/ # Core library
β βββ zen-react/ # React integration
β βββ zen-vue/ # Vue integration
β βββ zen-svelte/ # Svelte integration
β βββ zen-preact/ # Preact integration
β βββ zen-solid/ # SolidJS integration
β βββ zen-craft/ # Immutable utilities
β βββ zen-persistent/ # Persistence utilities
β βββ zen-router/ # Core routing
β βββ zen-router-react/ # React router
β βββ zen-router-preact/ # Preact router
βββ docs/ # Documentation site
βββ package.json
βββ README.md
# Install dependencies
pnpm install
# Build all packages
pnpm build
# Run tests
pnpm test
# Watch mode
pnpm test:watch
# Type checking
pnpm typecheck
# Linting
pnpm lint
pnpm lint:fix
# Build specific package
pnpm --filter @sylphx/zen build
# Test specific package
pnpm --filter @sylphx/zen test
# Dev mode for all packages
pnpm dev
Each framework package provides idiomatic bindings:
useZen() hookSee individual package READMEs for detailed documentation.
import { state, computed } from '@sylphx/zen';
const user = state({ name: 'Alice', age: 30 });
const isAdult = computed(() => user.value.age >= 18);
const form = state({
email: '',
password: ''
});
const isValid = computed(() =>
form.value.email.includes('@') &&
form.value.password.length >= 8
);
const theme = persistent('theme', 'dark');
const sidebar = state({ open: false });
const modal = state({ show: false, content: null });
| Component | Technology |
|---|---|
| Language | TypeScript 5.9 |
| Package Manager | pnpm |
| Monorepo | pnpm workspaces + Turbo |
| Testing | Vitest |
| Bundling | tsup |
| Linting | Biome |
| Documentation | VitePress |
Contributions are welcome! Please follow these guidelines:
git checkout -b feature/my-featurepnpm lint# 1. Install dependencies
pnpm install
# 2. Make changes to packages
# 3. Build and test
pnpm build
pnpm test
# 4. Lint and format
pnpm lint:fix
pnpm format
# 5. Create changeset
pnpm changeset
# 6. Commit and push
git commit -m "feat: add new feature"
git push
MIT Β© Sylphx
Built with:
The tiniest, fastest reactive state library
2.49 KB β’ 2.97x vs Solid β’ Auto-tracking magic
sylphx.com β’
@SylphxAI β’
[email protected]