From 35f804c904648649148f22f6a58002942a4acb64 Mon Sep 17 00:00:00 2001 From: Joe Carstairs Date: Thu, 17 Jul 2025 08:22:11 +0100 Subject: add ard-005, ard-006 --- requirements/architecture/arch-v1.drawio | 113 ++++++++++++++++--------------- requirements/architecture/arch-v1.md | 5 +- requirements/architecture/arch-v1.png | Bin 92795 -> 92612 bytes requirements/architecture/ard-005.md | 19 ++++++ requirements/architecture/ard-006.md | 53 +++++++++++++++ 5 files changed, 132 insertions(+), 58 deletions(-) create mode 100644 requirements/architecture/ard-005.md create mode 100644 requirements/architecture/ard-006.md diff --git a/requirements/architecture/arch-v1.drawio b/requirements/architecture/arch-v1.drawio index d6c1d3f..5e2d9b8 100644 --- a/requirements/architecture/arch-v1.drawio +++ b/requirements/architecture/arch-v1.drawio @@ -4,43 +4,46 @@ - + + + + - + - + - + - + - + - + - + - + - + - + - + - + @@ -48,10 +51,10 @@ - + - + @@ -59,124 +62,124 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + diff --git a/requirements/architecture/arch-v1.md b/requirements/architecture/arch-v1.md index fd25708..42e8c1e 100644 --- a/requirements/architecture/arch-v1.md +++ b/requirements/architecture/arch-v1.md @@ -9,14 +9,13 @@ - There must be a REST API, which sends and receives messages to and from the desktop GUI and the Web GUI via HTTPS, and sends and receives messages to and from the CRDT sync server via Unix sockets (ard-004) -- The CRDT sync server must send and receive messages to the NoSQL database via - Unix sockets +- The Web GUI must persist domain entities in IndexedDB (ard-005) +- The CRDT sync server must persist domain entities in an SQLite file (ard-006) - There must be a backup service - The backup service must communicate to the backups bucket via HTTPS - There must be a backups bucket - The backups bucket and the server must live on different machines - There must be a Web app server, which serves a Web GUI over HTTPS -- The Web GUI must save domain entities to IndexedDB - The Web GUI must persist config and caches to Local Storage - There must be an SMS API - The SMS API must send and receive messages to the CRDT sync server via Unix diff --git a/requirements/architecture/arch-v1.png b/requirements/architecture/arch-v1.png index d70ae86..6f08be2 100644 Binary files a/requirements/architecture/arch-v1.png and b/requirements/architecture/arch-v1.png differ diff --git a/requirements/architecture/ard-005.md b/requirements/architecture/ard-005.md new file mode 100644 index 0000000..c0b3812 --- /dev/null +++ b/requirements/architecture/ard-005.md @@ -0,0 +1,19 @@ +# ard-005: IndexedDB + +## Problem + +The Web GUI must store domain entities somewhere. + +## Options + +- IndexedDB +- SQLite embedded into WASM +- Storage API +- Local storage + +## Decision + +The Web GUI will store domain entities in IndexedDB. + +For storing large amounts of data with random access, it's the standard +solution, and is adequate. diff --git a/requirements/architecture/ard-006.md b/requirements/architecture/ard-006.md new file mode 100644 index 0000000..da45169 --- /dev/null +++ b/requirements/architecture/ard-006.md @@ -0,0 +1,53 @@ +# ard-006 + +## Problem + +The CRDT sync server must persist domain entities. + +## Options + +- RDBMS + - SQLite + - Postgres + - MariaDB + - CockroachDB +- Document DBMS + - MongoDB + - FerretDB + - DocumentDB +- Vector DBMS + - Redis + - OpenSearch + - Chroma + - Milvius + - Qdrant + - Weaviate + - Postgres with the pgvector extension + - Apache Cassandra + - Valkey + - CockroachDB + +## Decision + +The CRDT server will persist entities to an SQLite file. + +I'd like to use a vector database, in order for the port to IndexedDB to be as +smooth as possible. However, the key-based API for looking up documents is +inherently inconvenient, and many of the options target ML applications. + +A well-supported RDBMS such as MariaDB or Postgres would be a good choice, if it +only adds friction to the development process, since you have to update database +schemas. + +FerretDB and its dependency, DocumentDB, would be acceptable document databases, +except that DocumentDB is owned by Microsoft. + +By process of elimination, I'll have to use an RDBMS. + +> For device-local storage with low writer concurrency and less than a terabyte +> of content, SQLite is almost always a better solution \[than a client-server +> database]. +> +> ([SQLite use case guide](https://www.sqlite.org/whentouse.html)) + +SQLite it is! -- cgit v1.2.3