| 1 | # π€ SQLite: considered alternatives, staying (2026-07-10) |
| 2 | |
| 3 | **Decision: lchat stays on SQLite via `modernc.org/sqlite`.** Alternatives were |
| 4 | considered (prompted by discomfort with the SQLite core team's public persona β |
| 5 | the Benedictine "Code of Ethics" page) and rejected. Don't re-litigate this |
| 6 | without new facts; the escape hatch to watch is noted below. |
| 7 | |
| 8 | ## Why we looked |
| 9 | |
| 10 | The SQLite team's [Code of Ethics](https://sqlite.org/codeofethics.html) (the |
| 11 | Rule of St. Benedict, adopted by D. Richard Hipp partly as a statement against |
| 12 | boilerplate CoCs) gives some people pause. Context that defused it: it governs |
| 13 | the three-person core team only, not users or contributors, and the code itself |
| 14 | is **public domain** β no license terms, nothing ideological attaches to the |
| 15 | artifact. Our build dependency is also one step removed already: |
| 16 | `modernc.org/sqlite` is Jan Mercl's machine translation of the C source into |
| 17 | pure Go. |
| 18 | |
| 19 | ## Alternatives rejected |
| 20 | |
| 21 | - **libSQL (Turso)** β the real "same engine, different governance" option: MIT, |
| 22 | open-contribution fork, same file format + SQL. **Rejected because its Go |
| 23 | bindings (`go-libsql`) require cgo**, which breaks the single-static-binary |
| 24 | `CGO_ENABLED=0` deploy that the whole per-instance architecture rests on. |
| 25 | Turso's ground-up Rust rewrite (ex-"limbo") is not production-ready and also |
| 26 | not Go-native. |
| 27 | - **Pure-Go KV stores** (bbolt, Badger, Pebble) β no SQL; every query in `db.go` |
| 28 | becomes hand-rolled index management. |
| 29 | - **Pure-Go SQL engines** (chai/genji) β nowhere near SQLite's testing pedigree; |
| 30 | unacceptable as the sole datastore of an E2EE messenger. |
| 31 | - **Postgres** β ends the one-file, one-disk deploy model. |
| 32 | |
| 33 | ## If this ever needs revisiting |
| 34 | |
| 35 | The trigger would be governance becoming a *practical* problem (licensing |
| 36 | change, abandonment) β not the ethics page. First option to re-check: |
| 37 | **libSQL's cgo situation** (a pure-Go or no-cgo binding would make it a |
| 38 | near-drop-in). File format compatibility means migration would be low-drama. |
| 39 | |