I'm new to web development and still getting used to how server-side applications handle persistence. For a small amount of data—such as whether a user prefers chocolate or vanilla—why couldn't I simply write the data to a JSON file in the same directory as the application? There seem to be many different storage technologies and several layers of setup for even simple information. Is using a JSON file reasonable for a small project, and what problems would I run into as the number of users or requests grows?
3 Answers
A JSON file is perfectly reasonable for read-only data, a small cache, a personal tool, or a private site with one administrator. It becomes a poor fit when multiple users need to write data simultaneously. If the application runs on multiple machines, each machine may have a different local file, and many hosting platforms can delete or replace local disk contents during redeployment or restarts.
The main question is what guarantees the data needs. If losing or corrupting the whole file is acceptable, JSON may be fine for a quick experiment. If you need reliable updates, searching among lots of records, reporting, permissions, backups, or recovery after a crash, a database saves you from implementing all those edge cases yourself. You can start with JSON to learn, but SQLite is usually the easiest production-minded option.
Nothing technically prevents you from doing this for a tiny app running on one machine with very few users. The trouble starts when several requests try to update the file at once, or when a process crashes during a write. You can end up with lost updates, corrupted data, or a file that is only partially written. A database already handles locking, transactions, recovery, and querying for you.
A safe file-based implementation can reduce some of the risk by writing a temporary file and atomically renaming it over the original, while keeping a backup. That still doesn’t solve concurrent updates or the cost of rewriting the entire file for every small change.

Client-side storage can work for a static, single-device app, but it won’t follow the user to another device and shouldn’t be used for important server-controlled data.