The data from my tier system that I save in a json file as a database is erased by itself

What happens is that the level system that I have created stores the levels, exp and exp with which the user levels up in a json file, in which that data is stored, which recently
they delete themselves, although at first it only happened with that specific file, now it happens in others, what I would like to know is if it is a technical problem or if it could be something else. Help me please

Where are you saving that JSON file?

Ideally you’ll store persistent data like that in the /.data directory. If it’s stored in the /tmp directory it will get deleted everytime your project restarts (ie going 5 minutes without an HTTP request).

The json files were saved in a folder called mega_databases, for problems I had with the disk, I use .gitignore to occupy a little less, leaving them there, it never happened to me that the data will be deleted, but recently it happened to me, .gitignore will be affecting somehow?

A .gitignore file would not cause a file or a directory to be deleted, it just stops Glitch from keeping a revision history on it.

Have you checked to see if your code is accidentally deleting the file(s) when trying to update the data? If you share your project somebody may be able to help further…

I don’t think that’s it, since the only thing that the npm that I use to create the databases does is add, it doesn’t delete all the data in the file leaving it empty, that’s why it seemed very strange to me and I tried to know if it was something of glitch.

For now it did not happen again but I would like to be sure of knowing what it is and being able to fix it definitively.

And thank you very much for the responses.

First, I highly don’t recommend using JSON files as a database. Use SQLite or quick.db. Also, are you sure it is not corrupt. That could cause it to disappear. Try doing a direcory search for it.

Thanks for answering, I will try what you tell me and see what happens.

The best solution I found was to change the database, now I am using mongodb, which is a separate database that doesn’t take up the project disk and is easy to use. Thank you all for answering the questions I had <3