No description
Sync engine (critical):
- SyncWorker now pulls server ops for EVERY tracked list, not just
lists with pending local outbox ops. Previously remote edits on
'quiet' lists (incl. shared/joined lists) never arrived.
- SyncWorker advances the local HLC with each incoming server op
(tick(op.hlcTs)) so LWW is correct across devices with skewed
clocks; previously a fast-clock device permanently won conflicts
and a slow-clock device's own edits were silently rejected.
- Added missing 'list_create' branch in applyServerOpProjection.
- Use server hlc_ts for createdAt/updatedAt in projections so lists
and items keep a stable order instead of jumping by sync time.
- Prune old synced op_log rows (deleteOldSynced) to bound growth.
- Added ListDao.getAllListIds() one-shot query for the pull loop.
Build / runtime (critical):
- Added proguard-rules.pro with keep rules for kotlinx.serialization
serializers and Retrofit interfaces; release builds with R8 would
otherwise crash with SerializationException on the first API call.
- Added network_security_config.xml allowing cleartext only to
10.0.2.2/localhost so the debug build can reach the local backend
(blocked by default on Android 9+).
- Manifest: disable default WorkManager initializer so Hilt's
HiltWorkerFactory is used (otherwise SyncWorker can fail to
instantiate); added ACCESS_NETWORK_STATE permission.
Data safety (critical/major):
- Removed fallbackToDestructiveMigration from DatabaseModule: in a
local-first app a destructive migration on schema bump would wipe
the source of truth. Provide explicit Migrations instead.
- ShoppingRepository: wrap every local projection write + op_log
insert in db.withTransaction{} so a crash between them can no
longer silently lose a pending sync op.
- ShoppingRepository: replace manual JSON string concatenation with
kotlinx.serialization buildJsonObject; the old escapeJson did not
handle tab/CR/control chars, producing malformed op payloads.
- Persist device clientId and clientSeq counter in SessionManager so
they survive process restarts (idempotency stays stable per device).
- Trigger immediate + periodic sync after login/register/OIDC so
users see their lists without waiting up to 15 minutes.
.gitignore: ignore desktop.ini and backend/.testbin.
|
||
|---|---|---|
| android | ||
| backend | ||
| deploy | ||
| docs | ||
| .gitignore | ||
| AGENTS.md | ||
| README.md | ||
Mitbringsl 🛒
Local-First Einkaufslisten-App (Bring-Alternative, werbefrei & datensparsam).
Mitbringsl ist eine moderne, schnelle und werbefreie Einkaufslisten-App mit Local-First Synchronization. Die App funktioniert vollständig offline und synchronisiert Änderungen automatisch, sobald eine Verbindung besteht — ohne Datenverlust oder Konflikte.
🌟 Highlights & Features
- 📱 Android App: Kotlin 2.x, Jetpack Compose Material 3, Room, Hilt, WorkManager.
- ⚡ Local-First Sync Engine: Hybrid Logical Clock (HLC), append-only
op_log, Last-Write-Wins (LWW) Projektionen, Idempotente Push/Pull-Algorithmen. - 🔐 Datenschutz & Auth: Argon2id Passwort-Hashing, opaque Session-Tokens, OIDC-Unterstützung (Google & eigene IdPs).
- 🚀 Go Backend: Stdlib
net/httpRouting (Go 1.26), PostgreSQL 16 (pgxpool),pg_trgmFuzzy Autocomplete. - 🛡️ Deployment: Multi-Stage Docker Container, Caddy Reverse Proxy mit automatischem HTTPS / Standalone & Behind-Proxy Modi.
🏗️ Repository-Struktur
mitbringsl/
├── backend/ # Go REST API Backend
│ ├── cmd/ # Server & Migrate Binaries
│ ├── internal/ # Auth, Sync (HLC), Store (pgx), HTTP API
│ ├── migrations/ # SQL Migrationen (iofs-embedded)
│ └── Dockerfile # Multi-Stage Build (golang:1.26 -> distroless)
├── android/ # Android Kotlin + Compose App
│ ├── app/src/ # Room DB, Retrofit API, WorkManager, Hilt, Compose UI
│ └── build.gradle.kts
├── deploy/ # Docker Compose & Caddy Setup
│ ├── docker-compose.yml
│ ├── Caddyfile / Caddyfile.behind-proxy
│ └── .env.example
└── docs/ # Architektur- & Protokoll-Dokumentation
├── ARCHITECTURE.md # Gesamtarchitektur & Systemdesign
├── SYNC.md # Sync-Protokoll & HLC-Spezifikation
└── API.md # REST API Dokumentation
🚀 Quickstart: Backend & Stack lokal starten
1. Backend lokal bauen & testen
cd backend
go build ./...
go vet ./...
go test ./...
2. Stack per Docker Compose starten
cd deploy
cp .env.example .env
# Passwörter in .env anpassen
docker compose up -d --build
📱 Android App bauen
cd android
./gradlew assembleDebug
./gradlew test
📖 Dokumentation
- ARCHITECTURE.md – Architektur & Systemdesign
- SYNC.md – Synchronisationsprotokoll & HLC-Spezifikation
- API.md – REST API Endpoint-Referenz
- AGENTS.md – Projektstand & Architekturentscheidungen für KI-Agenten
📄 Lizenz
MIT License