Can I just deploy a Node app with SQLite3 embedded to it?

Hi! I want to deploy a SvelteKit app with better-sqlite3 embedded to it. But I have zero experience with deploying full-stack apps or a docker containers. Excuse me as I must be missing some very basic ideas here.

Can I just containerize the whole app with SQLite3 and host it on Fly.io? I’ve read SQLite3 · Fly Docs and I'm All-In on Server-Side SQLite · Fly but couldn’t fully figure out how it works. I understand I must be using a ‘Volume’ as it provides a persistent storage, then am I hosting the whole app in that volume? Or will it be a separate deployment?

Thanks!

A volume works as if it were an extra hard-drive. Your docker image will dictate the main state of the system (OS + programs + your app). Any changes made to this part will be wiped with every restart, and changed whenever you change your docker image.

When you add a volume to your app, you designate a folder location (such as /data, but it might be any other name you want) at which the volume should be mounted. Now anything stored at this location (directly as well as any subfolders and their contents) will remain across restarts and changes to your docker image.


Indeed you can containerize and deploy your app together with SQLite this way. The only thing you need to keep in mind, is to make sure that SQLite stores its database file inside the volume’s directory.

1 Like