Easy SQLite Alternative?
My app is Node.JS + Express. I love SQLite but it apparently doesn't work with Railway because the data does not persist. Is there an extremely easy alternative that is very easy to use across multiple development PCs? SQLite was nice because I have a script that automatically populates the database when my app starts.
I'm willing to pay for some kind of cloud hosted database if it's easy to copy/paste a database string. Postgres has been a nightmare trying to develop locally on multiple machines. Is there a cloud solution that makes Postgres easy? Looking to keep it extremely simple like SQLite.
Solution:Jump to solution
I got SQLite working by creating a "/database" volume and then using this database config in my server.js file:
let db = new sqlite3.Database('/database/database.db');
This is resolved. Woohoo! Very happy with this π...
16 Replies
Project ID:
N/A
you can use sqlite just fine on railway, all you need to do is save the sqlite database file into a railway volume https://docs.railway.app/guides/volumes
Thank you so much! I was looking in the database section of the docs and didn't see SQLite as an option. I'll give this a shot β€οΈ
been using a service that uses sqlite in a volume, redeployed multiple times and ive never had any issues
Fantastic
because sqlite isnt a database offering, its something your app creates itself!
That makes sense!
So, I'm following those docs but I think the app may have updated. I don't seem to have the option to create a storage volume?
right click on the service
Is this the service? I tried here too but it won't accept anything when I try to make a volume
I tried creating a blank service too but I can't seem to make a volume
you are now selected on what railway refers to as a service.
what have you tried entering into the mount path pop up?
Ah, shoot. It just has to start with a slash. My bad been a long day π
no worries!
Solution
I got SQLite working by creating a "/database" volume and then using this database config in my server.js file:
let db = new sqlite3.Database('/database/database.db');
This is resolved. Woohoo! Very happy with this π
aswome, glad i could help!