---
description: Learn how to use SqliteKeyValueStore for simple, reliable key-value storage in your Capacitor apps without writing a single SQL query.
title: Key-Value Storage Made Simple with the SQLite Plugin - Capawesome
image: https://capawesome.io/docs/assets/images/social/blog/key-value-storage-made-simple-with-the-sqlite-plugin.png
---

[ Skip to content](#key-value-storage-made-simple-with-the-sqlite-plugin) 

[ 🔐 Introducing the **Capacitor Vault** plugin — store secrets behind biometrics or a device passcode.](/blog/announcing-the-capacitor-vault-plugin/) 

* [  SDKs ](/docs/sdks/)
* [  Formbricks ](/docs/sdks/capacitor/formbricks/)
* [  Geocoder ](/docs/sdks/capacitor/geocoder/)
* [  Google Sign-In ](/docs/sdks/capacitor/google-sign-in/)
* [  Grafana Faro ](/docs/sdks/capacitor/grafana-faro/)
* [  libSQL ](/docs/sdks/capacitor/libsql/)
* [  Live Update ](/docs/sdks/capacitor/live-update/)
* [  Managed Configurations ](/docs/sdks/capacitor/managed-configurations/)
* [  Media Session ](/docs/sdks/capacitor/media-session/)
* [  ML Kit ](/docs/sdks/capacitor/mlkit/)
* [  Navigation Bar ](/docs/sdks/capacitor/navigation-bar/)
* [  NFC ](/docs/sdks/capacitor/nfc/)
* [  OAuth ](/docs/sdks/capacitor/oauth/)
* [  Pedometer ](/docs/sdks/capacitor/pedometer/)
* [  Photo Editor ](/docs/sdks/capacitor/photo-editor/)
* [  PostHog ](/docs/sdks/capacitor/posthog/)
* [  Printer ](/docs/sdks/capacitor/printer/)
* [  Purchases ](/docs/sdks/capacitor/purchases/)
* [  RealtimeKit ](/docs/sdks/capacitor/realtimekit/)
* [  Screen Orientation ](/docs/sdks/capacitor/screen-orientation/)
* [  Screenshot ](/docs/sdks/capacitor/screenshot/)
* [  Secure Preferences ](/docs/sdks/capacitor/secure-preferences/)
* [  Speech Recognition ](/docs/sdks/capacitor/speech-recognition/)
* [  Speech Synthesis ](/docs/sdks/capacitor/speech-synthesis/)
* [  Share Target ](/docs/sdks/capacitor/share-target/)
* [  Square Mobile Payments ](/docs/sdks/capacitor/square-mobile-payments/)
* [  SQLite ](/docs/sdks/capacitor/sqlite/)
* [  Superwall ](/docs/sdks/capacitor/superwall/)
* [  Torch ](/docs/sdks/capacitor/torch/)
* [  Vault ](/docs/sdks/capacitor/vault/)
* [  Wifi ](/docs/sdks/capacitor/wifi/)
* [  Zip ](/docs/sdks/capacitor/zip/)
* [  Cordova ](/docs/sdks/cordova/)
* [  Cloud ](/docs/cloud/)
* [  Integrations ](/docs/cloud/live-updates/integrations/)
* Concepts
* Reference
* [  Troubleshooting ](/docs/cloud/live-updates/troubleshooting/)
* [  FAQ ](/docs/cloud/live-updates/faq/)
* [  Native Builds ](/docs/cloud/native-builds/)
* [  Set Up Environments ](/docs/cloud/native-builds/environments/)
* [  Overwrite Native Configurations ](/docs/cloud/native-builds/native-configurations/)
* [  Auto-Increment Build Numbers ](/docs/cloud/native-builds/auto-incrementing-build-numbers/)
* [  Configure the Web Build Script ](/docs/cloud/native-builds/web-build-script/)
* [  Build from a Monorepo ](/docs/cloud/native-builds/monorepo/)
* [  Use pnpm or Yarn ](/docs/cloud/native-builds/package-managers/)
* [  Install Private npm Packages ](/docs/cloud/native-builds/npm-private-registry/)
* [  Override the Java Version ](/docs/cloud/native-builds/override-java-version/)
* [  Custom iOS Provisioning Profiles ](/docs/cloud/native-builds/custom-ios-provisioning-profiles/)
* [  Build without Git ](/docs/cloud/native-builds/build-without-git/)
* [  Access Git Behind a Firewall ](/docs/cloud/native-builds/firewall-access/)
* [  Integrations ](/docs/cloud/native-builds/integrations/)
* Reference
* [  Troubleshooting ](/docs/cloud/native-builds/troubleshooting/)
* [  FAQ ](/docs/cloud/native-builds/faq/)
* [  App Store Publishing ](/docs/cloud/app-store-publishing/)
* [  Submit a Build ](/docs/cloud/app-store-publishing/submit-a-build/)
* [  Submit Automatically After a Build ](/docs/cloud/app-store-publishing/submit-automatically/)
* [  Troubleshooting ](/docs/cloud/app-store-publishing/troubleshooting/)
* [  FAQ ](/docs/cloud/app-store-publishing/faq/)
* [  Automations ](/docs/cloud/automations/)
* [  Reference ](/docs/cloud/automations/reference/)
* [  Troubleshooting ](/docs/cloud/automations/troubleshooting/)
* [  FAQ ](/docs/cloud/automations/faq/)
* [  Assist ](/docs/cloud/assist/)
* [  CLI ](/docs/cloud/cli/)
* APIs and SDKs
* [  Webhooks ](/docs/cloud/webhooks/)
* [  Integrations ](/docs/cloud/integrations/)
* Account
* [  Organization ](/docs/cloud/organizations/)
* [  Two-Factor Enforcement ](/docs/cloud/organizations/two-factor-authentication/)
* [  Audit Logs ](/docs/cloud/organizations/audit-logs/)
* [  Billing ](/docs/cloud/organizations/billing/)
* [  License Keys ](/docs/cloud/license-keys/)
* [  AI ](/docs/ai/)
* [  Insiders ](/docs/insiders/)
* [  Billing & Plans ](/docs/insiders/billing-and-plans/)
* [  FAQ ](/docs/insiders/faq/)
* [  License ](https://capawesome.io/legal/eula/)
* [  Support ](/docs/support/)
* [  Contributing ](/docs/contributing/)
* Contributing code
* [  Code of Conduct ](/docs/contributing/code-of-conduct/)
* [  Questions ](https://docs.github.com/en/discussions/collaborating-with-your-community-using-discussions/participating-in-a-discussion#creating-a-discussion)
* [  Blog ](/blog/)
* Categories

* [  Use Cases ](#use-cases)
* [  Conclusion ](#conclusion)

* Related links

# Key-Value Storage Made Simple with the SQLite Plugin[¶](#key-value-storage-made-simple-with-the-sqlite-plugin "Permanent link")

Storing simple key-value data in Ionic and Capacitor apps often means choosing between unreliable browser storage or writing boilerplate SQL. The [Capacitor SQLite plugin](/docs/sdks/capacitor/sqlite/) now includes `SqliteKeyValueStore` — a built-in class that gives you a familiar `get`/`set` API backed by a real SQLite database. No SQL queries, no schema setup, no risk of data loss from WebView storage clearing. In this guide, you'll learn how to use `SqliteKeyValueStore` in your Capacitor apps and when to choose it over the [Capacitor Secure Preferences plugin](/docs/sdks/capacitor/secure-preferences/).

No SQL, no schema; when you need more, use the same **Capacitor SQLite plugin** and the full [plugin documentation](/docs/sdks/capacitor/sqlite/#key-value-store).

[ ![Build and deploy your Capacitor app with Capawesome Cloud](../../assets/external/cloud.capawesome.io/assets/banners/cloud-build-and-deploy-capacitor-apps.69628c3f.png) ](/) 

## What is `SqliteKeyValueStore`?[¶](#what-is-sqlitekeyvaluestore "Permanent link")

`SqliteKeyValueStore` is a built-in class shipped with the [Capacitor SQLite plugin](/docs/sdks/capacitor/sqlite/) that wraps a SQLite database behind a minimal key-value API. The database is automatically created and managed under the hood — you don't need to define schemas, write migrations, or execute any SQL. Values are stored as strings, so you can use `JSON.stringify` and `JSON.parse` to work with objects.

Here's what makes it a great choice for your next project:

* **Reliable persistence** — Data lives in a SQLite database file, not in WebView storage that the OS can clear at any time.
* **No SQL required** — A simple `get`/`set` interface. No schemas, no migrations, no queries.
* **Cross-platform** — Works on Android, iOS, Web, and Electron with a single API.
* **Performance** — SQLite is optimized for fast reads and writes, even with larger data sets.
* **Scales with your app** — Start with key-value storage today, graduate to full SQL queries later using the same plugin — no migration needed.

For more details on the available methods, check out the [Key-Value Store](/docs/sdks/capacitor/sqlite/#key-value-store) section in the plugin documentation.

## SQLite Key Value Store vs. Secure Preferences[¶](#sqlite-key-value-store-vs-secure-preferences "Permanent link")

If you're already familiar with the [Capacitor Secure Preferences plugin](/docs/sdks/capacitor/secure-preferences/), you might be wondering when to use which. Both provide key-value storage, but they're designed for different use cases:

| SQLite Key Value Store          | Secure Preferences                      |                                           |
| ------------------------------- | --------------------------------------- | ----------------------------------------- |
| **Best for**                    | App settings, caching, larger data sets | Sensitive data (tokens, keys, secrets)    |
| **Encryption**                  | Optional (requires SQLCipher setup)     | Built-in, uses platform keychain/keystore |
| **Third-party dependency**      | SQLCipher (only if encryption needed)   | None                                      |
| **Performance with large data** | Optimized (SQLite engine)               | Designed for small values                 |
| **SQL upgrade path**            | Yes, same plugin                        | No                                        |

Use [Capacitor Secure Preferences plugin](/docs/sdks/capacitor/secure-preferences/) for sensitive credentials that need encryption by default with zero setup. Use [SQLite Key Value Store](/docs/sdks/capacitor/sqlite/#key-value-store) when you need reliable persistence for larger data sets with SQLite-level performance and an optional upgrade path to full SQL.

## Getting Started[¶](#getting-started "Permanent link")

To get started with `SqliteKeyValueStore`, you first need to install the [Capacitor SQLite plugin](/docs/sdks/capacitor/sqlite/). Please refer to the [Installation](/docs/sdks/capacitor/sqlite/#installation) section in the plugin documentation.

## Usage[¶](#usage "Permanent link")

Once the plugin is installed, you can start using `SqliteKeyValueStore` right away. Let's walk through the most common operations.

### Storing Data[¶](#storing-data "Permanent link")

First, create a `SqliteKeyValueStore` instance. Then use [set(...)](/docs/sdks/capacitor/sqlite/#set) to store simple strings or JSON-serialized objects:

`[](#%5F%5Fcodelineno-0-1)import { Sqlite, SqliteKeyValueStore } from '@capawesome-team/capacitor-sqlite';
[](#%5F%5Fcodelineno-0-2)
[](#%5F%5Fcodelineno-0-3)const store = new SqliteKeyValueStore(Sqlite);
[](#%5F%5Fcodelineno-0-4)
[](#%5F%5Fcodelineno-0-5)// Store a simple string value
[](#%5F%5Fcodelineno-0-6)await store.set({ key: 'language', value: 'en' });
[](#%5F%5Fcodelineno-0-7)
[](#%5F%5Fcodelineno-0-8)// Store an object as a JSON string
[](#%5F%5Fcodelineno-0-9)const preferences = { theme: 'dark', fontSize: 16, notifications: true };
[](#%5F%5Fcodelineno-0-10)await store.set({ key: 'preferences', value: JSON.stringify(preferences) });
`

### Retrieving Data[¶](#retrieving-data "Permanent link")

Use [get(...)](/docs/sdks/capacitor/sqlite/#get) to read a value by its key. The returned `value` is `null` if the key doesn't exist, so always check before parsing:

`[](#%5F%5Fcodelineno-1-1)const { value } = await store.get({ key: 'preferences' });
[](#%5F%5Fcodelineno-1-2)if (value) {
[](#%5F%5Fcodelineno-1-3)  const preferences = JSON.parse(value);
[](#%5F%5Fcodelineno-1-4)  console.log(preferences.theme); // 'dark'
[](#%5F%5Fcodelineno-1-5)}
`

### Removing Data[¶](#removing-data "Permanent link")

Use `remove(...)` to delete a single key or `clear()` to wipe all stored data:

`[](#%5F%5Fcodelineno-2-1)await store.remove({ key: 'language' });
[](#%5F%5Fcodelineno-2-2)
[](#%5F%5Fcodelineno-2-3)await store.clear();
`

### Listing All Keys[¶](#listing-all-keys "Permanent link")

Use `keys()` to get a list of all stored keys:

`[](#%5F%5Fcodelineno-3-1)const { keys } = await store.keys();
[](#%5F%5Fcodelineno-3-2)console.log(keys); // ['preferences', 'onboardingComplete', ...]
`

## Use Cases[¶](#use-cases "Permanent link")

Here are some common scenarios where `SqliteKeyValueStore` is a great fit:

* **User preferences** — Theme, language, font size, or notification settings. Data persists reliably across app restarts without worrying about WebView storage limits.
* **Feature flags and onboarding state** — Track which features are enabled or whether the user has completed onboarding. Simple boolean or string values that need to survive app updates.
* **Lightweight caching** — Cache API responses or computed results as JSON strings. SQLite performance keeps reads fast even as your cache grows.

## Conclusion[¶](#conclusion "Permanent link")

`SqliteKeyValueStore` gives you reliable, performant key-value storage with zero SQL boilerplate — and a clear path to full SQL when your app needs it. If you're looking for a simple yet robust way to persist data in your Capacitor app, give it a try.

**Resources:**\- [Plugin docs](/docs/sdks/capacitor/sqlite/)\- [Key-Value Store API](/docs/sdks/capacitor/sqlite/#key-value-store)

**Related guides:**

* For raw API usage [Exploring the Capacitor SQLite API](/blog/exploring-the-capacitor-sqlite-api/)
* [Encrypting SQLite databases](/blog/encrypting-capacitor-sqlite-database/)
* ORMs: [TypeORM](/blog/how-to-use-typeorm-with-capacitor-and-sqlite/), [Drizzle ORM](/blog/how-to-use-drizzle-orm-with-capacitor-and-sqlite/), [Kysely](/blog/how-to-use-kysely-with-capacitor-and-sqlite/)

If you have any questions or need help, join the [Capawesome Discord server](https://discord.gg/VCXxSVjefW) to connect with the community. To stay updated with the latest news about Capawesome, Capacitor, and the Ionic ecosystem, subscribe to the [Capawesome newsletter](/newsletter/).

June 8, 2026 

 Back to top 