Jotai

Primitive and flexible atom-based state management for React that scales from a useState replacement to enterprise apps.

Library
npm
v3.0.0
21,282 stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
79 /100 Good
Development Activity 72
Maintenance 80
Community 64
Maturity 60
Momentum 40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
88 /100 Excellent
Architecture 92
Code Quality 90
Innovation 90
Learning Curve 80

Jotai is a primitive and flexible state management library for React built around atoms — small, composable units of state that you read and write with hooks that feel just like useState. Instead of a single global store with string keys, you declare independent atoms and derive new atoms from them, and Jotai handles dependency tracking, re-render optimization, and async resolution for you.

With a minimal 2KB core, a rich set of utilities, and first-class TypeScript support, Jotai scales from replacing a handful of useState calls up to managing complex, interdependent global state in large applications. It works with React, React Native, and any renderer, and supports Suspense-based async atoms out of the box.

What You Get

  • A 2KB core API centered on the atom() primitive and the useAtom family of hooks
  • Derived read-only, write-only, and read-write atoms with automatic dependency tracking
  • Built-in async atoms that integrate with React Suspense for data fetching and pending states
  • A large utility set (atomWithStorage, atomFamily, selectAtom, splitAtom, loadable, and more) plus vanilla and Babel integrations
  • First-class TypeScript types and support for React, React Native, and custom stores

Common Use Cases

  • Replacing scattered useState and prop drilling with shared global atoms
  • Deriving computed values and cross-cutting selectors from multiple pieces of state
  • Fetching and caching server data through async atoms with Suspense
  • Persisting UI state such as theme or preferences to localStorage with atomWithStorage
  • Managing dynamic collections of state with atomFamily and splitAtom

Under The Hood

Architecture — Jotai is organized into a framework-agnostic vanilla layer and a thin react binding layer. The vanilla core (src/vanilla/atom.ts, src/vanilla/store.ts, src/vanilla/internals.ts) defines the atom config object and a store that holds atom state in a WeakMap-based graph, tracking dependencies and recomputing derived atoms via INTERNAL_buildStore. atom() returns a plain config with read/write functions rather than the value itself, so atoms are stateless descriptors and all mutable state lives in the store. The React layer (src/react/useAtom.ts, useAtomValue.ts, useSetAtom.ts, Provider.ts) subscribes components to specific atoms through useSyncExternalStore, so a store change re-renders only the components reading the affected atoms. A default global store is created lazily, with a dev-mode guard warning on multiple Jotai instances.

Tech Stack — Written in TypeScript (~85% of the codebase) with a small JavaScript/CSS remainder. React is an optional peer dependency (>=17.0.0), as are @babel/core, @babel/template, and @types/react, keeping the runtime dependency-free. The build uses Rollup with multiple configs to emit CommonJS and ESM bundles plus separate entry points for vanilla, utils, and Babel plugins/preset, with downlevel-dts producing TypeScript 3.8 type fallbacks. Tooling includes Vitest for tests, ESLint, Prettier, and pnpm workspaces.

Code Quality — The codebase is mature and well-tested, with 49 test files under tests/ covering vanilla store behavior, dependency tracking, derivation, effects, React hooks, and the Babel plugins, run through Vitest with Testing Library and v8 coverage. Files are small and single-responsibility (each utility such as atomWithStorage, atomFamily, and selectAtom lives in its own module under src/vanilla/utils). Internal-only APIs are clearly marked with comments warning they are not part of the public contract, and types are strict throughout.

API Design — The public surface is deliberately minimal: one atom() factory plus a small family of hooks (useAtom, useAtomValue, useSetAtom) that mirror React.useState, so getting started requires almost no boilerplate. Atoms are referenced by identity rather than string keys, eliminating a whole class of naming errors. Read/write/derived variants are expressed by which functions you pass to atom(), a consistent and composable convention, and the extensive documentation at jotai.org plus in-repo examples make the learning curve gentle for anyone already comfortable with React hooks.

Used by 27 apps in this directory

TypeScript
82%
Other

AFFiNE

Collaboration · Note Taking · Productivity

73,040

Write, draw, and plan in one infinite canvas — the open-source alternative to Notion and Miro that keeps your data yours.

View details
91
Repo Health
87
Technical
67
Dependency
Built with
TypeScript 82%
Rust 11%
Updated 6 days ago
TypeScript
56%
Other

agenta

AI Development · Developer Tools · Devops

4,788

The open-source LLMOps platform unifying prompt engineering, evaluation, and observability for teams building reliable LLM applications.

View details
91
Repo Health
77
Technical
67
Dependency
Built with
TypeScript 56%
Python 39%
Updated 6 days ago
TypeScript
72%
AGPL 3.0

APITable

Databases · Low Code Platforms

15,623

API-first collaborative spreadsheet-database platform that auto-generates REST APIs and lets teams build internal tools, CRMs, and dashboards without code.

View details
71
Repo Health
77
Technical
60
Dependency
Built with
TypeScript 72%
Java 22%
Updated 3 weeks ago
TypeScript
96%
Other

Cal.diy

Scheduling

48,697

The 100% MIT-licensed, community-driven scheduling platform — self-host your own booking infrastructure with no enterprise strings attached.

View details
91
Repo Health
86
Technical
65
Dependency
Built with
TypeScript 96%
Updated 1 weeks ago
TypeScript
50%
Other

Dify

AI Development · Design Tools · Developer Tools

157,364

Visual LLM workflow platform with RAG pipelines, agent capabilities, and model management for building production AI applications.

View details
92
Repo Health
85
Technical
66
Dependency
Built with
TypeScript 50%
Python 47%
Updated 5 days ago
TypeScript
95%
AGPL 3.0

Docmost

CMS · Collaboration · Note Taking

21,801

Self-hosted collaborative wiki and knowledge base with real-time editing, diagrams, AI assistance, and enterprise access controls — a modern alternative to Confluence and Notion.

View details
89
Repo Health
70
Technical
69
Dependency
Built with
TypeScript 95%
Updated 6 days ago
TypeScript
96%
Other

Dyad

AI Assistants · AI Code Assistants · AI Development

21,616

Build AI-powered apps locally with your own keys, your own models, and zero cloud lock-in.

View details
88
Repo Health
83
Technical
69
Dependency
Built with
TypeScript 96%
Updated 6 days ago
Python
79%
GPL 3.0

ERPNext

ERP · Invoicing Finance

39,605

100% free, open-source ERP unifying accounting, manufacturing, inventory, CRM, HR, and POS in a single self-hostable platform.

View details
96
Repo Health
77
Technical
74
Dependency
Built with
Python 79%
JavaScript 14%
Updated 5 days ago
Go
62%
Apache 2.0

Harness Open Source

Code Editors · Developer Tools · Devops

38,450

A unified open source DevOps platform combining Git hosting, CI/CD pipelines, cloud development environments, and artifact registries in a single self-hosted system.

View details
89
Repo Health
79
Technical
64
Dependency
Built with
Go 62%
TypeScript 33%
Updated 1 weeks ago

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