Zustand

A small, fast React state management library with a hook-based API and no boilerplate.

Library
npm
v5.0.15
58,583stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
82/100Excellent
Development Activity80
Maintenance84
Community64
Maturity60
Momentum40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
90/100Excellent
Architecture90
Code Quality85
Innovation88
Learning Curve95

Zustand is a minimal state-management library for React (and vanilla JS) built on simplified flux principles. It exposes a single create() function that returns a hook-shaped store — no context providers, no reducers, no action-type boilerplate — while still supporting selectors, middleware, and fully-typed TypeScript usage for larger applications.

Under the hood it is a closure-based store with a listener set, wrapped by a thin adapter over React’s useSyncExternalStore, which keeps the runtime tiny while remaining framework-agnostic at its core (the vanilla store can be used entirely outside React).

What You Get

  • A create() API that returns a ready-to-use React hook backed by a vanilla, framework-agnostic store
  • Selector-based subscriptions so components only re-render when the slice of state they read changes
  • Official middleware for persistence (persist), Redux DevTools integration (devtools), Immer-based immutable updates (immer), and combining reducers (redux, combine)
  • A separate vanilla entry point for using the store outside React (vanilla JS, other frameworks, or server-side logic)
  • Full TypeScript support with typed middleware composition via StateCreator generics

Common Use Cases

  • Replacing prop drilling or React Context for shared UI state (modals, theming, auth session) without a provider tree
  • Mid-sized to large React apps that want Redux-like predictability (single store, explicit updates) without Redux’s boilerplate
  • Persisting user preferences or session state to localStorage/AsyncStorage via the persist middleware
  • Sharing state between React and non-React code (e.g. a vanilla JS widget or a Node script) via the same store instance

Under The Hood

