CodeVetter
← All unpacks
CodeVetter · Repo Unpack evidence

pmndrs/valtio

Scanned commit 26d8ca8cb6 dated 2026-10-01 — last upstream commit. Generated by codevetter 1.15.0 on 2026-10-02.

github.com/pmndrs/valtio ↗ · 227 files · 609 KB

npm install valtio makes proxy-state simple Wrap your state object Valtio turns the object you pass it into a self-aware proxy.

Deep analysis by cli:codex via the codex CLI on 2026-10-02 (417s) — every claim below links to its cited source files. Source inspection; upstream code and tests were not executed.

Overview

Valtio is a TypeScript state-management library for React and vanilla JavaScript applications. Developers mutate ordinary-looking proxy objects, while versioned snapshots and property-access tracking connect those changes to subscribers and React renders. This checkout also contains reactive collection utilities, Redux DevTools integration, a Next.js documentation website, and examples covering counters, todos, undo/redo, and browser-local photo persistence.

System map

The primary product is a library with separate vanilla and React runtime boundaries. Its state resides in JavaScript objects and runtime caches; persistence is supplied by consuming applications. Rollup produces publishable CommonJS, ESM, and declaration artifacts, while the documentation website and examples have separate application configurations. The inspected workflows describe validation and package publication, without establishing their execution results.

Feature catalog

The library exposes mutable proxy state, snapshots, subscriptions, and React hooks as its primary developer-facing features. Utilities add reactive collections, cloning, normalization, effects, and debugging. Examples demonstrate complete interactions, while the website provides documentation navigation and theme controls. History and derived-state documentation also introduce external packages, whose implementations are outside this inspection.

Data flow

Object inputs become mutation-tracking proxies backed by identity caches and version propagation. Snapshot creation translates live state into cached read-only properties, and React adds access tracking before rendering. Reactive collections keep indexing state outside their proxied storage arrays. Application and website adapters then translate changes into browser storage, DOM updates, compiled documentation, or extension messages.

Behavior traces

These traces follow source execution order across library and application boundaries. Counter startup and mutation demonstrate proxy construction and React notification, while both todo examples show action-to-render paths. The photo booth provides a concrete persistence lifecycle, and the documentation route demonstrates build-time compilation followed by rendering. DevTools and watch illustrate bidirectional external messages and reactive-effect cleanup.

Testing signals

Tests and CI were inspected, not executed; no passing result or measured coverage is asserted. Vitest runs the tests directory in jsdom with React Testing Library and jest-dom support. Inspected suites cover core graph semantics, React rendering, utility behavior, regressions, and selected performance/memory contracts. This bounded inspection does not establish exhaustive coverage, and the root configuration does not directly include website or example application tests.

Risk map

These are source observations and explicitly labeled hypotheses, not confirmed vulnerabilities. The inspected core primarily manages in-process state; external trust boundaries appear in DevTools messages, browser camera/storage adapters, and documentation compilation. Identity, snapshot descriptors, global internal customization, and dependency-version drift are major correctness boundaries. Missing execution evidence leaves configured tests and deployment compatibility unresolved.

Extension points

Extensions primarily compose exported functions rather than register plugins. Utility barrels and separate package entrypoints define the public surface, while unstable internal APIs permit deeper runtime customization. Application actions, computed getters, persistence subscriptions, and external history packages provide higher-level composition. Website navigation and MDX plugin arrays offer separate documentation extension points.

Contributor handoff

Start with the core runtime and the test that specifies the requested behavior, then inspect packaging or application adapters only when relevant. Preserve identity, version, listener, and snapshot contracts when editing the central proxy implementation. Tests and CI were inspected, not executed; commands below are future validation choices only when execution is authorized. The inventory and this investigation are bounded, and public documentation contains some version drift that must be checked against implementation.

Languages

LanguageFilesShare of source
TypeScript11695%
Markdown43docs/config
JSON24docs/config
CSS11docs/config
YAML11docs/config
HTML7docs/config
JavaScript65%

Start reading here

Probable source entrypoint: src/index.ts — inferred from the directory tree and manifest, not the upstream docs.

Source roots

src/ (15 files)

Source layout — src/

PathFiles
src/react/2
src/vanilla/8
src/index.ts1
src/react.ts1
src/types.d.ts1
src/utils.ts1
src/vanilla.ts1

Repository structure

Top-level pathFiles
examples/63
website/46
tests/42
docs/37
src/15
.github/12

Docs found: CONTRIBUTING.mdREADME.mddocs/readme.md

Package

package.json — valtio v2.3.2, 40 declared dependencies.

@eslint/js@redux-devtools/extension@rollup/plugin-alias@rollup/plugin-node-resolve@rollup/plugin-replace@rollup/plugin-typescript@testing-library/jest-dom@testing-library/react@types/jsdom@types/react@types/react-dom@vitest/coverage-v8

CI & config entrypoints

Structural health signals

Average score 9.5/10 across 78 analyzed source files; 0 hotspots surfaced.

These are deterministic review leads — size, churn, and structural signals — not proof of a bug in this project.

Recent history