mitbringsl/README.md
Tronax 37cbb816e5
Feature: Bring-style emoji & category icons for items
Every shopping item now gets a visual like in Bring: a product emoji on
a softly tinted category tile.

- ItemVisuals.kt: pure client-side classifier. German dictionary
  (~180 entries) maps item names to emoji + one of 13 categories
  (produce, drinks, bakery, dairy, meat&fish, frozen, pantry, sweets,
  household, drugstore, baby, pet, other), each with an accent color.
  Longest-keyword-first matching so compounds resolve to their most
  specific entry (Wassermelone is produce, not a drink); juice
  compounds (Apfelsaft, Orangensaft, ...) are listed explicitly because
  their fruit prefix is longer than 'saft'. Unknown items fall back to
  the generic cart on neutral grey. Works fully offline, nothing leaves
  the device.
- ListDetailScreen: emoji tile in every item row, emoji in the
  autocomplete suggestions dropdown, and a live emoji preview as the
  text field's leading icon while typing.
- ItemVisualsTest: longest-match priority, case/whitespace
  insensitivity, fallbacks, category coverage.

Verified: assembleDebug + unit tests green (JDK 21).
2026-08-22 10:16:37 +02:00

97 lines
4 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 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-Only by Default**: Kein Account nötig — die App startet direkt ohne Login; Sync & Account sind optional (auch Self-Hosted, Server-URL in der App konfigurierbar).
- 👥 **Geteilte Listen**: Listen per 8-Zeichen-Invite-Code teilen und gemeinsam bearbeiten; Membership wird serverseitig bei jedem Sync geprüft.
- 🎨 **Produkt-Icons (Bring-Style)**: Jeder Artikel bekommt automatisch ein passendes Emoji mit Kategorie-Farbe Milch 🥛, Brot 🍞, Äpfel 🍎 … auch im Autocomplete und live beim Tippen. Komplett offline über ein deutsches Wörterbuch, kein Tracking.
-**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 wie Authentik/Keycloak) — Login-Methoden werden serverseitig per `/api/config` entdeckt, Passwort-Login lässt sich per `AUTH_PASSWORD_ENABLED=false` komplett abschalten.
- ⚙️ **Settings & Themes**: Account-/Profil-Verwaltung (`/api/me`), Theme-Umschalter (System/Hell/Dunkel), lokaler Daten-Reset — alles direkt in der App.
- 🚀 **Go Backend**: Stdlib `net/http` Routing (Go 1.26), PostgreSQL 16 (`pgxpool`), `pg_trgm` Fuzzy 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
```bash
cd backend
go build ./...
go vet ./...
go test ./...
```
Integrationstests (Invite/Join/Membership, E2E über HTTP) laufen gegen eine
wegwerfbare PostgreSQL-Instanz:
```bash
docker run -d --name mitbringsl-test-pg -e POSTGRES_USER=app \
-e POSTGRES_PASSWORD=testpw -e POSTGRES_DB=appdb -p 55432:5432 postgres:16-alpine
cd backend
TEST_DATABASE_URL="postgres://app:testpw@localhost:55432/appdb?sslmode=disable" go test ./...
docker rm -f mitbringsl-test-pg
```
### 2. Stack per Docker Compose starten
```bash
cd deploy
cp .env.example .env
# Passwörter in .env anpassen
docker compose up -d --build
```
---
## 📱 Android App bauen
```bash
cd android
./gradlew assembleDebug
./gradlew test
```
---
## 📖 Dokumentation
- [ARCHITECTURE.md](docs/ARCHITECTURE.md) Architektur & Systemdesign
- [SYNC.md](docs/SYNC.md) Synchronisationsprotokoll & HLC-Spezifikation
- [API.md](docs/API.md) REST API Endpoint-Referenz
- [AGENTS.md](AGENTS.md) Projektstand & Architekturentscheidungen für KI-Agenten
---
## 📄 Lizenz
MIT License