localstorage-orm is a lightweight TypeScript ORM for browser localStorage that provides a model-based CRUD interface with schema validation, timestamps, soft deletes, and reference/population support. Current stable version is 1.1.0. It uses a simple builder pattern for records and supports find/findById methods. Key differentiators: direct localStorage persistence with no backend required, TypeScript-first with type safety, and built-in reference population for relational data management within the browser. Release cadence is irregular; latest update was September 2024.
npm install localstorage-ormNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Create a model, build a record, persist, fetch, update, and delete using Model and Schema.
Ensure your interface extends Schema: interface Person extends Schema { ... }Keep localStorage data small (KB range). Consider IndexedDB for larger datasets.
Use personModel.create(data) instead of build() if you want immediate persistence.
Use findById(id) instead of get(id).
Use model.build() to create an instance, set properties, then call .save(). For find results, they already have .save().
Define interface Person extends Schema { ... } and use Model<Person>.Test in a regular browser window with http:// or https://. For file://, use a local server.