For persistence, either credentials or data, is there any best practice that prefer DATABASES over FILES? Files such as JSON or txt or whatever...
Do dbs offer better perfomance or security?💾

  • 1
    "Is there any best practice that prefers databases over files" ?

    > all of them

    > why would you store datas in files???

    Only "env" file should contain important datas, but these datas are precisely there for a website's secret key or some key for google maps

    If anyone has access to your server by a way or another and reaches your files, you can kiss them goodbye
  • 0
    Some private and public keys and some spare configuration info are more suitable for plain files ..but user credentials, token, sessions, i'm not sure......
  • 0
    @Drillan767 is't that the same for a db? If I gain access to the backend I can probably see the db too 😅
    Or db credentials more than the db itself
  • 2
    Databases are
    - More efficient because you don't have to open a file every time
    - Easier to handle (edit and add datasets)
    - In some cases more secure because they need passwords
    And I'm sure there are many more reasons to use databases I can't think of right now. The only con is that they are harder to setup and require some knowledge.
  • 0
    It really depends on the app. Sometimes I use files as a quick and dirty database, either by json or just serialized data. If I care about data resilience, and tracking changes, with multiple requests using the same data, I'll use a proper database.
  • 0
    - serverbased databases : multiple client or concurrent connections
    - sqlite : local stuff, multiple rows persistent format, binary data
    - files : all other
Add Comment