{
  "id": 19619436,
  "title": "No database on purpose: flat files are enough for a downloader",
  "url": "https://urgent.news/2026/11/12/no-database-on-purpose-flat-files-are-enough-for-a-downloader",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-11-12T07:50:04.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/mobeenahmedgondal/no-database-on-purpose-flat-files-are-enough-for-a-downloader-4bd2"
  },
  "original_language": "en",
  "account": "The story of a video downloader built using plain PHP for shared hosting brings to light the decision to forego databases in favor of flat files. This choice was not made recklessly, but rather as a deliberate move to keep the system simple and maintainable for a single individual.\n\nThe essential functions of the downloader are streamlined into three core components: a per-IP rate-limit counter, a cache of recent provider responses, and an error log. Each of these is stored as a separate file, eliminating the need for a complex database system. The rate limiter is managed by a JSON file per IP address, while the cache is organized as a folder of JSON files named with a hash of the video URL, each with a built-in expiry time. The error log is a straightforward text file, recording failures without any sensitive user data.\n\nThe reason for this file-based approach is rooted in the constraints of shared hosting. Shared hosting limits the use of databases, requiring additional services, credentials, and potential points of failure. By opting for flat files, the downloader avoids these complications. Moreover, files do not have connection limits, unlike MySQL, which can become a scarce resource on cheap plans, potentially blocking new visitors if connections are already in use.\n\nPerformance-wise, accessing and modifying small JSON files is swift and efficient, requiring no database query planner or index maintenance. This simplicity not only makes debugging easier, involving basic commands like ls and cat, but also keeps the site's state easily back up-able by simply zipping the folder.\n\nHowever, it is acknowledged that flat files have their limitations. They do not handle concurrent writes gracefully, potentially leading to file corruption issues if multiple requests attempt to write to the same file at once. This can be mitigated using flock(), but this may not suffice under heavier load. Additionally, flat files do not scale across multiple servers, as files on different servers will diverge, and searching through them is rudimentary, lacking SQL-like query capabilities.\n\nDespite these limitations, the current setup is suitable for the site's scale: a single server, one person, and a modest traffic volume. The decision to implement a database only when necessary, such as when dealing with relationships between records, large-scale queries, or state shared across servers, ensures that resources are not spent on unnecessary complexity.\n\nThe takeaway from this story is that the simplest solution often proves to be the most effective. As long as the site's requirements remain within the capabilities of flat files, maintaining this approach avoids unnecessary complications and aligns with the principle that the most straightforward solution is often the best. The site, ramrom.io, exemplifies this philosophy, running on PHP, flat files, and nothing else, demonstrating that simplicity can indeed be the best strategy.",
  "summary": "When I rebuilt my video downloader in plain PHP for shared hosting, the first thing I decided was what not to build. There would be no database. No MySQL, no SQLite, no tables, no migrations, no admin panel. Just files in folders. That sounds reckless if you have spent your career around databases. It felt reckless to me too, at first. But a year in, I have not missed one, and the decision is the…",
  "key_points": [
    "Downloader built with plain PHP for shared hosting",
    "Flat files used instead of databases for simplicity",
    "Single server, one person, modest traffic volume"
  ],
  "editors_take": "Prioritizing flat files over databases reduces infrastructure complexity and bypasses connection limits, allowing a single developer to maintain a functional system within the strict constraints of shared hosting environments.",
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}