I run a small SaaS for independent auto repair shops. One developer (me), one server, no DevOps help.
The server: 1 vCPU, 2 GB RAM, Ubuntu. The whole application — web server, billing integration, email, nightly backups — runs as a single Python process using 38 MB of RAM.
Here is how it holds together, and where I would stop doing it this way.
The constraint that shaped everything
I am not optimizing for scale. I am optimizing for "I can debug this alone at 11pm."
Every piece of infrastructure I add is a piece I have to understand, upgrade, and pay for. So the question for every component was not "is this the best tool?" but "can I do without it?"
That ruled out a lot.
Two databases instead of one
Most multi-tenant SaaS designs start with a single Postgres and a tenant_id column on every table. I did the opposite: one control-plane database, and one SQLite file per shop.
/opt/app/data/platform.db # shops, users, subscriptions /opt/app/data/stores/s001/store.db # that shop's orders, inventory, staff /opt/app/data/stores/s002/store.db Routing happens inside the request lifecycle:
def store_db(store_key): path = f"/opt/app/data/stores/{store_key}/store.db" if not os.path.exists(path): abort(404) conn = getattr(g, "_db", None) if conn is None: conn = sqlite3.connect(path, timeout=10) conn.row_factory = sqlite3.Row conn.execute("PRAGMA journal_mode=WAL") conn.execute("PRAGMA busy_timeout=5000") conn.execute("PRAGMA synchronous=NORMAL") g._db = conn return conn @app.teardown_appcontext def _close(exc): conn = getattr(g, "_db", None) if conn: conn.close() Why this wins for my case:
- Isolation is free. One shop's corrupted file cannot affect another. And there is no
WHERE tenant_id = ?clause to forget. - Backup, export, or delete a tenant is one file operation.
- A single shop is small. 40 tables, 400 KB.
The cost: cross-tenant queries are awkward. I need exactly one — "how many shops are active" — and it is a loop over files, which is fine at this size.
WAL mode is not optional
SQLite's write path is serialized. That sounds fatal for a web app, and it would be, except:
- Reads never block writes in WAL mode.
- A shop has maybe 3 to 8 people using it, doing a few dozen writes an hour. The write lock is held for microseconds.
The part people miss is busy_timeout. Without it, a concurrent write returns database is locked immediately instead of waiting. With busy_timeout=5000, writers queue politely.
PRAGMA synchronous=NORMAL is the other one. Full fsync on every commit is what makes people believe SQLite is slow. NORMAL with WAL is durable enough for this workload: you can lose the last few transactions on a power cut, not the database.
What I deliberately did not install
- Postgres. My entire data set is under 10 MB. The operational surface — connection pooling, vacuum, upgrades — costs more than it buys.
- Redis. Nothing needs to survive between requests except sessions, and sessions live in SQLite.
- Celery or any job queue. The only background work is sending email and handling a payment webhook. Both finish in under a second, synchronously.
- Docker. systemd runs
python app.py. I skip a container layer, about 200 MB of overhead, and one more thing that can fail at 3am. - A load balancer or multiple workers. One process. Load average: 0.00.
That is the whole stack. Memory usage: 38 MB.
The trap nobody warns you about: time zones
The server sits in one timezone. Customers do not.
A repair order closed at 11:58pm local time must show up in that shop's "today", not the server's tomorrow. So every shop stores its own IANA timezone, and every business-date calculation goes through it:
from zoneinfo import ZoneInfo def today_for(store_tz): return datetime.now(ZoneInfo(store_tz or "America/New_York")).date() Every "today's sales", "this week's payroll", "overdue orders" query uses that function. It is a one-line fix that prevents months of "your report is off by a day" support tickets, and it stays invisible until a customer in a different timezone signs up.
Backups are the whole ballgame
When your database is a file, backup is a file copy. But not cp — copying a live WAL database gives you a torn snapshot.
sqlite3 store.db "VACUUM INTO '/tmp/snap.db'" rclone copy /tmp/snap.db remote:backups/$(date +%F)/ VACUUM INTO writes a consistent, compacted copy while the app keeps running. Then rclone ships it to WebDAV storage off-site. Cron, once a night.
A backup you have never restored is a rumor, so I run a restore drill: unzip, point the service at the file, restart. It takes about 40 seconds.
Billing webhooks
Paddle handles payments as merchant of record. The webhook is the one place where I do care about correctness:
- Verify the HMAC signature before parsing anything.
- Look up the shop by
custom_data.store. If a renewal arrives without it, fall back tosubscription_idorcustomer_id. - Treat the event as idempotent: the same event ID processed twice must not double-extend a subscription.
That fallback matters. Subscription renewals often carry no custom_data. Before I added the lookup, a renewal would return 400 — money taken, plan not extended.
When I would move to Postgres
Honestly:
- A single tenant with 50+ concurrent users, where SQLite's single writer becomes the bottleneck.
- Reporting that constantly needs to join across all tenants.
- Data past a few tens of GB per tenant.
None of those are true today. At 400 KB per shop, this box has room for thousands of tenants before disk becomes the conversation.
The point
Total infrastructure: one VPS, one Python process, 38 MB of RAM, load average 0.00.
If your SaaS serves a few hundred small businesses doing a few dozen writes an hour, SQLite is not a compromise you will grow out of next month. It is the correct answer for the constraints you actually have. The hard part is not the database. It is knowing which problems you do not have yet.
Site: https://baytally.app

