electron-store is a data persistence library for Electron applications that saves and loads user settings, app state, and cache to a JSON file.
Electron lacks built-in mechanisms for persisting user data across sessions. electron-store solves this by automatically managing a JSON configuration file stored in the user data directory, handling all read and write operations. The library writes changes atomically to prevent corruption if the process crashes during a write. It supports schema validation using JSON Schema draft-2020-12 through the ajv validator, allowing you to enforce data structure and type constraints. The tool works in both the main and renderer processes, though renderer-process-only usage requires initialization in the main process.
The tool suits small data storage scenarios like user preferences and application state. The README explicitly notes that electron-store is not a database and reads and writes the entire JSON file on every change, making it unsuitable for large datasets; SQLite or similar solutions are recommended for that use case. Adoption requires Electron 30 or later and native ESM support, as the package no longer provides CommonJS exports. The library offers optional migration support for handling data structure changes across application versions, though the README indicates this feature has known bugs and limited maintenance.
Development activity shows consistent engagement with bug fixes and feature refinements. The project maintains responsiveness to issues and pull requests. Migration support remains available but explicitly lacks active maintenance, with the maintainer welcoming community contributions for improvements. The codebase prioritizes atomic writes and data integrity as core reliability features.