gitwtfhub

wtf is lenstore?

gvergnaud/lenstore — explained in plain English

Analysis updated 2026-07-18 · repo last pushed 2016-02-29

JavaScriptAudience · developerComplexity · 3/5DormantSetup · easy

TL;DR

LenStore is a work-in-progress JavaScript state management library that lets you read and update nested app state using composable "lens" paths instead of manual deep-copying and conditional checks.

Mindmap

mindmap
  root((repo))
    What it does
      Reads state by path
      Updates state safely
      Notifies on change
    Tech stack
      JavaScript
      Observables
      Lenses
    Use cases
      Manage app state
      Avoid deep copies
      Auto rerender UI
    Audience
      Frontend developers
    Status
      Work in progress
      Core lens store working

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Why would anyone build with this?

REASON 1

Read a deeply nested piece of app state, like a user's username, without writing conditional checks.

REASON 2

Update one field in a nested state object, like a user's age, without manually deep-copying the rest.

REASON 3

Subscribe a UI component to a specific piece of state so it automatically re-renders when that data changes.

REASON 4

Replace repetitive Redux or MobX-style state update code with a simpler lens-based path syntax.

What's in the stack?

JavaScript

How it stacks up

gvergnaud/lenstore3rd-eden/ircb.ioa15n/a15n
LanguageJavaScriptJavaScriptJavaScript
Last pushed2016-02-292016-11-162019-04-07
MaintenanceDormantDormantDormant
Setup difficultyeasyeasyeasy
Complexity3/52/52/5
Audiencedeveloperdevelopergeneral

Figures from each repo's GitHub metadata at analysis time.

How do you spin it up?

Difficulty · easy Time to first run · 30min

Still in active development, some planned features like multi-store combination and middleware are not yet built.

Wtf does this do

LenStore is a work-in-progress state management library for JavaScript that lets you read and update application state in a clean, composable way. Instead of writing complex logic to navigate through nested objects, you describe a "path" to the data you want, and the library handles the details of getting, modifying, or setting values safely. Think of it like having a precise tool to point at any piece of your app's data. If your app tracks a user's profile inside a larger state object, you can say "give me the user's username" or "update the user's age to 23" without writing conditional checks or spread operators. The library returns an Observable, something that notifies listeners whenever that data changes, so your UI automatically re-renders when state updates. It's similar to how Redux or MobX work, but with a different mental model. Under the hood, the library uses a concept called lenses (a functional programming pattern) to create safe, composable paths through your data. A lens is like a combination of a getter and a setter for a specific location in your state tree. When you write view(L.user.username) or set(L.user.username, 'newName'), the library is using these lenses to access or modify that one piece of data while keeping the rest intact. The syntax is deliberately simple, it reads almost like accessing properties on a plain JavaScript object. This would appeal to developers building interactive web apps who find themselves writing repetitive state update code. Instead of manually deep-copying objects and updating nested fields, you describe the shape of your state once and get helper functions to work with any part of it. The project is still in active development, the README shows several planned features like combining multiple stores, middleware hooks, and special lens types for advanced patterns like references and atoms, but the core idea of a lens-based state store is already functional and ready to experiment with.

Yoink these prompts

Prompt 1
Show me how to define a lens with LenStore to read and update a nested field in my app's state.
Prompt 2
Explain how LenStore's Observable-based updates would let a React component auto re-render on state change.
Prompt 3
Compare LenStore's lens-based approach to how Redux or MobX handle nested state updates.
Prompt 4
What planned LenStore features, like combining multiple stores, should I watch for before relying on it in production?

Frequently asked questions

wtf is lenstore?

LenStore is a work-in-progress JavaScript state management library that lets you read and update nested app state using composable "lens" paths instead of manual deep-copying and conditional checks.

What language is lenstore written in?

Mainly JavaScript. The stack also includes JavaScript.

Is lenstore actively maintained?

Dormant — no commits in 2+ years (last push 2016-02-29).

How hard is lenstore to set up?

Setup difficulty is rated easy, with roughly 30min to a first successful run.

Who is lenstore for?

Mainly developer.

View the repo → Decode another repo

This repo across BitVibe Labs

Don't trust strangers blindly. Verify against the repo.