# Extension points — pmndrs/zustand

> Canonical page: https://codevetter.com/unpack/zustand/extension-points

# Extension points — pmndrs/zustand

Scanned commit d7a5583cffd80af515f7dfb69583c95cbdc9e2ce (2026-09-29). Generated by codevetter codevetter 1.15.0 on 2026-10-02.

Source inspection; upstream code and tests were not executed.

Extension centers on StateCreator factories and higher-order middleware rather than a runtime plugin loader. TypeScript module augmentation tracks how middleware changes StoreApi. Storage, selectors, comparators, reducers, slices, and exported entrypoints are the principal customization boundaries.
- StateCreator receives setState, getState, and store; createStore accepts that factory, allowing consumer-defined state and actions without a registry. — [src/vanilla.ts#L28-L37](https://github.com/pmndrs/zustand/blob/d7a5583cffd80af515f7dfb69583c95cbdc9e2ce/src/vanilla.ts#L28-L37) [src/vanilla.ts#L43-L50](https://github.com/pmndrs/zustand/blob/d7a5583cffd80af515f7dfb69583c95cbdc9e2ce/src/vanilla.ts#L43-L50) [src/vanilla.ts#L94-L100](https://github.com/pmndrs/zustand/blob/d7a5583cffd80af515f7dfb69583c95cbdc9e2ce/src/vanilla.ts#L94-L100)
- StoreMutators is an augmentable interface, and Mutate recursively applies mutator tuples; middleware such as Immer registers its API transformation through module augmentation. — [src/vanilla.ts#L20-L41](https://github.com/pmndrs/zustand/blob/d7a5583cffd80af515f7dfb69583c95cbdc9e2ce/src/vanilla.ts#L20-L41) [src/middleware/immer.ts#L14-L18](https://github.com/pmndrs/zustand/blob/d7a5583cffd80af515f7dfb69583c95cbdc9e2ce/src/middleware/immer.ts#L14-L18)
- PersistStorage is the storage extension contract, while createJSONStorage adapts string backends and exposes reviver/replacer hooks for custom serialization. — [src/middleware/persist.ts#L7-L34](https://github.com/pmndrs/zustand/blob/d7a5583cffd80af515f7dfb69583c95cbdc9e2ce/src/middleware/persist.ts#L7-L34) [src/middleware/persist.ts#L42-L58](https://github.com/pmndrs/zustand/blob/d7a5583cffd80af515f7dfb69583c95cbdc9e2ce/src/middleware/persist.ts#L42-L58)
- PersistOptions separates partialize, migrate, merge, and onRehydrateStorage; each customizes a distinct write or hydration stage. — [src/middleware/persist.ts#L79-L110](https://github.com/pmndrs/zustand/blob/d7a5583cffd80af515f7dfb69583c95cbdc9e2ce/src/middleware/persist.ts#L79-L110)
- useStore accepts an existing store and selector, while traditional hooks accept equality functions and subscribeWithSelector accepts comparator/immediate-delivery options. — [src/react.ts#L21-L34](https://github.com/pmndrs/zustand/blob/d7a5583cffd80af515f7dfb69583c95cbdc9e2ce/src/react.ts#L21-L34) [src/traditional.ts#L31-L42](https://github.com/pmndrs/zustand/blob/d7a5583cffd80af515f7dfb69583c95cbdc9e2ce/src/traditional.ts#L31-L42) [src/middleware/subscribeWithSelector.ts#L31-L37](https://github.com/pmndrs/zustand/blob/d7a5583cffd80af515f7dfb69583c95cbdc9e2ce/src/middleware/subscribeWithSelector.ts#L31-L37)
- redux injects a caller-supplied reducer and initial state; combine injects a creator whose output overrides overlapping initial-state keys. — [src/middleware/redux.ts#L23-L26](https://github.com/pmndrs/zustand/blob/d7a5583cffd80af515f7dfb69583c95cbdc9e2ce/src/middleware/redux.ts#L23-L26) [src/middleware/redux.ts#L39-L48](https://github.com/pmndrs/zustand/blob/d7a5583cffd80af515f7dfb69583c95cbdc9e2ce/src/middleware/redux.ts#L39-L48) [src/middleware/combine.ts#L10-L14](https://github.com/pmndrs/zustand/blob/d7a5583cffd80af515f7dfb69583c95cbdc9e2ce/src/middleware/combine.ts#L10-L14)
- The documented slices pattern combines factories through object spread and applies middleware to the combined store, explicitly discouraging middleware inside individual slices. — [docs/learn/guides/slices-pattern.md#L31-L42](https://github.com/pmndrs/zustand/blob/d7a5583cffd80af515f7dfb69583c95cbdc9e2ce/docs/learn/guides/slices-pattern.md#L31-L42) [docs/learn/guides/slices-pattern.md#L105-L116](https://github.com/pmndrs/zustand/blob/d7a5583cffd80af515f7dfb69583c95cbdc9e2ce/docs/learn/guides/slices-pattern.md#L105-L116)
- DevtoolsOptions extends the extension connector configuration and adds name/store/enabled/action naming; new packaged source entrypoints must fit Rollup's config-flag routing and the package subpath export map. — [src/middleware/devtools.ts#L84-L89](https://github.com/pmndrs/zustand/blob/d7a5583cffd80af515f7dfb69583c95cbdc9e2ce/src/middleware/devtools.ts#L84-L89) [src/middleware/devtools.ts#L191-L213](https://github.com/pmndrs/zustand/blob/d7a5583cffd80af515f7dfb69583c95cbdc9e2ce/src/middleware/devtools.ts#L191-L213) [rollup.config.mjs#L93-L104](https://github.com/pmndrs/zustand/blob/d7a5583cffd80af515f7dfb69583c95cbdc9e2ce/rollup.config.mjs#L93-L104) [package.json#L43-L55](https://github.com/pmndrs/zustand/blob/d7a5583cffd80af515f7dfb69583c95cbdc9e2ce/package.json#L43-L55)

Every claim links to its cited files at the pinned commit. Citations identify source evidence; they do not establish runtime correctness. Independent CodeVetter scan — not reviewed by upstream maintainers.

## Public product links

- [CodeVetter](https://codevetter.com/)
- [Download](https://codevetter.com/download)
- [Documentation](https://codevetter.com/docs/)
- [Source](https://github.com/Codevetter/codevetter)
