When a website does not need a database

Engineering note, , by Kansi Digital Library Foundation

A database was available for this project from the first day. The site does not use one. This note records the reasoning, because a decision not to add something deserves documenting as much as a decision to add it.

What a database would have held

Four kinds of data were candidates:

  • Service descriptions and publications. These change when the founder edits them, a few times a month at most.
  • Contact enquiries. These arrive from visitors.
  • Knowledge for the assistant. The text the site’s assistant is allowed to draw on.
  • Administrative users. Accounts for whoever edits the above.

What is used instead

Content lives in the repository. Service and expertise descriptions are typed data files and articles are Markdown files. Publishing is a commit. Version control supplies history, review and rollback for free, and the pages are generated ahead of time, so there is no query to run when a visitor arrives.

Enquiries go to an inbox. The API validates an enquiry and forwards it by email. Nothing is stored, so there is no table of personal data to secure, back up or delete on request.

The assistant reads the site. The build publishes a single file containing the site’s own text. The assistant is given that file and nothing else. It cannot drift from what the pages say, because it is generated from the same source.

There are no accounts. With no database-backed content, there is no admin screen, and so no login to attack.

What this buys

  • No database to patch, back up or pay for.
  • A smaller attack surface: no SQL, no sessions, no administrative interface.
  • Pages that are served from a CDN as static files.

When to revisit

The decision is right for the current shape of the site and wrong under any of these conditions:

  1. Someone who does not use Git needs to publish content.
  2. Enquiries need tracking, assignment or reporting beyond what an inbox offers.
  3. The assistant’s knowledge outgrows a single file and needs retrieval over many documents.
  4. Any feature needs user accounts.

The planned path in each case is PostgreSQL through Supabase, with Row Level Security enabled on every table from the start. The schema this would use is sketched in the project’s documentation so that the move, if it comes, is a planned step.

Questions about this article?

Describe what you need. Kansi reads every enquiry and replies by email.

Contact Kansi

Ask about KDLF

I answer from what is published on this site: services, expertise, projects and research. For anything else, use the contact page.

An AI assistant. It can be wrong. Contact Kansi for a definite answer.