Where should your project keep its data? A text file, Git or a database

Three places a small project can keep its data: a plain text file, a Git repository or a database. What each is good at, where it hurts, and a simple rule for choosing, from how we run our own systems.

Published · 4 min read · Flowsmith editorialAcademy toolsdataCloudflare

Three dark containers side by side: a single sheet, a stack of sheets bound along one edge, and a cabinet with many small drawers, one drawer lit in blue.
Illustration drawn for this article. No text in the image, so it works in every language.
In short
  • Text file (Markdown, JSON, CSV): simplest, readable by everyone. Good for small, slow-changing data edited by one hand at a time.
  • Git: text files with history, review and rollback. Good for content and rules that people approve before they go live.
  • Database (for example Cloudflare D1): good for many records, frequent changes, several writers at once, search, and anything personal.
  • A quick rule: approved content → Git, operational records → database, everything people or agents read in bulk → a text file generated from them.

Where to start (direct links): GitHub — sign up · Cloudflare — sign up · Cloudflare D1 — docs

Three places for data, from the simplest to the most structured
  • a plain text file
  • git: versions and history
  • a database: rows and columns, many writers
  • from simple to structured

Sooner or later every project has to remember something: a list of products, form submissions, the steps of a lesson, a price, a customer's request. Beginners often pick whatever is closest, usually a spreadsheet or a JSON file, and discover the limits later. This article compares the three places we actually use, so you can choose on purpose.

A plain text file

A text file is the most honest storage there is: open it and you see everything. Markdown for prose, JSON for structured settings, CSV for simple tables.

  • Good: zero setup, readable by people and AI agents, easy to copy and back up.
  • Hurts when: two people (or agents) edit it at once, the file grows to thousands of rows, or you need to ask "show me all orders from last week over 500 EUR".
  • We use it for: configuration, lists of links, and generated files that machines read, such as llms.txt and the sitemap. More on those in llms.txt.

Git

Git is text files plus a memory. Every change has a version, an author, a time and a reason, and you can see the difference between any two versions.

  • Good: review before publishing (pull requests), rollback in one step, a full audit trail, and with Cloudflare Pages a push publishes automatically.
  • Hurts when: data changes many times a minute, many writers update the same record, or the data is personal: whatever enters Git history stays there, even after deletion.
  • We use it for: website pages and blog posts (this article is a file in a repository), standards and rules, project documentation. See GitHub for beginners.

A database

A database stores records in tables and lets programs read and write them safely at the same time. Until recently that meant running a server. A serverless database like Cloudflare D1 removed most of that: you create it in seconds and talk to it with ordinary SQL.

  • Good: thousands or millions of records, many writers, fast search and filtering, access rules per program, personal data kept out of repositories.
  • Hurts when: you want people to review every change before it takes effect, or you need to read the data without a tool. A database also needs its own backup; Git does not cover it.
  • We use it for: form submissions, the message board our AI agents use (agent bus), the register of company standards, site-quality measurements, tasks.

In depth: how to choose

QuestionText fileGitDatabase
How often does it change?RarelyDaily at most, in reviewed stepsAny time, many times a minute
How many writers at once?OneSeveral, through branchesMany
Do people approve changes first?InformallyYes, pull requestsUsually not
Need to search and filter?NoRarelyYes
Personal data?NoNeverYes, with access rules
History of changes?NoBuilt inOnly if you design it

The pattern that works for us

  1. Things people decide live in Git: page content, rules, prices on the website, standards.
  2. Things that happen live in a database: submissions, messages, measurements, tasks.
  3. Things machines read in bulk are generated text files: sitemap, llms.txt, a search index, built from Git and the database on every deploy, never edited by hand.

One honest exception: our company standards started as files in Git and moved to a database once several agents needed to read and update them many times a day. The change history moved with them as a written changelog inside each record, so we kept the audit trail Git used to give us. Moving data is normal; what matters is knowing why you store it where you do.

Mistakes we see most often

  • Secrets in a text file in the repository. They stay in history forever. Read handling secrets.
  • A spreadsheet as a database for data several programs write to. It works until two writes collide.
  • A database for content that should be reviewed. You lose the "look before it goes live" step.
  • No backup of the database because "it is in the cloud". See backing up a Cloudflare stack.

Next step

If your project is a website, start with Git and text files; add a database the day you need a form or a list that grows on its own. The Academy lessons zero to hello world and your first automation follow exactly that order.

Frequently asked questions

When is a plain text file enough?

When the data is small, changes rarely, is edited by one person or agent at a time and is mostly read by people: a list of links, a configuration, notes. Formats like Markdown, JSON or CSV work well.

Why put data in Git instead of a database?

Git gives every change a version, an author and a message, and lets you review changes before they go live. That suits content and configuration that people approve, such as blog posts, prices on a website or rules. It does not suit data that changes many times a minute.

When do I need a database?

When many records change often, several programs or agents write at the same time, you need to search and filter, or the data contains personal information that must not live in a repository. A serverless database such as Cloudflare D1 makes this step small.

Can I combine them?

Yes, and most real projects do: content and rules in Git, operational records in a database, and generated text files (like llms.txt or a sitemap) built from both on every deploy.

Written from our own production systems by the Flowsmith editorial team, with AI assistance.

Want this running in your company?

Flowsmith designs and operates automations like this for small and mid-sized teams — with a person approving anything that leaves the building.

More from the blog