Architecture — Zustand’s core is a minimal vanilla store (src/vanilla.ts, ~100 lines) implementing createStore with a closure-based state container: a mutable state variable, a Set of listener callbacks, and setState/getState/getInitialState/subscribe methods — no reducers, no action types, no context. The React binding (src/react.ts) is a thin ~64-line wrapper around React’s built-in useSyncExternalStore hook, adding a selector argument for slice-based re-rendering and memoized snapshot getters. This two-layer split (framework-agnostic vanilla store + tiny React adapter) is the architectural core: create() composes createStore() from vanilla.ts and exposes it as a callable hook that also carries the raw store API as static properties via Object.assign. Middleware (src/middleware/*.ts: persist.ts, devtools.ts, immer.ts, redux.ts, combine.ts, subscribeWithSelector.ts) wraps StateCreator functions functionally, decorating setState/getState before they reach the store, which is how cross-cutting concerns like localStorage persistence or Redux DevTools integration are added without touching the core.

Tech Stack — Written in TypeScript (97.9% of the codebase per GitHub language stats), targeting Node >=12.20.0. Zero runtime dependencies; react, immer, and use-sync-external-store are all optional peerDependencies (peerDependenciesMeta marks them optional), which lets the vanilla store be imported without pulling in React at all. Build tooling uses Rollup (rollup.config.mjs) with esbuild for transpilation, producing separate CJS/ESM bundles per entry point (index, vanilla, react, middleware, shallow, traditional) as declared in the exports map in package.json. The repo uses pnpm workspaces (pnpm-workspace.yaml) and Vitest for testing.

Code Quality — 12 test files in tests/ (basic.test.tsx, ssr.test.tsx, devtools.test.tsx, immer.test.tsx, persistAsync.test.tsx, persistSync.test.tsx, shallow.test.tsx, subscribe.test.tsx, middlewareTypes.test.tsx, types.test.tsx) cover both runtime behavior and TypeScript type-level correctness, run via Vitest with a dedicated test:types script (tsc --noEmit) enforcing type soundness on every change. ESLint (flat config) plus Prettier enforce style; naming is short and consistent (create, useStore, setState) matching the library’s minimal-surface philosophy. Core state files carry inline comments explaining non-obvious TypeScript workarounds (e.g. a TODO on setState’s type assertion referencing a specific upstream TypeScript issue), showing deliberate handling of edge cases rather than silent suppression.

API Design — The public API is intentionally tiny: create((set, get) => ({...})) returns a hook usable directly in components with no provider wrapper, no action-type boilerplate, and immutable updates handled by a shallow-merging set function. Selector support (useStore(state => state.slice)) is opt-in and additive rather than required. Middleware composes via simple functional wrapping (persist(devtools(store))) rather than a plugin-registration system, so users add functionality by wrapping, not configuring. TypeScript generics are heavy (StateCreator, Mutate, StoreMutators) to support fully-typed middleware chains, which adds type-signature complexity for advanced users but keeps the runtime API surface small; the getting-started docs get a new user to a working store in under 10 lines of code.

Used by 110 apps in this directory

TypeScript
76%
AGPL 3.0

Abby

Developer Tools · Product Management

167

Statically typed feature flags, remote config, and A/B testing with framework-native SDKs for TypeScript teams.

View details
30
Repo Health
70
Technical
63
Dependency
Built with
TypeScript76%
MDX18%
Updated 1 years ago
TypeScript
99%
Other

Activepieces

Automation · AI Assistants

23,887

Open-source AI automation platform that converts 280+ workflow integrations into MCP servers for LLMs, with no-code builders and TypeScript extensibility.

View details
92
Repo Health
85
Technical
65
Dependency
Built with
TypeScript99%
Updated today
TypeScript
100%
Apache 2.0

agentic-inbox

AI Agents · Productivity

6,880

A self-hosted email client with an AI agent that reads your inbox, drafts replies automatically, and exposes full email operations over MCP — running entirely on Cloudflare Workers.

View details
32
Repo Health
74
Technical
77
Dependency
Built with
TypeScript100%
Updated 3 months ago
TypeScript
86%
MIT

Agents Observe

Developer Tools

652

A real-time, fully local observability dashboard for Claude Code and Codex agent sessions — filtering, search, session replay, and token/cost breakdowns via an auto-starting MCP server.

View details
71
Repo Health
67
Technical
77
Dependency
Built with
TypeScript86%
JavaScript11%
Updated 4 weeks ago
Python
90%
Apache 2.0

Apache Airflow

Data Engineering

46,530

Define, schedule, and monitor complex data workflows as Python code — with a powerful UI, 80+ provider integrations, and battle-tested scalability across thousands of production deployments.

View details
96
Repo Health
89
Technical
66
Dependency
Built with
Python90%
Updated today
TypeScript
51%
MIT

Anarlog

Note Taking · AI Assistants · Productivity

9,087

Anarlog is an open-source, local-first AI meeting notetaker that records, transcribes, and summarizes meetings entirely on your device — no cloud lock-in, no mandatory account, and every note saved as a plain markdown file you own forever.

View details
86
Repo Health
77
Technical
69
Dependency
Built with
TypeScript51%
Rust38%
Updated today
Go
60%
Apache 2.0

Apache Answer

Community

15,652

Open-source Q&A platform for communities, help centers, and knowledge bases with AI assistant and plugin extensibility

View details
85
Repo Health
78
Technical
69
Dependency
Built with
Go60%
TypeScript36%
Updated 2 days ago
Python
62%
MIT

AutoGen

AI Development · Automation

60,518

Build autonomous and human-in-the-loop multi-agent AI systems with a layered, event-driven Python and .NET framework pioneered at Microsoft Research.

View details
57
Repo Health
78
Technical
75
Dependency
Built with
Python62%
C#25%
TypeScript12%
Updated 4 months ago
Python
68%
Other

AutoGPT

Automation · Productivity · AI Assistants

186,687

Build, deploy, and run autonomous AI agents that automate complex multi-step workflows using a visual block-based graph editor.

View details
93
Repo Health
78
Technical
67
Dependency
Built with
Python68%
TypeScript31%
Updated today

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search