Offline SQLite storage pattern Vue3 and Pinia

I’m using Ionic, Vue3, Pinia, for a mobile app I’m building. I’m currently working on storage of videos for offline use. I’ve decided to use SQLite and store the video files as blobs. I hope that is ok. As far as design patterns for storing and retrieving data I thought about creating a databaseStore since I’m using Pinia for state management and I’m curious if that makes sense or if there is a better pattern to follow.
I was mainly going to use the actions portion of the store to read and write from the DB. Curious if thats alright or if there is a better pattern or way to go about it.

before you add a store, ask yourself why you are adding a store and do you really need it. Your application is reading and writing from the file system, what state are you keeping in the store other that the videos? Can it just be managed more efficiently with composables? Will it be easier to maintaining without the store and it that just another level of complexity for the sake of playing with pinia?

Introduction - Why Should I Use Pinia | Pinia (

1 Like

So Pinia is being used to manage state throughout the app when there is an internet / data connection. For all the API calls and whenever there preference changes (light / dark mode) adding favorites / archives. I decided to use Pinia (stores) because once this app is built and out we are rebuilding out current member site and will be using Pinia. So I guess it was just partially for me to get a head start on learning it all too.

Sounds like you have already committed to pinia so it would be odd to exclude that video interactions from the store

The way I ended up doing it was setting up the store as a repository pattern so the interactions between the sqlite and filesystem plugins are seamless.

I would store the videos as files and save their path to the DB