Best practice for my case - Should I use Ionic storage plugin or create a sqlite database?

I am going to create an app (iOS and Android) that will save data to the users device (text, images, files, etc) and will stay on the users device until they decide to send it to the server. I can do it either with a sqlite database or using ionic storage but I don’t know what the best practice would be

For simplicity I will only present two types of items that will be stored - notes and records

notes structure

`notes = { 
     description: this.description,
     'otherText': this.otherText,
     fileOrImage1: this.imageOrFileURL1,
     fileOrImage2: this.imageOrFileURL2,
    ..... Unlimited number of fileOrImageURL'S here
}'

records structure

`records = { 
     name: this.name,
     'description': this.description,
     // NOTE: These files and images are different than the ones above. They will be in separate components 
     fileOrImage1: this.imageOrFileURL1,  
     fileOrImage2: this.imageOrFileURL2,
    ..... Unlimited number of fileOrImageURL'S here
}'

The user will first store the data on the device and it will only get uploaded when the user sends it to the server. Once its uploaded it gets deleted.

There can be many notes and records, lets say 25 each. Should I use Ionic Storage or something like a sqlite database? If I use ionic storage I will need to create a unique ID for each note and record and save it.

I am willing to change my approach if anybody has a better way. I’m still in the planning stage

Hello :slight_smile:

As a user of a Backend-As-A-Service, I will try to to advise :slight_smile:

  • I built my entire database on ionic at first, for my app, but they closed the service 3 months later
  • as storage of files, and data is somewhat quite different, I’ll try to separate both

And, also a NoSQL database is far more speedy than a sqllite one :stuck_out_tongue: (with the right server)

Can anybody provide any feedback? Thanks

Use nosql as per earlier recommendation (ionic storage) to store meta data

Use file plugin to store the files

Unless u r working on a pwa

If the question you asked is about local (on client persistence) than your obvious choice is to leverage Ionic Storage as solution. The next question is which “adapter” of Ionic Storage (which is a wrapper around localForage project) to use.

If your app needs to store definitely more than 10-50mb of Data - you probably should rely on sqlite (it is slower than adapters such as indexeddb, but not considerably), which is only available if your project is cordova.

If you need to just cache a few things (even if blobs) until user gets online - I think you can get around with indexeddb (grown in cross browser support recently) or websql (works ok cross modern browsers).