Ionic 5 – capacitor SQLite Database

Table of Contents

How to add SQLite Database in to your Ionic Project fast and easy without any issues with some short snippets that are very easy to understand!


Installing & Run

import { defineCustomElements as jeepSqlite} from 'jeep-sqlite/loader';


If you need to install some other platform

					npm install @capacitor/android
npm install @capacitor/ios
npm i @capacitor-community/electron

Install SQLite for Capacitor.

					npm install  @capacitor-community/sqlite
npm run build
npx cap add android
npx cap add ios
npx cap add @capacitor-community/electron


If you want sqlite with web apps



Code updating

					npx cap sync
npx cap sync @capacitor-community/electron

For Web App

					copy manually the file sql-wasm.wasm from nodes_modules/sql.js/dist/sql-wasm.wasm to the src/assets folder of YOUR_APP

Electron App

					cd electron
npm install --save sqlite3
npm install --save-dev @types/sqlite3
npm run build

Build App

					npm run build
npx cap copy
npx cap copy web
npx cap copy @capacitor-community/electron
					npx cap serve
npx cap open ios
npx cap open android
npx cap open @capacitor-community/electron

Thats it so far have fun