# System map — pmndrs/zustand

> Canonical page: https://codevetter.com/unpack/zustand/system-map

# System map — 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.

The package separates a framework-independent store from React consumers and opt-in middleware. State lives in memory unless a consumer supplies persistence middleware and storage. Rollup produces CommonJS, ESM, and declarations; GitHub Actions describes validation, package publication, previews, and documentation deployment.
- src/index.ts exports vanilla and React APIs; middleware, traditional equality hooks, and shallow helpers have separate source entrypoints. — [src/index.ts#L1-L2](https://github.com/pmndrs/zustand/blob/d7a5583cffd80af515f7dfb69583c95cbdc9e2ce/src/index.ts#L1-L2) [src/middleware.ts#L1-L17](https://github.com/pmndrs/zustand/blob/d7a5583cffd80af515f7dfb69583c95cbdc9e2ce/src/middleware.ts#L1-L17) [src/shallow.ts#L1-L2](https://github.com/pmndrs/zustand/blob/d7a5583cffd80af515f7dfb69583c95cbdc9e2ce/src/shallow.ts#L1-L2) [src/traditional.ts#L21-L44](https://github.com/pmndrs/zustand/blob/d7a5583cffd80af515f7dfb69583c95cbdc9e2ce/src/traditional.ts#L21-L44)
- createStoreImpl owns state and listeners in a closure and exposes setState, getState, getInitialState, and subscribe through StoreApi. — [src/vanilla.ts#L9-L14](https://github.com/pmndrs/zustand/blob/d7a5583cffd80af515f7dfb69583c95cbdc9e2ce/src/vanilla.ts#L9-L14) [src/vanilla.ts#L60-L96](https://github.com/pmndrs/zustand/blob/d7a5583cffd80af515f7dfb69583c95cbdc9e2ce/src/vanilla.ts#L60-L96)
- React useStore consumes a read-only StoreApi subset through useSyncExternalStore; traditional hooks instead import the with-selector shim. — [src/react.ts#L11-L36](https://github.com/pmndrs/zustand/blob/d7a5583cffd80af515f7dfb69583c95cbdc9e2ce/src/react.ts#L11-L36) [src/traditional.ts#L1-L12](https://github.com/pmndrs/zustand/blob/d7a5583cffd80af515f7dfb69583c95cbdc9e2ce/src/traditional.ts#L1-L12) [src/traditional.ts#L31-L44](https://github.com/pmndrs/zustand/blob/d7a5583cffd80af515f7dfb69583c95cbdc9e2ce/src/traditional.ts#L31-L44)
- Persistence defaults to browser localStorage, while PersistStorage permits consumer-supplied synchronous or asynchronous storage adapters. — [src/middleware/persist.ts#L7-L24](https://github.com/pmndrs/zustand/blob/d7a5583cffd80af515f7dfb69583c95cbdc9e2ce/src/middleware/persist.ts#L7-L24) [src/middleware/persist.ts#L187-L198](https://github.com/pmndrs/zustand/blob/d7a5583cffd80af515f7dfb69583c95cbdc9e2ce/src/middleware/persist.ts#L187-L198)
- The export map selects CommonJS or ESM JavaScript and corresponding declarations, including react-native conditions; React, Immer, and the selector shim are optional peers. — [package.json#L27-L57](https://github.com/pmndrs/zustand/blob/d7a5583cffd80af515f7dfb69583c95cbdc9e2ce/package.json#L27-L57) [package.json#L159-L177](https://github.com/pmndrs/zustand/blob/d7a5583cffd80af515f7dfb69583c95cbdc9e2ce/package.json#L159-L177)
- Rollup selects src entrypoints from config flags and emits dist/*.js plus dist/esm/*.mjs; postbuild patches declarations and creates a publishable dist manifest. — [rollup.config.mjs#L93-L104](https://github.com/pmndrs/zustand/blob/d7a5583cffd80af515f7dfb69583c95cbdc9e2ce/rollup.config.mjs#L93-L104) [package.json#L63-L87](https://github.com/pmndrs/zustand/blob/d7a5583cffd80af515f7dfb69583c95cbdc9e2ce/package.json#L63-L87)
- The two private Vite examples use the React SWC plugin; demo includes Three.js integrations, whereas starter contains a typed counter. — [examples/demo/package.json#L16-L28](https://github.com/pmndrs/zustand/blob/d7a5583cffd80af515f7dfb69583c95cbdc9e2ce/examples/demo/package.json#L16-L28) [examples/demo/vite.config.js#L1-L7](https://github.com/pmndrs/zustand/blob/d7a5583cffd80af515f7dfb69583c95cbdc9e2ce/examples/demo/vite.config.js#L1-L7) [examples/starter/vite.config.ts#L1-L7](https://github.com/pmndrs/zustand/blob/d7a5583cffd80af515f7dfb69583c95cbdc9e2ce/examples/starter/vite.config.ts#L1-L7) [examples/starter/src/index.tsx#L9-L33](https://github.com/pmndrs/zustand/blob/d7a5583cffd80af515f7dfb69583c95cbdc9e2ce/examples/starter/src/index.tsx#L9-L33)
- Release publication builds and publishes dist to npm; preview CI publishes dist through pkg-pr-new, and docs CI delegates building to pmndrs/docs before deploying GitHub Pages. — [.github/workflows/publish.yml#L20-L29](https://github.com/pmndrs/zustand/blob/d7a5583cffd80af515f7dfb69583c95cbdc9e2ce/.github/workflows/publish.yml#L20-L29) [.github/workflows/preview-release.yml#L27-L29](https://github.com/pmndrs/zustand/blob/d7a5583cffd80af515f7dfb69583c95cbdc9e2ce/.github/workflows/preview-release.yml#L27-L29) [.github/workflows/docs.yml#L16-L25](https://github.com/pmndrs/zustand/blob/d7a5583cffd80af515f7dfb69583c95cbdc9e2ce/.github/workflows/docs.yml#L16-L25) [.github/workflows/docs.yml#L27-L43](https://github.com/pmndrs/zustand/blob/d7a5583cffd80af515f7dfb69583c95cbdc9e2ce/.github/workflows/docs.yml#L27-L43)

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)
