Skip to main content
Stan.js is a lightweight state management library that works with React, React Native, and vanilla JavaScript applications. Get started by installing the package using your preferred package manager.

Package Managers

npm install stan-js

Requirements

Stan.js has minimal requirements and works out of the box with:
  • React: 18.2.0 or higher (optional)
  • Node.js: Any modern version supporting ES modules
  • TypeScript: Full TypeScript support with excellent IntelliSense
React is listed as an optional peer dependency. You can use stan-js in vanilla JavaScript projects without React.

Additional Packages

Stan.js provides additional entry points for specific features:

Storage & Persistence

For built-in data persistence using localStorage or React Native MMKV:
import { storage } from 'stan-js/storage'
No additional installation required - this is included in the main package.

Vanilla JavaScript

For using stan-js without React:
import { createStore } from 'stan-js/vanilla'

React Native MMKV (Optional)

If you want to use MMKV storage in React Native applications:
npm install react-native-mmkv
react-native-mmkv is an optional peer dependency. Only install it if you’re building a React Native app and want to use MMKV for storage.

Verify Installation

After installation, verify that stan-js is properly installed by creating a simple store:
import { createStore } from 'stan-js'

const { useStore } = createStore({
  count: 0
})

console.log('Stan.js is ready!')
If you see no errors, you’re ready to start building with stan-js!

Next Steps

Quickstart Guide

Learn the basics with a complete quickstart tutorial

API Reference

Explore the full API documentation

Build docs developers (and LLMs) love