Files
armonia-api/docs/decisions/0001-turso-edge-sqlite-fallback.md
kiskaadee 20eb811687 docs(api): align SRS v1.1, architecture, ADRs 0001-0005, and AGENTS.md technical blueprint
- Document separated booking/payment state engine, 48-hour payment follow-up queue, and deliberate slot release in SRS.md and architecture.md.
- Add ADR-0005 for server-side Google OAuth2 and Turso admin_allowlist.
- Rewrite AGENTS.md as a local technical blueprint defining SQLModel + Repository layers, pytest-mock boundaries, and mutmut audits.

Refs: #1, #3, #6
2026-10-19 00:12:40 -05:00

25 lines
1.8 KiB
Markdown

# ADR 0001: Turso Edge Persistence with Local SQLite Fallback
## Status
Accepted
## Context
Armonía del Ser operates on a low-margin business model where recurring software subscription fees or persistent virtual private server (VPS) costs would outweigh the operational benefits. We require a relational database that:
1. Incurs **$0/month** in operational overhead for the anticipated volume (< 500 bookings/month).
2. Provides relational schema enforcement, constraints, and atomic operations (unlike Google Sheets) for bookings, payment acknowledgments, administrator allowlists, and audit logs.
3. Executes seamlessly in local development and automated CI/CD testing without requiring remote cloud network calls or credentials.
## Decision
We adopt **Turso (libSQL)** as the primary production database, coupled with `libsql-client` in Python:
- In production, `DATABASE_URL` connects to Turso's edge network via `libsql://` or `https://` using token-based authentication.
- In local development and automated testing (`pytest`), `DATABASE_URL` connects to standard file-based SQLite (`file:local.db` or temporary test files) without requiring any cloud connection.
## Consequences
### Positive
- **Zero Cost**: Turso's free tier provides 9 GB storage and 1 billion row reads/month, far exceeding the operational needs of the practice.
- **Developer Experience**: Automated tests run locally in under 0.15 seconds with zero network dependency.
- **Relational Integrity**: Foreign keys and enum constraints prevent data corruption.
### Negative / Trade-offs
- Turso does not provide a native visual spreadsheet UI for non-technical users. Jasmin cannot open the raw database table directly; she and her assistant interact with the data exclusively through `armonia-dashboard` and Google Calendar.