Where do you store your apps flat file databases?

imthedeveloper

ImTheDeveloper

Posted on March 23, 2018

Where do you store your apps flat file databases?

Hi All,

I've built a small node.js application which uses a local JSON file to persist data across restarts (nedb npm package for reference). I currently have this file set in my .gitignore and it is simply held within a Database folder in my project.

I'm using ansible to deploy my program to my production server, which will pull down the latest remote git repo and run the install/build and startup. I'm starting to wonder however where a sensible place would be to store the JSON file that is created upon first start up of the application.

Does storing it WITHIN the project folders make sense? I have noticed a few developers, especially on ubuntu save it to the users home directory and sometimes even as a hidden folder e.g. /home/user/.app/database.json

What is best practice in this case? My only worry is that potentially that project folder could get deleted, for whatever reason maybe to do a complete fresh install, but I would always like to keep the database file intact.

Happy for thoughts and discussions on this as I think people tend to do this in lots of different ways.

💖 💪 🙅 🚩
imthedeveloper
ImTheDeveloper

Posted on March 23, 2018

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related