angularsqliteionic-frameworkcapacitorionic7

how to set up SQLite database using capacitor for ionic application with angular?


I am using the Ionic framework with Angular and Capacitor to build a chat application. I want to implement storage in my application. I am trying to set up an SQLite database for my Capacitor project. The purpose of using SQLite is so that I can store data locally in SQLite database after fetching it from server, so that I can get data even if server does not respond or store previous chat data even when we are offline.
I am using MongoDB in the backend, but the primary database model for SQLite is Relational DBMS. How can I make this work together?

I am hardly able to find any solution for this. Can anyone please guide me with all the steps required to set up SQLite for capacitor project.


Solution

  • I had a similar issue and managed to set up an SQLite database for my Ionic App using this example. The process was a pain though (not just for me). Since you don't seem to need a relational database (you're already using MongoDB), I would recommend letting go of SQLite and using e.g. Ionic Storage instead.