Demo, all content is generated
Question

Do I need to move off SQLite now? 3k users, one server

Open · 984 views · asked by dental_dave · edited

Appointment reminder app for dental practices. Node + better-sqlite3 on one Hetzner VPS. 3k patients, 12 practices, a few hundred writes a day. Claude Code keeps saying I should "migrate to Postgres for scalability" every time I ask it anything. It works perfectly fine right now. Am I being stupid by staying?

What I’ve tried

Read some blog posts saying SQLite is fine for most apps and others saying never use it in production. Backups are a nightly cp of the file.

Comment
Litestream + SQLite on one VPS is a completely legit production setup. Ignore the AI on this one. pawel_z · edited

3 answers

fatima_z · edited

You're not being stupid. A few hundred writes a day on one server is a tiny load for SQLite. Postgres wouldn't make it faster for you.

But one thing needs fixing now: cp of a live SQLite file can produce a corrupt backup if a write happens during the copy (especially in WAL mode, where recent data is in the -wal file). Use the backup API instead:

sqlite3 app.db ".backup '/backups/app-$(date +%F).db'"

or VACUUM INTO, or Litestream for continuous backups to S3-compatible storage. Test a restore once.

The real reasons to move later: you need a second app server, or several processes writing heavily, or you want managed backups and point-in-time restore without running them yourself.

Comment
The cp thing scares me. Switched to .backup tonight and restored it on my laptop, works. dental_dave · edited
postgres_pete · edited

I mostly agree with Fatima, with one push back: medical practices tend to ask about backups, restore time and where data lives. A managed Postgres gives you point-in-time recovery and a nice answer for that questionnaire. Not a performance reason, a sales reason.

Comment
Fair point. Litestream gets you close on PITR but "managed" is an easier sentence in a sales call. fatima_z · edited
olu_backend · edited

Tell Claude Code in your CLAUDE.md that SQLite is a deliberate choice. It will stop suggesting the migration every time.

Comment
Done. The first answer after that didn't mention Postgres at all dental_dave · edited