Meet Bonsai โ the state library that doesn't just *manage* your state, it hugs it, waters it, and sings to it ๐ฟ๐ถ. Whether you want flat state, nested trees, or scoped vibes โ we've got branches for all.
Did you know?
Bonsai ("็ๆ ฝ") is Japanese for "planted in a container" โ where ็ (bon) means "tray" and ๆ ฝ (sai) means "planting." state in the perfect environment. ๐ชด
npm install @bonsai-ts/state
yarn add @bonsai-ts/state
pnpm add @bonsai-ts/state
bun add @bonsai-ts/state
Whether you're building a to-do app or the next space station dashboard ๐ฐ๏ธ, Bonsai adapts and grows with you โ minus the drama.
Ever felt like managing state was like hacking through a rainforest with a toothbrush? ๐ชฅ๐ด So did we. Bonsai brings order to the chaos โ a clean, calm canopy of predictable state with no wild reducers lurking in the bushes.
Life's too short to squint at weird hook errors ๐ตโ๐ซ. Bonsai is designed with developer happiness in mind โ clean APIs, helpful logs, and no weird rituals. State management should feel like a stroll, not a stress test ๐ง.
Like a perfectly pruned bonsai tree (or a squirrel on a Red Bull), Bonsai is tiny and optimized to the roots. It keeps your UI reactive without breaking a sweat ๐ฅตโก๏ธ๐. Say goodbye to unnecessary renders.
Bonsai isn't just a library, it's a growing garden ๐บ. We love feedback, memes, and PRs (Pull Requests *and* Plant Recommendations ๐ฟ). Help us shape the tree โ one branch at a time ๐.
Before you let us manage your entire app's vibe, test us out! The playground is where ideas grow, bugs hide (temporarily), and you fall in love ๐.
Let's be honest. Some state management tools feel like assembling IKEA furniture without instructions. Bonsai? It's more like building a Lego setโwith instructions, colors, and joy ๐จ.
Feature | Bonsai ๐ฑ | Zustand ๐ป | Jotai ๐งช | Redux ๐งโโ๏ธ |
---|---|---|---|---|
Dev Panel ๐ ๏ธ | Built-in & sleek ๐ | 3rd party tools ๐ฌ | Nope | Redux DevTools ๐ง |
Selector Access ๐ฏ | `use(select => state.todo)` โ | โ | โ | โ |
Tree Path ๐ณ | `use("todos.byId.1")` โ | โ | โ | โ |
Middleware ๐งฉ | Built-in & stackable ๐ช | Yes | Limited | Complex ๐ฅฑ |
TS Support ๐ง | โจ Full autocomplete โจ | Good | Basic | Manual ๐ชฆ |
Boilerplate ๐ฉ | None ๐ | Minimal | Small | Lots ๐ฒ |
Learning ๐ข | Smooth ๐ง | Easy | Abstract | Steep ๐ |
Speed โก | Optimized โ๏ธ | Good | Decent | Variable |
Concept ๐ง | Intuitive ๐ง | Simple | Atomic | Complex ๐งฎ |
โ ๏ธ No bears or atoms were harmed. Your state logic might never be the same ๐