---
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
---

<!doctype html> 

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

[🖥️ Introducing the **Capacitor Electron Platform** — build desktop apps for macOS, Windows, and Linux. Free & open source. ](/blog/announcing-the-capacitor-electron-platform/) 

* [ 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/)
* [ Gyroscope ](/docs/sdks/capacitor/gyroscope/)
* [ Haptics ](/docs/sdks/capacitor/haptics/)
* [ Home Indicator ](/docs/sdks/capacitor/home-indicator/)
* [ In-App Browser ](/docs/sdks/capacitor/in-app-browser/)
* [ Install Referrer ](/docs/sdks/capacitor/install-referrer/)
* [ Intercom ](/docs/sdks/capacitor/intercom/)
* [ Intune ](/docs/sdks/capacitor/intune/)
* [ Keep Awake ](/docs/sdks/capacitor/keep-awake/)
* [ libSQL ](/docs/sdks/capacitor/libsql/)
* [ Light Sensor ](/docs/sdks/capacitor/light-sensor/)
* [ Live Update ](/docs/sdks/capacitor/live-update/)
* [ Localization ](/docs/sdks/capacitor/localization/)
* [ Mail Composer ](/docs/sdks/capacitor/mail-composer/)
* [ Managed Configurations ](/docs/sdks/capacitor/managed-configurations/)
* [ Maps Launcher ](/docs/sdks/capacitor/maps-launcher/)
* [ Media Session ](/docs/sdks/capacitor/media-session/)
* [ ML Kit ](/docs/sdks/capacitor/mlkit/)
* [ Navigation Bar ](/docs/sdks/capacitor/navigation-bar/)
* [ Network ](/docs/sdks/capacitor/network/)
* [ NFC ](/docs/sdks/capacitor/nfc/)
* [ Node.js ](/docs/sdks/capacitor/nodejs/)
* [ OAuth ](/docs/sdks/capacitor/oauth/)
* [ Passkeys ](/docs/sdks/capacitor/passkeys/)
* [ Password Autofill ](/docs/sdks/capacitor/password-autofill/)
* [ PDF Generator ](/docs/sdks/capacitor/pdf-generator/)
* [ PDF Viewer ](/docs/sdks/capacitor/pdf-viewer/)
* [ Pedometer ](/docs/sdks/capacitor/pedometer/)
* [ Permissions ](/docs/sdks/capacitor/permissions/)
* [ Phone Dialer ](/docs/sdks/capacitor/phone-dialer/)
* [ Photo Editor ](/docs/sdks/capacitor/photo-editor/)
* [ Photo Manipulator ](/docs/sdks/capacitor/photo-manipulator/)
* [ PixLive ](/docs/sdks/capacitor/pixlive/)
* [ PostHog ](/docs/sdks/capacitor/posthog/)
* [ Printer ](/docs/sdks/capacitor/printer/)
* [ Privacy Screen ](/docs/sdks/capacitor/privacy-screen/)
* [ Proximity Sensor ](/docs/sdks/capacitor/proximity-sensor/)
* [ Purchases ](/docs/sdks/capacitor/purchases/)
* [ RealtimeKit ](/docs/sdks/capacitor/realtimekit/)
* [ Root Detection ](/docs/sdks/capacitor/root-detection/)
* [ Screen Brightness ](/docs/sdks/capacitor/screen-brightness/)
* [ Screen Orientation ](/docs/sdks/capacitor/screen-orientation/)
* [ Screen Reader ](/docs/sdks/capacitor/screen-reader/)
* [ Screenshot ](/docs/sdks/capacitor/screenshot/)
* [ Secure Preferences ](/docs/sdks/capacitor/secure-preferences/)
* [ Settings Launcher ](/docs/sdks/capacitor/settings-launcher/)
* [ Shake ](/docs/sdks/capacitor/shake/)
* [ Silent Mode ](/docs/sdks/capacitor/silent-mode/)
* [ SIM ](/docs/sdks/capacitor/sim/)
* [ SMS Composer ](/docs/sdks/capacitor/sms-composer/)
* [ 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/)
* [ System WebView ](/docs/sdks/capacitor/system-webview/)
* [ Tauri ](/docs/sdks/capacitor/tauri/)
* [ Text Interaction ](/docs/sdks/capacitor/text-interaction/)
* [ Text Zoom ](/docs/sdks/capacitor/text-zoom/)
* [ Thermal State ](/docs/sdks/capacitor/thermal-state/)
* [ Toast ](/docs/sdks/capacitor/toast/)
* [ Torch ](/docs/sdks/capacitor/torch/)
* [ Vault ](/docs/sdks/capacitor/vault/)
* [ Volume ](/docs/sdks/capacitor/volume/)
* [ Wallet ](/docs/sdks/capacitor/wallet/)
* [ Wifi ](/docs/sdks/capacitor/wifi/)
* [ YouTube Player ](/docs/sdks/capacitor/youtube-player/)
* [ 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, Yarn, or bun ](/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)
* [ FAQ ](#faq)
* [ 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](https://capawesome.io/assets/banners/cloud-build-and-deploy-capacitor-apps.png?t=1) ](/) 

## 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](/blog/announcing-the-capacitor-electron-platform/) 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.

## FAQ[¶](#faq "Permanent link")

### Do I need to write SQL to use `SqliteKeyValueStore`?[¶](#do-i-need-to-write-sql-to-use-sqlitekeyvaluestore "Permanent link")

No. `SqliteKeyValueStore` wraps the [Capacitor SQLite plugin](/docs/sdks/capacitor/sqlite/) with a simple `set` / `get` / `remove` API, so you get SQLite's reliability and performance without writing a single query. If your needs grow, you can drop down to full SQL with the same plugin.

### When should I use this instead of Secure Preferences?[¶](#when-should-i-use-this-instead-of-secure-preferences "Permanent link")

Use `SqliteKeyValueStore` for app settings, caching, and larger data sets where you want SQLite-level performance and an upgrade path to full SQL. Use the [Capacitor Secure Preferences plugin](/docs/sdks/capacitor/secure-preferences/) for sensitive values like tokens and keys, which need encryption by default with zero setup. See [SQLite Key Value Store vs. Secure Preferences](#sqlite-key-value-store-vs-secure-preferences) for a side-by-side comparison.

### Which platforms does it support?[¶](#which-platforms-does-it-support "Permanent link")

It runs on Android, iOS, Web, and [Electron](/blog/announcing-the-capacitor-electron-platform/) with a single API, since it's part of the Capacitor SQLite plugin.

### Can I encrypt the stored values?[¶](#can-i-encrypt-the-stored-values "Permanent link")

Yes, optionally. The underlying SQLite database supports encryption via SQLCipher when you need it. If encryption is your primary requirement, though, the Secure Preferences plugin provides it out of the box without extra setup.

## 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/).

July 15, 2026 

Back to top

```json
{
      "@context": "https://schema.org",
      "@type": "BlogPosting",
      "headline": "Key-Value Storage Made Simple with the SQLite Plugin",
      "description": "Learn how to use SqliteKeyValueStore for simple, reliable key-value storage in your Capacitor apps without writing a single SQL query.",
      "image": "https://capawesome.io/assets/banners/cloud-build-and-deploy-capacitor-apps.png",
      "datePublished": "2026-02-13T00:00:00+00:00",
      "dateModified": "2026-07-14T00:00:00+00:00",
      "author": [
        {
          "@type": "Person",
          "name": "Robin Genz",
          "url": "https://github.com/robingenz"
        }
      ],
      "publisher": {
        "@type": "Organization",
        "name": "Capawesome",
        "url": "https://capawesome.io",
        "logo": {
          "@type": "ImageObject",
          "url": "https://capawesome.io/assets/images/logo.svg"
        }
      },
      "articleSection": "Capacitor",
      "keywords": ["Capacitor", "Guides", "SDKs"],
      "isPartOf": {
        "@type": "Blog",
        "@id": "https://capawesome.io/blog/#blog"
      },
      "mainEntityOfPage": "https://capawesome.io/blog/key-value-storage-made-simple-with-the-sqlite-plugin/",
      "url": "https://capawesome.io/blog/key-value-storage-made-simple-with-the-sqlite-plugin/"
    }
{
      "@context": "https://schema.org",
      "@type": "BreadcrumbList",
      "itemListElement": [
        {
          "@type": "ListItem",
          "position": 1,
          "name": "Home",
          "item": "https://capawesome.io/"
        },
        {
          "@type": "ListItem",
          "position": 2,
          "name": "Blog",
          "item": "https://capawesome.io/blog/"
        },
        {
          "@type": "ListItem",
          "position": 3,
          "name": "Key-Value Storage Made Simple with the SQLite Plugin",
          "item": "https://capawesome.io/blog/key-value-storage-made-simple-with-the-sqlite-plugin/"
        }
      ]
    }
{"@context": "https://schema.org", "@type": "FAQPage", "mainEntity": [{"@type": "Question", "name": "What is SqliteKeyValueStore?", "acceptedAnswer": {"@type": "Answer", "text": "SqliteKeyValueStore is a built-in class shipped with the Capacitor SQLite plugin 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 section in the plugin documentation."}}, {"@type": "Question", "name": "Do I need to write SQL to use SqliteKeyValueStore?", "acceptedAnswer": {"@type": "Answer", "text": "No. SqliteKeyValueStore wraps the Capacitor SQLite plugin with a simple set / get / remove API, so you get SQLite's reliability and performance without writing a single query. If your needs grow, you can drop down to full SQL with the same plugin."}}, {"@type": "Question", "name": "When should I use this instead of Secure Preferences?", "acceptedAnswer": {"@type": "Answer", "text": "Use SqliteKeyValueStore for app settings, caching, and larger data sets where you want SQLite-level performance and an upgrade path to full SQL. Use the Capacitor Secure Preferences plugin for sensitive values like tokens and keys, which need encryption by default with zero setup. See SQLite Key Value Store vs. Secure Preferences for a side-by-side comparison."}}, {"@type": "Question", "name": "Which platforms does it support?", "acceptedAnswer": {"@type": "Answer", "text": "It runs on Android, iOS, Web, and Electron with a single API, since it's part of the Capacitor SQLite plugin."}}, {"@type": "Question", "name": "Can I encrypt the stored values?", "acceptedAnswer": {"@type": "Answer", "text": "Yes, optionally. The underlying SQLite database supports encryption via SQLCipher when you need it. If encryption is your primary requirement, though, the Secure Preferences plugin provides it out of the box without extra setup."}}], "url": "https://capawesome.io/blog/key-value-storage-made-simple-with-the-sqlite-plugin/"}
```
