mitbringsl/README.md
Tronax 67033e561c
Tests for shared lists & docs catch-up to post-MVP state
Integration tests for the invite/join/membership feature that shipped
without any coverage:

- internal/store/liststore_test.go: CreateList adds owner as member with
  invite code, GetLists returns owned+joined but not foreign lists,
  GetList access control (owner/member yes, stranger and soft-deleted no),
  JoinByInviteCode normalization/idempotency/role-keeping, lazy invite
  code generation. Runs against TEST_DATABASE_URL, skips otherwise.
- internal/httpapi/api_test.go: full E2E over the real router — register,
  create list (code in response), invite endpoint, join (lowercase),
  cross-member op push/pull sync, stranger gets 404 on every list
  endpoint, invalid code 400, idempotent re-join, and 401 gating of all
  protected routes.
- lists.go Invite handler: store errors now map through apiError, so
  non-members get 404 instead of 400 (consistent with Get/Push/Pull).

Docs updated to the actual post-MVP state: AGENTS.md (post-MVP features,
repo structure, roadmap with open points like join rate limiting),
API.md (join/invite endpoints, invite_code fields, membership rules),
SYNC.md (shared lists section), README (local-only default, sharing,
integration test recipe).
2026-08-22 09:40:57 +02:00

3.5 KiB
Raw Blame History

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.
  • 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).
  • 🚀 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

cd backend
go build ./...
go vet ./...
go test ./...

Integrationstests (Invite/Join/Membership, E2E über HTTP) laufen gegen eine wegwerfbare PostgreSQL-Instanz:

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

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