---
description: The new Capacitor SQLite plugin brings enterprise-grade SQLite to Capacitor apps. Manage SQLite databases with encryption, transactions, migrations, and more.
title: Announcing the Capacitor SQLite Plugin - Capawesome
image: https://capawesome.io/docs/assets/images/social/blog/announcing-the-capacitor-sqlite-plugin.png
---

[ Skip to content](#announcing-the-sqlite-plugin-for-capacitor) 

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

* [  FAQ ](#faq)
* [  Conclusion ](#conclusion)

* Related links

# Announcing the SQLite Plugin for Capacitor[¶](#announcing-the-sqlite-plugin-for-capacitor "Permanent link")

We are thrilled to announce the launch of our comprehensive [Capacitor SQLite plugin](/docs/sdks/capacitor/sqlite/), the go-to **Capacitor SQLite** solution for Android, iOS, and web. This powerful database solution brings enterprise-grade SQLite functionality to your Capacitor applications with support for encryption, transactions, schema migrations, and seamless cross-platform compatibility. The plugin is now available for all Capawesome [Insiders](/docs/insiders/).

## Bonus: Video Tutorial and Demo App[¶](#bonus-video-tutorial-and-demo-app "Permanent link")

This video demonstrates the Capacitor SQLite plugin in a realistic app scenario, covering installation, database initialization, CRUD operations, and transactions that are ready to adapt for production projects.

* **[Angular Capacitor SQLite Demo](https://github.com/capawesome-team/capacitor-sqlite-angular-demo)** — Full source code for Angular + Capacitor + SQLite.
* **[React Capacitor SQLite Demo](https://github.com/capawesome-team/capacitor-sqlite-react-demo)** — Full source code for React + Capacitor + SQLite.

Let's explore the [API](/docs/sdks/capacitor/sqlite/#api) and key features that make this plugin a must-have for modern app development.

## Installation[¶](#installation "Permanent link")

To install the Capacitor SQLite plugin, please refer to the [Installation](/docs/sdks/capacitor/sqlite/#installation) section in the plugin documentation.

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

The Capacitor SQLite plugin offers a complete database management solution with intuitive APIs for all your data operations. Let's walk through the essential features that make this plugin indispensable for modern app development.

### Opening a database[¶](#opening-a-database "Permanent link")

Start by opening a database connection with the [open(...)](/docs/sdks/capacitor/sqlite/#open) method. This method supports both file-based and in-memory databases, with optional encryption and automatic schema migrations:

`[](#%5F%5Fcodelineno-0-1)import { Sqlite } from "@capawesome-team/capacitor-sqlite";
[](#%5F%5Fcodelineno-0-2)
[](#%5F%5Fcodelineno-0-3)const openDatabase = async () => {
[](#%5F%5Fcodelineno-0-4)  const { databaseId } = await Sqlite.open({
[](#%5F%5Fcodelineno-0-5)    encryptionKey: 'your-secret-key',
[](#%5F%5Fcodelineno-0-6)    path: 'db.sqlite3',
[](#%5F%5Fcodelineno-0-7)    upgradeStatements: [
[](#%5F%5Fcodelineno-0-8)      {
[](#%5F%5Fcodelineno-0-9)        version: 1,
[](#%5F%5Fcodelineno-0-10)        statements: [
[](#%5F%5Fcodelineno-0-11)          'CREATE TABLE users (id INTEGER PRIMARY KEY, name TEXT NOT NULL, email TEXT UNIQUE)',
[](#%5F%5Fcodelineno-0-12)          'CREATE TABLE posts (id INTEGER PRIMARY KEY, user_id INTEGER, title TEXT, content TEXT)'
[](#%5F%5Fcodelineno-0-13)        ]
[](#%5F%5Fcodelineno-0-14)      }
[](#%5F%5Fcodelineno-0-15)    ],
[](#%5F%5Fcodelineno-0-16)    version: 1
[](#%5F%5Fcodelineno-0-17)  });
[](#%5F%5Fcodelineno-0-18)
[](#%5F%5Fcodelineno-0-19)  console.log('Database opened with ID:', databaseId);
[](#%5F%5Fcodelineno-0-20)  return databaseId;
[](#%5F%5Fcodelineno-0-21)};
`

If no database file exists, it will be created automatically. The `encryptionKey` parameter enables database encryption, ensuring your data remains secure. The `upgradeStatements` parameter enables seamless database migrations, automatically applying schema changes when your app updates.

If you omit the `path` option, the plugin will create an in-memory database, which is extremely useful for testing or temporary data storage.

### Executing SQL statements[¶](#executing-sql-statements "Permanent link")

Execute data modification operations like `INSERT`, `UPDATE`, and `DELETE` using the [execute(...)](/docs/sdks/capacitor/sqlite/#execute) method. This method supports parameterized queries to prevent SQL injection attacks and ensure data integrity:

`[](#%5F%5Fcodelineno-1-1)import { Sqlite } from "@capawesome-team/capacitor-sqlite";
[](#%5F%5Fcodelineno-1-2)
[](#%5F%5Fcodelineno-1-3)const insertUser = async (databaseId: string) => {
[](#%5F%5Fcodelineno-1-4)  const { rowId } = await Sqlite.execute({
[](#%5F%5Fcodelineno-1-5)    databaseId,
[](#%5F%5Fcodelineno-1-6)    statement: 'INSERT INTO users (name, email) VALUES (?, ?)',
[](#%5F%5Fcodelineno-1-7)    values: ['John Doe', 'john.doe@example.com']
[](#%5F%5Fcodelineno-1-8)  });
[](#%5F%5Fcodelineno-1-9)  console.log('Inserted user with ID: ', rowId);
[](#%5F%5Fcodelineno-1-10)};
[](#%5F%5Fcodelineno-1-11)
[](#%5F%5Fcodelineno-1-12)const updateUser = async (databaseId: string, userId: number) => {
[](#%5F%5Fcodelineno-1-13)  const { changes } = await Sqlite.execute({
[](#%5F%5Fcodelineno-1-14)    databaseId,
[](#%5F%5Fcodelineno-1-15)    statement: 'UPDATE users SET email = ? WHERE id = ?',
[](#%5F%5Fcodelineno-1-16)    values: ['john.updated@example.com', userId]
[](#%5F%5Fcodelineno-1-17)  });
[](#%5F%5Fcodelineno-1-18)  console.log('Updated user, number of rows affected: ', changes);
[](#%5F%5Fcodelineno-1-19)};
`

For multiple operations, leverage transaction support to ensure data consistency:

`[](#%5F%5Fcodelineno-2-1)const performTransaction = async (databaseId: string) => {
[](#%5F%5Fcodelineno-2-2)  // Begin a transaction
[](#%5F%5Fcodelineno-2-3)  await Sqlite.beginTransaction({ databaseId });
[](#%5F%5Fcodelineno-2-4)  // Perform multiple operations within the transaction
[](#%5F%5Fcodelineno-2-5)  await Sqlite.execute({
[](#%5F%5Fcodelineno-2-6)    databaseId,
[](#%5F%5Fcodelineno-2-7)    statement: 'INSERT INTO users (name, email) VALUES (?, ?)',
[](#%5F%5Fcodelineno-2-8)    values: ['Alice Smith', 'alice@example.com']
[](#%5F%5Fcodelineno-2-9)  });
[](#%5F%5Fcodelineno-2-10)  await Sqlite.execute({
[](#%5F%5Fcodelineno-2-11)    databaseId,
[](#%5F%5Fcodelineno-2-12)    statement: 'INSERT INTO posts (user_id, title, content) VALUES (?, ?, ?)',
[](#%5F%5Fcodelineno-2-13)    values: [1, 'My First Post', 'Hello world!']
[](#%5F%5Fcodelineno-2-14)  });
[](#%5F%5Fcodelineno-2-15)  // Commit the transaction
[](#%5F%5Fcodelineno-2-16)  await Sqlite.commitTransaction({ databaseId });
[](#%5F%5Fcodelineno-2-17)};
`

You can also roll back transactions using the [rollbackTransaction(...)](/docs/sdks/capacitor/sqlite/#rollbacktransaction) method if an error occurs during the transaction.

### Querying data[¶](#querying-data "Permanent link")

To retrieve data, use the [query(...)](/docs/sdks/capacitor/sqlite/#query) method. This method supports complex SQL queries, including joins and aggregations, and returns results in a structured format:

`` [](#%5F%5Fcodelineno-3-1)import { Sqlite } from "@capawesome-team/capacitor-sqlite";
[](#%5F%5Fcodelineno-3-2)
[](#%5F%5Fcodelineno-3-3)const getUsers = async (databaseId: string) => {
[](#%5F%5Fcodelineno-3-4)  const result = await Sqlite.query({
[](#%5F%5Fcodelineno-3-5)    databaseId,
[](#%5F%5Fcodelineno-3-6)    statement: 'SELECT id, name, email FROM users WHERE name LIKE ?',
[](#%5F%5Fcodelineno-3-7)    values: ['%John%']
[](#%5F%5Fcodelineno-3-8)  });
[](#%5F%5Fcodelineno-3-9)
[](#%5F%5Fcodelineno-3-10)  console.log('Found users:', result.values);
[](#%5F%5Fcodelineno-3-11)  // Output: [{ id: 1, name: 'John Doe', email: 'john.doe@example.com' }]
[](#%5F%5Fcodelineno-3-12)
[](#%5F%5Fcodelineno-3-13)  return result.values;
[](#%5F%5Fcodelineno-3-14)};
[](#%5F%5Fcodelineno-3-15)
[](#%5F%5Fcodelineno-3-16)const getUserWithPosts = async (databaseId: string, userId: number) => {
[](#%5F%5Fcodelineno-3-17)  const result = await Sqlite.query({
[](#%5F%5Fcodelineno-3-18)    databaseId,
[](#%5F%5Fcodelineno-3-19)    statement: `
[](#%5F%5Fcodelineno-3-20)      SELECT u.name, u.email, p.title, p.content 
[](#%5F%5Fcodelineno-3-21)      FROM users u 
[](#%5F%5Fcodelineno-3-22)      LEFT JOIN posts p ON u.id = p.user_id 
[](#%5F%5Fcodelineno-3-23)      WHERE u.id = ?
[](#%5F%5Fcodelineno-3-24)    `,
[](#%5F%5Fcodelineno-3-25)    values: [userId]
[](#%5F%5Fcodelineno-3-26)  });
[](#%5F%5Fcodelineno-3-27)
[](#%5F%5Fcodelineno-3-28)  return result.values;
[](#%5F%5Fcodelineno-3-29)};
 ``

### Closing the database[¶](#closing-the-database "Permanent link")

As soon as you are done with the database operations, it is a good practice to close the database connection using the [close(...)](/docs/sdks/capacitor/sqlite/#close) method. This helps free up resources and ensures data integrity:

`[](#%5F%5Fcodelineno-4-1)import { Sqlite } from "@capawesome-team/capacitor-sqlite";
[](#%5F%5Fcodelineno-4-2)
[](#%5F%5Fcodelineno-4-3)const closeDatabase = async (databaseId: string) => {
[](#%5F%5Fcodelineno-4-4)  await Sqlite.close({ databaseId });
[](#%5F%5Fcodelineno-4-5)  console.log('Database connection closed');
[](#%5F%5Fcodelineno-4-6)};
`

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

##### Is the Capawesome SQLite plugin a fork of another plugin?[¶](#is-the-capawesome-sqlite-plugin-a-fork-of-another-plugin "Permanent link")

No, it is NOT a fork. The Capawesome SQLite plugin was developed from scratch over a period of 2 months, with a focus on performance, reliability, and ease of use. It is designed to be fully compatible with the Capacitor ecosystem while providing additional features and optimizations.

##### How does the Capawesome SQLite plugin compare to other SQLite plugins?[¶](#how-does-the-capawesome-sqlite-plugin-compare-to-other-sqlite-plugins "Permanent link")

Most other SQLite plugins are maintained by the community under an open-source license. While this makes it possible to offer the plugin free of charge, it does not ensure that the plugin receives regular updates and support. This can be a significant drawback, especially for commercial applications that require ongoing maintenance, feature enhancements and top-notch support. With the end of Ionic Secure Storage, there is now a need for a high-quality solution.

##### Is the Capawesome SQLite plugin compatible with the Capacitor Community SQLite plugin?[¶](#is-the-capawesome-sqlite-plugin-compatible-with-the-capacitor-community-sqlite-plugin "Permanent link")

Yes, the Capawesome SQLite plugin is designed to be compatible with the Capacitor Community SQLite plugin. This means you can easily migrate your existing applications to the Capawesome SQLite plugin without significant code changes. We will provide a migration guide to help you transition smoothly.

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

The [Capacitor SQLite plugin](/docs/sdks/capacitor/sqlite/) delivers a comprehensive database solution that scales with your application's needs. From simple data storage to complex relational operations with encryption and migrations, it provides the foundation for robust data management in Capacitor apps.

**Related reading:**

* [API Reference](/docs/sdks/capacitor/sqlite/#api) — Explore the complete plugin documentation for advanced features like read-only databases, custom encryption, and platform-specific optimizations
* For hands-on API usage: [Exploring the Capacitor SQLite API](/blog/exploring-the-capacitor-sqlite-api/)
* If you're migrating from the community plugin check [Alternative to the Capacitor Community SQLite plugin](/blog/alternative-to-capacitor-community-sqlite-plugin/)
* [Encrypting SQLite databases](/blog/encrypting-capacitor-sqlite-database/)
* [Key-Value Storage with the SQLite plugin](/blog/key-value-storage-made-simple-with-the-sqlite-plugin/)

**Missing a feature?** [Create a feature request](https://github.com/capawesome-team/capacitor-plugins/issues/new/choose) in our [GitHub repository](https://github.com/capawesome-team/capacitor-plugins).

Join the Capawesome [Discord](https://discord.gg/VCXxSVjefW) server for questions and subscribe to the Capawesome [newsletter](/newsletter/) to stay updated.

June 8, 2026 

 Back to top 